#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) #define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++) #define ALL(x) (x).begin(), (x).end() const double PI = acos(-1); long long lcm(long long a, long long b) { return a / gcd(a, b) * b; } // override function template of std::lcm long long lcm(int a, int b) { return lcm((long long)a, (long long)b); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long t, a, b; cin >> t >> a >> b; long long ret = (t-1)/a + (t-1)/b + 1; if (b / gcd(a, b) < 3.0 * t / a) { long long c = lcm(a, b); ret -= (t-1)/c; } cout << ret << endl; return 0; }