#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
using namespace std;
namespace ywy {
inline long long dft(long long n) { return ((n * (n + 1)) >> 1); }
inline long long solve(int n, int x) {
  long long ans = n;
  if (n < x) return (ans);
  int len = n - x + 1;
  ans += x * dft(len / x);
  ans += (len % x) * (long long)(len / x + 1ll);
  return (ans);
}
int n, x, a, b;
unsigned char bv[210001];
void dp(int pos) {
  if (pos > x || pos < 0 || bv[pos]) return;
  bv[pos] = 1;
  dp(pos - b);
  dp(pos + a);
}
inline int solve() {
  memset(bv, 0, sizeof(bv));
  dp(0);
  int ans = 0;
  for (register int i = 0; i <= x; i++) ans += bv[i];
  return (ans);
}
inline int gcd(int a, int b) {
  while (b) {
    int r = a % b;
    a = b;
    b = r;
  }
  return (a);
}
int sums[210001];
int dis[210001], que[2210001];
unsigned char vis[210001];
void ywymain() {
  cin >> n >> a >> b;
  int g = gcd(a, b);
  x = g;
  if (solve() == 2 || n < g) {
    cout << solve(n, g) + 1 << endl;
    return;
  }
  int ans = g, l = g, r = min(200100, n);
  while (l <= r) {
    int mid = (l + r) >> 1;
    x = mid;
    if (solve() != mid / g + 1)
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  memset(bv, 0, sizeof(bv));
  x = ans;
  dp(0);
  memset(dis, 0x7f, sizeof(dis));
  dis[0] = 0;
  int head = 0, tail = 1;
  que[0] = 0;
  do {
    int me = que[head];
    head++;
    vis[me] = 0;
    if (me + a <= ans) {
      if (max(dis[me], me + a) < dis[me + a]) {
        dis[me + a] = max(dis[me], me + a);
        if (!vis[me + a]) {
          vis[me + a] = 1;
          que[tail] = me + a;
          tail++;
        }
      }
    }
    if (me - b > 0) {
      if (dis[me] < dis[me - b]) {
        dis[me - b] = dis[me];
        if (!vis[me - b]) {
          vis[me - b] = 1;
          que[tail] = me - b;
          tail++;
        }
      }
    }
  } while (head < tail);
  for (register int i = 0; i <= ans; i++) {
    if (!bv[i]) continue;
    sums[dis[i]]++;
  }
  long long tot = solve(n, g) - solve(ans, g);
  for (register int i = 1; i <= ans; i++) {
    sums[i] += sums[i - 1];
    tot += sums[i];
  }
  cout << tot + 1 << endl;
}
}  // namespace ywy
int main() {
  ywy::ywymain();
  return (0);
}
