Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/progressiya-yigindisi

Sum of a progression

Easy 1000 ms 64 MB 9%
Share

The first term $a$ of an arithmetic progression, its common difference $d$ and the number of terms $n$ are given. The terms are: $a, \; a + d, \; a + 2 * d, \; \ldots$ Find the sum $S$ of the first $n$ terms.

n terms of an arithmetic progression drawn as columns: the first is a, each next is d larger than the previous

Input

One line with three integers: $a$, $d$ and $n$.

Output

One integer — $S$.

Note

$-10^{6} \le a, d \le 10^{6}$
$1 \le n \le 10^{6}$

Examples

Input #1
1 1 5
Output #1
15
Input #2
10 -3 4
Output #2
22

Sign in to submit a solution

Signing up is free and takes a minute.