#include <bits/stdc++.h>
using namespace std;
int n, a, b, c, tmp;
long long ans;
bool used[200005];
queue<int> q;
int gcd(int a, int b) {
  while (b) {
    int x = a % b;
    a = b, b = x;
  }
  return a;
}
int main() {
  scanf("%d%d%d", &n, &a, &b), ans = tmp = used[0] = 1, c = gcd(a, b);
  for (int i = 1; i <= min(n, a + b); i++) {
    if (i - a >= 0 && used[i - a]) {
      used[i] = 1, tmp++, q.push(i);
      while (!q.empty()) {
        int x = q.front();
        q.pop();
        if (x + a <= i && !used[x + a]) used[x + a] = 1, tmp++, q.push(x + a);
        if (x - b >= 0 && !used[x - b]) used[x - b] = 1, tmp++, q.push(x - b);
      }
    }
    ans += tmp;
  }
  if (a + b > n) return printf("%lld", ans), 0;
  for (int i = 0; i < c; i++) {
    int x = (n - i) / c + 1, y = (a + b - i) / c + 2;
    ans += (long long)(x + y) * (x - y + 1) >> 1;
  }
  printf("%lld", ans);
  return 0;
}
