#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    Int N, X, D;

    void input() {
        cin >> N >> X >> D;
    }

    void input(Int N_, Int X_, Int D_) {
        N = N_;
        X = X_;
        D = D_;
    }

    set<Int> st1, st2;

    Int solve() {
        if (D == 0) {
            if (X == 0) {
                cout << 1 << endl;
                return 1;
            }
            cout << N + 1 << endl;
            return N + 1;
        }
        map<Int, vector<pair<Int, Int>>> ranges;
        vector<Int> A;
        for (int i = 0; i < N; ++i) {
            if (i == 0) A.push_back(X);
            else A.push_back(A.back() + D);
        }

        if (D < 0) {
            reverse(all(A));
            D *= -1;
//            X *= -1;
//            D *= -1;
        }

        Int lb = 0, ub = 0;
        for (Int sz = 0; sz <= N; ++sz) {
            // add ranges
            Int m = (lb % D + D) % D;
            ranges[m].push_back(make_pair(lb, ub));



            // update lb, ub
            if (sz != N) {
                lb += A[sz];
                ub += A[N - 1 - sz];
            }
        }

        Int ans = 0;
        for (auto e : ranges) {
            auto vec = e.second;
            vector<pair<Int, Int>> wec;
            sort(all(vec));

            for (int i = 0; i < vec.size(); ++i) {
                if (wec.empty()) {
                    wec.push_back(vec[i]);
                } else {
                    if ((vec[i].first - wec.back().second) <= D) {
//                        wec.back().second = vec[i].second;
                        chmax(wec.back().second, vec[i].second);
                    } else {
                        wec.push_back(vec[i]);
                    }
                }
            }

            for (auto ran : wec) {
                ans += (ran.second - ran.first) / D + 1;
//                for (Int x = ran.first; x <= ran.second; x += D) {
//                    st1.insert(x);
//                }
            }

        }

        cout << ans << endl;
        return ans;
    }

    Int fool() {
        vector<Int> A;
        for (int i = 0; i < N; ++i) {
            if (i == 0) A.push_back(X);
            else A.push_back(A.back() + D);
        }

        set<Int> st;
        for (int bit = 0; bit < 1 << N; ++bit) {
            Int sum = 0;
            for (int i = 0; i < N; ++i) {
                if (bit >> i & 1) {
                    sum += A[i];
                }
            }
            st.insert(sum);
        }
        st2 = st;

        cout << st.size() << endl;
        return st.size();
    }

    void diff() {
        for (auto e : st2) {
            if (!st1.count(e)) {
                cerr << e << endl;
            }
        }
    }

};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);


    if (true) {
        Solve solve;
        solve.input();
        solve.solve();
    } else {
        Solve solve;
        solve.input();
        solve.fool();
        solve.solve();
        solve.diff();
        while (true) {
            Int N, X, D;
            N = rand() % 10;

            X = rand() % ((int) 2e1) - (int) 1e1;
            D = rand() % ((int) 2e1) - (int) 1e1;
//            X = 0;
//            D = 0;


            Solve solve;
            solve.input(N, X, D);
            if (solve.fool() != solve.solve()) {
                cerr << N << " " << X << " " << D << endl;
                exit(-1);
            }
        }
    }


    return 0;
}


Measured memory_bytes: 23664