#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long MOD = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MAXN = 1e5 + 100;
long long m, a, b;
long long dist[2 * MAXN];
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    pq;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> m >> a >> b;
  for (int i = 0; i < a + b; i++) dist[i] = INF;
  dist[0] = 0;
  pq.push(make_pair(0, 0));
  while (!pq.empty()) {
    pair<long long, long long> now = pq.top();
    pq.pop();
    if (now.first != dist[now.second]) continue;
    if (now.second - b >= 0) {
      if (now.first < dist[now.second - b]) {
        dist[now.second - b] = now.first;
        pq.push(make_pair(dist[now.second - b], now.second - b));
      }
    }
    if ((now.second + a) < (a + b)) {
      if (max(now.first, now.second + a) < dist[now.second + a]) {
        dist[now.second + a] = max(now.first, now.second + a);
        pq.push(make_pair(dist[now.second + a], now.second + a));
      }
    }
  }
  long long res = 0;
  for (int i = 0; i < a; i++) {
    if (dist[i] == INF || dist[i] > m) {
      continue;
    }
    long long k1 = (dist[i] - i) / a;
    long long k2 = (m - i) / a;
    if (k1 >= 0 && k2 >= k1) {
      res = res + (k1 + 1) * (m - dist[i] + 1);
      res = res + (m - i + 1) * (k2 - k1);
      res = res - a * ((k2 * (k2 + 1) / 2) - ((k1) * (k1 + 1) / 2));
    }
  }
  cout << res << '\n';
}
