#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int m, a, b, vis[N], x = 1;
long long ans = 1;
int rd() {
  char c = getchar();
  int s = 0, f = 1;
  while (c > '9' || c < '0') {
    if (c == '-') f = -f;
    c = getchar();
  }
  while (c >= '0' && c <= '9') s = s * 10 + c - '0', c = getchar();
  return s * f;
}
long long dfs(long long u, long long r) {
  if (vis[u]) return 0;
  long long res = 1;
  vis[u] = 1;
  x++;
  if (u + a <= r) dfs(u + a, r);
  if (u - b >= 0) dfs(u - b, r);
  return res;
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  m = rd();
  a = rd();
  b = rd();
  ans = min(m + 1, a);
  vis[0] = 1;
  for (int i = a; i <= min(a + b, m); i++) {
    if (i - a >= 0 && vis[i - a]) dfs(i, i);
    ans += x;
  }
  int p = gcd(a, b);
  if (a + b < m)
    for (int i = 0; i < p; i++) {
      int x = (m - i) / p + 1, y = (a + b - i) / p + 1;
      ans += 1ll * (x - y) * (x + y + 1) / 2;
    }
  printf("%lld\n", ans);
  return 0;
}
