Rinsing the Cream Can

Time limit1sMemory limit128 MB

Problem

Granny keeps her moonshine whiskey in a cream can, and a surprise inspection by Eliot Ness is imminent. Before he arrives she wants to remove as much whiskey from the can as possible.

She can upend the can to pour its contents onto the ground, but because of surface tension and the shape of the can a fixed volume $V_r$ of liquid always clings to the inside and cannot be poured out. To wash out more whiskey she has a barrel of rain water and may rinse the can up to $k$ times.

The can starts holding $V_w$ units of pure whiskey. Each rinse works like this:

  1. pour in some amount of water $w \ge 0$ (possibly none); the total liquid in the can may never exceed its capacity $V_c$;
  2. mix thoroughly, so the whiskey is spread uniformly through the liquid;
  3. upend the can, leaving exactly $V_r$ units of liquid behind (a whiskey-and-water mixture in the same proportion as just before pouring).

Whiskey and water mix perfectly and their volumes are additive. Granny has time for at most $k$ rinses and a total of $V_b$ units of rain water. By choosing how much water to use on each rinse, she wants to minimize the volume of whiskey still left in the can after her final rinse.

Input

The input contains several test cases. Each test case is a single line with five numbers:

  • $k$ — an integer with $0 < k \le 100$, the maximum number of rinses allowed;
  • $V_b$ — a real number with $V_b > 0$, the volume of rain water available in the barrel;
  • $V_w$ — a real number with $V_w > 0$, the initial volume of whiskey in the can;
  • $V_r$ — a real number with $V_r > 0$, the volume of liquid that always remains after upending;
  • $V_c$ — a real number with $V_c > V_w$ and $V_c > V_r$, the capacity of the can.

A line containing a single $0$ follows the last test case and must not be processed.

Output

For each test case, print on its own line the minimum possible volume of residual whiskey left in the can after at most $k$ rinses, rounded to exactly six decimal places.

Notes

The total amount of water used across all rinses may not exceed $V_b$, and the total liquid in the can may never exceed $V_c$ at any moment. Assume whiskey and water mix perfectly and that their volumes add: combining $x$ units of whiskey with $y$ units of water yields exactly $x + y$ units of liquid.