#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
void pre() {}
void solve() {}
bool vis[200009];
int ans[200009];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  pre();
  int n;
  cin >> n;
  int a, b;
  cin >> a >> b;
  priority_queue<pair<int, int> > q;
  q.push(make_pair(0, 0));
  memset(ans, -1, sizeof(ans));
  ans[0] = 0;
  while (!q.empty()) {
    pair<int, int> z = q.top();
    q.pop();
    if (vis[z.second]) continue;
    vis[z.second] = 1;
    if (z.second + a < a + b && !vis[z.second + a] &&
        (ans[z.second + a] == -1 ||
         ans[z.second + a] > max(z.second + a, ans[z.second]))) {
      ans[z.second + a] = max(z.second + a, ans[z.second]);
      q.push(make_pair(-ans[z.second + a], z.second + a));
    }
    if (z.second - b >= 0 && !vis[z.second - b] &&
        (ans[z.second - b] == -1 || ans[z.second - b] > ans[z.second])) {
      ans[z.second - b] = ans[z.second];
      q.push(make_pair(-ans[z.second - b], z.second - b));
    }
  }
  long long fns = 0;
  int m = min(a + b - 2, n);
  for (int i = 0; i < (a + b - 1); ++i) {
    if (ans[i] == -1) {
      continue;
    }
    fns += max(0, m + 1 - ans[i]);
  }
  if (n > a + b - 2) {
    m = n;
    for (int i = 0; i < (a); ++i) {
      if (ans[i] == -1) continue;
      int l = (m) / a;
      if (m % a >= i) l++;
      int d = -a;
      int st = m - i + 1;
      fns += 1ll * l * (2 * st + 1ll * (l - 1) * d) / 2;
    }
    m = a + b - 2;
    for (int i = 0; i < (a); ++i) {
      if (ans[i] == -1) continue;
      int l = (m) / a;
      if (m % a >= i) l++;
      int d = -a;
      int st = m - i + 1;
      fns -= 1ll * l * (2 * st + 1ll * (l - 1) * d) / 2;
    }
  }
  cout << fns;
  return 0;
}
