/*
 * AOJ 1105 Unable Count
 * n, a, b <= 1,000,000
 */

#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

#define MAX_N 1000001

int n, a, b;
bool pos[MAX_N];
void init() {
    memset(pos, 0, sizeof(pos));
    for (int i = 0; i <= n; i+=a) {
        for (int j = i; j <= n; j+=b) {
            if (pos[j]) break;
            pos[j] = true;
        }
    }
}

int main() {
    while (cin >> n >> a >> b) {
        if (n == 0 && a == 0 && b == 0) break;
        init();
        int cnt = 0;
        for (int i = 1; i <= n; i++) {
            if (!pos[i]) {
                cnt++;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}