Hide

Problem B
Saving For Retirement

Alice is saving for her retirement. She hasn’t really decided how much she wants to save, but when she retires, she wants to have strictly more money than Bob will have when he retires.

Bob is $B$ years old. He plans to retire when he becomes $B_ r$ years old. He saves $B_ s$ every year from now until then.

Alice is $A$ years old. She wants to save $A_ s$ every year. When is the earliest time she can retire?

Input

The input is a single line consisting of $5$ space separated integers; $B$, $B_ r$, $B_ s$, $A$, $A_ s$.

Output

Output the age at which Alice can retire so that she has more money than Bob will have at age $B_ r$.

Limits

  • $20 \leq B \leq B_ r \leq 100$

  • $20 \leq A \leq 100$

  • $1 \leq A_ s, B_ s \le 100$

Explanation of first example

At the age of $25$ Bob has saved $5$ every year for $5$ years. This means he has $25$ saved up.
At the age of $23$ Alice has saved $10$ every year for $3$ years. This means she has $30$ saved up, which is strictly more than $25$.

Sample Input 1 Sample Output 1
20 25 5 20 10
23
Sample Input 2 Sample Output 2
20 28 5 30 9
35

Please log in to submit a solution to this problem

Log in