#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int64_t m, a, b;
  cin >> m >> a >> b;
  vector<int> used(a + b + 1);
  used[0] = 1;
  int64_t ans = 1;
  int64_t cur = 1;
  vector<int> q;
  for (int i = 1; i <= a + b && i <= m; ++i) {
    if (i >= a && used[i - a] == 1) {
      used[i] = 1;
      q.push_back(i);
      ++cur;
    }
    while (!q.empty()) {
      int p = q.back();
      q.pop_back();
      if (p - b >= 0 && used[p - b] == 0) {
        used[p - b] = 1;
        q.push_back(p - b);
        ++cur;
      }
      if (p + a <= i && used[p + a] == 0) {
        used[p + a] = 1;
        q.push_back(p + a);
        ++cur;
      }
    }
    ans += cur;
  }
  if (m > a + b) {
    ans += (m - (a + b)) * cur;
    int64_t per = (a + b) / (cur - 1);
    ++m;
    m -= a + b;
    int64_t cnt = m / per;
    ans += (cnt - 1) * cnt * per / 2;
    ans += cnt * (m % per);
  }
  cout << ans << endl;
  return 0;
}
