Expectation Feeds Frustation

1

1 votes
Easy-Medium
Problem

Killcode was expected to perform well against a beginer coder Scube in a competition but that day something weird had happened with him. Actually task was quite simple they both have to write N lines of codes Scube writes S line of code in 1 minute and Killcode writes K lines. Kill code was very relaxed that day because he was facing a beginer so he started writing code after H min from starting of competition while Scube started writing code from the starting of competition.The point at which Kill code overtake(or equal) Scube at the same time his code start vanishing and it vanished K lines per minute(due to some reason) and its become 0 ,Now he was shocked and he took B min of time to find what happened to his code but he was unable to find out the proper reason.Then he again started coding and same thing happened with him every time when he overtakes scube and he always takes B min to find out the reason.
At the end he lost the competition and he complained to organizers .organizers found the fault and decided that they will give him R rupees for each overtake you have to print the total Amount that he will get.
Note:-If scube is at last line and then killcode overtakes him then it won't be considered as overtake and if at any time code start vanishing Kill Code can't write the code untill it becomes Zero

Input
The input data contains integers S, K, H, B,R and N one per line
(1 ≤ S, K ≤ 100, 1 ≤ H, B ,R≤ 10, 1 ≤ N≤ 1000).

Output
Print the amount of money he will get.

Sample Input
1
2
1
1
5
10
Sample Output
10
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

In the sample input 1 minute after the start of competition Kill code will start it, and scube will be 1 line ahead from the kill code. In 2 minute kill code will overtake scube at line number 2, and at this point all the code of kill code will be vanished first time. Return to the zero and in finding the fault the kill code will take 2 more min; meanwhile the scube will be 4 line ahead from the kill code. Next time the kill code will overtake the scube at line number 8, and again his code will be vanished, but after this scube will complete the contest without any further trouble.

Editor Image

?