This page is still under construction.

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

Alloys

Interview

Time limit1sMemory limit1024 MB

Summary
Given a budget c per kilogram, choose titanium, aluminium, and magnesium ratios summing to 1 with x+y at most c to maximize hardness xy.
Level

Medium6 of 10

Topics
Math, Greedy, Binary search, Geometry
Solved
No attempts yet

Problem

Pelle is building a new advanced underground drill. He wants to build the drill out of a new titanium-aluminium-magnesium alloy. Such an alloy can be mixed in many ways. If an alloy is made with the ratios x,y,zx, y, z (x+y+z=1x + y + z = 1) of titanium, aluminium and magnesium, the alloy gets a hardness of xyxy, and a price of x+yx + y SEK per kilogram.

Pelle only has a fixed amount of money per kilogram that he can spend on alloys for his drills. What is the maximum hardness he can get on his new alloy?

Input

The first and only line of input contains a decimal number cc (0≤c<20 \le c < 2, between 1 and 6 digits after the decimal point), the amount of money in SEK that Pelle can spend per kilogram alloy.

Output

Output a single decimal number, the maximum hardness of Pelle's alloy.

Your answer will be considered correct if you have an absolute error of at most 10−6{10}^{-6}.

Examples1

  1. Example 1

    Input
    1.0
    
    Expected output
    0.25