#include using namespace std; long long gcd(long long a, long long b){ if (b == 0) return a; return gcd(b, a % b); } long long N, A, B; int main() { cin >> N >> A >> B; long long L1 = N / A; long long L2 = N / B; long long M = gcd(A, B); long long L3 = L1 / (B / M); cout << L1 + L2 - L3 + 1 << endl; return 0; }