atcoder#ABC259A. [ABC259A] Growth Record
[ABC259A] Growth Record
Score : points
Problem Statement
Takahashi had his -th birthday, when he was centimeters tall. Additionally, we know the following facts:
- In each year between Takahashi's birth (-th birthday) and his -th birthday, his height increased by centimeters. More formally, for each , his height increased by centimeters between his -th birthday and his -th birthday.
- Between Takahashi's -th birthday and his -th birthday, his height did not change.
Find Takahashi's height on his -th birthday, in centimeters.
Constraints
- Takahashi was at least centimeter tall at his birth.
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer as an integer.
38 20 17 168 3
168
In this sample, Takahashi was centimeters tall on his -th birthday. Also, his height did not change between his -th birthday and -th birthday. From these facts, we find that he was centimeters tall on his -th birthday, so the answer is .
1 0 1 3 2
1
In this sample, Takahashi was centimeter tall on his -th birthday and centimeters tall on his -st birthday.
100 10 100 180 1
90