Under construction

Still being built. Things may change

Gifts

Interview

Time limit2sMemory limit128 MB

Summary
Find the maximum cube side length A so that N cubes of size A can fit inside an L×W×H box, using binary search on A.
Level

Medium4 of 10

Topics
Binary search, Math
Solved
No attempts yet

Problem

Minsik has N small boxes of the same size to give as gifts. Every small box is a cube with side length A, so its size is A × A × A.

He wants to put all of these small boxes into a rectangular box of size L × W × H. Every small box must be entirely inside the large box, and each edge of every small box must be parallel to an edge of the large box.

Given N, L, W, and H, find the maximum possible value of A.

Input

The first line contains four integers N, L, W, and H.

Output

Print the maximum possible value of A. An absolute or relative error of at most 10^-9 is accepted.

Constraints

  • 1 ≤ N ≤ 1,000,000,000
  • 1 ≤ L, W, H ≤ 1,000,000,000

Examples4

  1. Example 1

    Input
    10 4 2 10
    
    Expected output
    2.0
    
  2. Example 2

    Input
    2 2 2 2
    
    Expected output
    1.0
    
  3. Example 3

    Input
    1 12 47 5
    
    Expected output
    5.0
    
  4. Example 4

    Input
    77 146 523 229
    
    Expected output
    52.300000000000004