Recursion - 2#11249

Recursion - 2

1 second
128 megabytes
Easy

Three integers a, b, c are given. For a given integer , compute the value of the function:

f(n) = \begin{cases} a, & n = 0 \\ f(n - 1) + bn + c, & n > 0 \end{cases}

Input

Four integers a, b, c~(|a|, |b|, |c| \le 1000), n~(0 \le n \le 1000).

Output

Print the value of .

Examples

Example 1

Loading
Loading