Contest Duration: - (local time) (100 minutes) Back to Home
F - Sum Difference /

Time Limit: 2 sec / Memory Limit: 1024 MB

### 制約

• -10^8 \leq X, D \leq 10^8
• 1 \leq N \leq 2 \times 10^5
• 入力は全て整数である

### 入力

N X D


### 出力

S - T として考えられる値の種類数を出力せよ。

### 入力例 1

3 4 2


### 出力例 1

8


A(4, 6, 8) です。

(高橋君, 青木君) の取り方は、 ((), (4, 6, 8)), ((4), (6, 8)), ((6), (4, 8)), ((8), (4, 6))), ((4, 6), (8))), ((4, 8), (6))), ((6, 8), (4))), ((4, 6, 8), ())

8 通りあります。

S - T はそれぞれ -18, -10, -6, -2, 2, 6, 10, 18 であるので、値の種類数は 8 です。

### 入力例 2

2 3 -3


### 出力例 2

2


A(3, 0) であり、S - T として考えられる値は -3, 3 で、種類数は 2 です。

### 入力例 3

100 14 20


### 出力例 3

49805


Score : 600 points

### Problem Statement

We have an integer sequence A of length N, where 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 S and T be the sum of the numbers taken by Takahashi and Aoki, respectively. How many possible values of S - T are there?

### Constraints

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

### Input

Input is given from Standard Input in the following format:

N X D


### Output

Print the number of possible values of S - T.

### Sample Input 1

3 4 2


### Sample Output 1

8


A is (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), ()).

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

### Sample Input 2

2 3 -3


### Sample Output 2

2


A is (3, 0). There are two possible values of S - T: -3 and 3.

### Sample Input 3

100 14 20


### Sample Output 3

49805