#include <bits/stdc++.h>
using namespace std;
long long sum;
int main() {
  int m, a, b;
  int maxi = 0;
  int y;
  cin >> m >> a >> b;
  int x;
  x = 0;
  sum += m + 1;
  do {
    while (x - b < 0 && x + a <= m) {
      x = x + a;
      maxi = max(maxi, x);
      sum += m + 1 - maxi;
    }
    y = x;
    while (y + a <= m) {
      y = y + a;
      sum += m + 1 - max(maxi, y);
    }
    if (x - b >= 0) {
      x = x - b;
      if (x > 0) {
        maxi = max(maxi, x);
        sum += m + 1 - maxi;
      }
    }
  } while (x != 0 && (x - b >= 0 || x + a <= m));
  cout << sum;
  return 0;
}
