#include using namespace std; typedef long long ll; typedef vector VI; typedef vector VLL; ll gcd(ll a, ll b){ if(a%b == 0){ return b; }else{ return gcd(b, a%b); } } int main(){ ll t,a,b,ans = 1; cin >> t >> a >> b; unsigned long long lcm = a/gcd(a,b)*b; --t; ans += t/a + t/b - t/lcm; cout << ans << endl; return 0; }