#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){ if(!b) return a; else return (b, a%b); } int main(void){ ll t, a, b; cin >> t >> a >> b; if(a < b) swap(a, b); ll lcm = a/gcm(a, b)*b; ll ans = (t-1)/a+1+(t-1)/b+1-((t-1)/lcm+1); cout << ans << endl; return 0; }