Nth Term of an Arithmetic Sequence
Find the Nth term of an arithmetic sequence.
Input format
A single line with three integers A (first term), D (common difference), and N (term index, at least 1).
Output format
Print the Nth term of the sequence, which equals A + (N - 1) * D.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
2 3 5Expected output
14Example 2
Input
10 -2 4Expected output
4