#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll res = 0;
class segment_manager {
  map<ll, ll> pos;
  void add(ll l, ll r) {
    if (l == r) return;
    pos[l] = r;
    res += r - l;
  }
  void del(ll l) {
    res -= pos[l] - l;
    pos.erase(l);
  }

 public:
  void add_range(ll l, ll r) {
    auto it = pos.lower_bound(l);
    if (it != pos.begin() && l <= prev(it)->second) --it, l = it->first;
    while (it != pos.end() && it->first <= r) {
      r = max(r, it->second);
      auto tmp = it++;
      del(tmp->first);
    }
    add(l, r);
  }
  void del_range(ll l, ll r) {
    auto it = pos.lower_bound(l);
    if (it != pos.begin() && l < prev(it)->second) {
      auto tmp = prev(it);
      ll tl = tmp->first, tr = tmp->second;
      if (r <= tr)
        del(tl), add(tl, l), add(r, tr);
      else
        del(tl), add(tl, l);
    }
    while (it != pos.end() && it->first < r) {
      auto tmp = it;
      ++it;
      if (r < tmp->second) {
        ll rr = tmp->second;
        del(tmp->first), add(r, rr);
      } else
        del(tmp->first);
    }
  }
  bool contain_all(ll l, ll r) {
    auto it = pos.upper_bound(l);
    return it != pos.begin() && r <= prev(it)->second;
  }
  bool contain_one(ll l, ll r) {
    auto it = pos.lower_bound(l);
    if (it != pos.end() && it->first < r) return true;
    if (it != pos.begin() && l < prev(it)->second) return true;
    return false;
  }
};
signed main() {
  ll N, X, D;
  cin >> N >> X >> D;
  X *= 2, D *= 2;
  if (X == 0 && D == 0) {
    cout << 1 << endl;
    return 0;
  }
  if (D == 0) {
    cout << N + 1 << endl;
    return 0;
  }
  if (D < 0) {
    D = -D;
    X = -X;
  }
  vector<ll> vs(N), sum(N + 1);
  for (long long i = 0; i < N; i++) {
    vs[i] = X + D * i;
    sum[i + 1] = sum[i] + vs[i];
  }
  unordered_map<ll, segment_manager> sts;
  for (long long i = 0; i <= N; i++) {
    ll of = sum[i] % D;
    ll x = (sum[i] - of) / D, y = (sum[N] - sum[N - i] + D - of) / D;
    sts[of].add_range(x, y);
  }
  cout << res << endl;
  return 0;
}
