Tracy has an essay due in hours. Unfortunately, she can only type at a speed of
words per minute. However, she has
cups of tea! The first cup of tea she drinks will increase her typing speed by
words per minute, and each subsequent cup will increase it by
more than the previous cup. This means that the second cup of tea will increase her words per minute by
, to a total of
.
The effects of a cup of tea will last for hour, and it takes Tracy no time to drink a cup. However, she can only handle the effects of up to
cups of tea at the same time. Given this, can you output how many words of her essay Tracy will be able to type within the
hours?
Input Specification
The first line will contain one integer , the number of hours until Tracy's essay is due.
The next line will contain two space-separated integers, , and
, the number of cups of tea she has, and how many cups of tea Tracy can drink in succession.
Output Specification
Output the number of words Tracy can type by the time the essay is due.
Sample Input 1
5
3 2
Sample Output 1
5640
Explanation for Sample 1
Tracy can start by drinking cups of tea, making her typing speed
words per minute. Then, she types for
hour, writing
words, and the tea wears off. She then drinks
cup of tea, making her typing speed
words per minute. She types for
hour, writing
words, and the tea wears off. Finally, she types at
words per minute for
hours, writing
words. Thus she writes a total of
words.
Sample Input 2
100
25 7
Sample Output 2
113640
Comments