#include <iostream>
using namespace std;
 
int main() {
    while (true) {
        int n, a, b;
        cin >> n >> a >> b;
        if ((n | a | b) == 0) {
            break;
        }
        int representableNum = 0;
        bool* isRepresentable = new bool [n + 1];
        fill_n(isRepresentable, n + 1, false);
        isRepresentable[0] = true;
        for (int j = 0; j < a; j++) {
            int x = b * j;
            if (n < x) {
                break;
            }
            while (x <= n) {
                if (isRepresentable[x] == false) {
                    isRepresentable[x] = true;
                    representableNum++;
                }
                x += a;
            }
        }
        cout <<  n - representableNum << endl;
        delete[] isRepresentable;
    }
}


 
 