#ABC147F. [ABC147F] Sum Difference

[ABC147F] Sum Difference

提示:该题测试数据补录中,暂不支持评测提交。

No testdata at current.

No submission language available for this problem.

Score : 600600 points

Problem Statement

We have an integer sequence AA of length NN, where A1=X,Ai+1=Ai+D(1≤i<N)A_1 = X, A_{i+1} = A_i + D (1 \leq i < N ) holds.

Takahashi will take some (possibly all or none) of the elements in this sequence, and Aoki will take all of the others.

Let SS and TT be the sum of the numbers taken by Takahashi and Aoki, respectively. How many possible values of S−TS - T are there?

Constraints

  • −108≤X,D≤108-10^8 \leq X, D \leq 10^8
  • 1≤N≤2×1051 \leq N \leq 2 \times 10^5
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN XX DD

Output

Print the number of possible values of S−TS - T.

3 4 2
8

AA is (4,6,8)(4, 6, 8).

There are eight ways for (Takahashi, Aoki) to take the elements: $((), (4, 6, 8)), ((4), (6, 8)), ((6), (4, 8)), ((8), (4, 6))), ((4, 6), (8))), ((4, 8), (6))), ((6, 8), (4)))$, and ((4,6,8),())((4, 6, 8), ()).

The values of S−TS - T in these ways are −18,−10,−6,−2,2,6,10-18, -10, -6, -2, 2, 6, 10, and 1818, respectively, so there are eight possible values of S−TS - T.

2 3 -3
2

AA is (3,0)(3, 0). There are two possible values of S−TS - T: −3-3 and 33.

100 14 20
49805