This page is still under construction.

Parts of this page are still being built. What you see may change.

Unlucky

Time limit1sMemory limit128 MB

Summary
Find how much water a traveler can deliver to an oasis s meters away, given w total water and carry limit k.
Level

Hard8 of 10

Topics
Math, Greedy
Solved
No attempts yet

Problem

Byteasar is stranded in the middle of a desert, ss meters from the nearest oasis.

Luckily he has a compass and knows exactly which direction leads to the oasis. He carries ww milliliters of water, but he can hold at most kk milliliters at any one time. Walking one meter costs exactly one milliliter of water, and he drinks at a steady rate: for example, after walking 1/31/3 of a meter he has drunk 1/31/3 of a milliliter. At any moment he may put aside any amount of water to drink later, and he may walk back to collect water he left behind. Sometimes going back for cached water pays off.

Byteasar wants to bring as much water as possible to the oasis. Assume he can always reach the oasis if he drinks wisely. How much water can he bring?

Input

A single line contains three integers ss, ww, and kk (10≤s,w,k≤10810 \le s, w, k \le 10^8): the distance to the oasis, the amount of water he has, and the maximum amount he can carry at once.

Output

Print one real number: the maximum volume of water (in milliliters) that Byteasar can bring to the oasis, printed with exactly three digits after the decimal point.

Examples4

  1. Example 1

    Input
    10 30 10
    
    Expected output
    5.333
    
  2. Example 2

    Input
    30 50 100
    
    Expected output
    20.000
    
  3. Example 3

    Input
    10 100 10
    
    Expected output
    13.998
    
  4. Example 4

    Input
    10 10 10
    
    Expected output
    0.000