#include using namespace std; #define REP(i, n) for(ll (i) = 0; (i) < (n); (i)++) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) typedef long long ll; ll gcm(ll a, ll b){ ll c; if(a < b){ c = a; a = b; b = c; } while(b){ c = a%b; a = b; b = c; } return a; } int main(void){ ll t, a, b; cin >> t >> a >> b; vector va; REP(i, t){ if(!(i%a)) va.push_back(i); } vector vb; REP(i, t){ if(!(i%b)) vb.push_back(i); } ll ans = 0; for(ll i = 0, j = 0; i < va.size() || j < vb.size(); ){ //cout << i << ' ' << j << endl; if(i == va.size()){ ans++; j++; }else if(j == vb.size()){ ans++; i++; }else if(va[i] == vb[j]){ ans++; i++; j++; }else if(va[i] < vb[j]){ ans++; i++; }else{ ans++; j++; } } cout << ans << endl; return 0; }