#P7048. Origami Squares

    ID: 20255 Type: Default 1000ms 256MiB

Origami Squares

Origami Squares

Alex is fond of origami — the Japanese art of paper folding. He intends to make a present for his mother. The design requires three equal square sheets, but he only has one rectangular sheet of paper. He can cut out squares from the sheet provided that their sides are parallel to the sides of the sheet. Help Alex determine the maximum possible size of the square he can cut out.

Let the dimensions of the rectangular sheet be \(a\) and \(b\). Without loss of generality, let \(w = \max(a, b)\) be the width and \(h = \min(a, b)\) be the height. There are three possible arrangements to cut out three squares:

  • Place three squares in a row horizontally: the maximum side length in this configuration is \(s_1 = \min\Bigl(h, \frac{w}{3}\Bigr)\).
  • Place three squares in a column vertically: the maximum side length here is \(s_2 = \min\Bigl(w, \frac{h}{3}\Bigr)\).
  • Place two squares in one row and one square in the row below (an L-shape layout): the maximum side length is \(s_3 = \min\Bigl(\frac{w}{2}, \frac{h}{2}\Bigr)\).

The answer is:

[ s = \max\left(s_1, s_2, s_3\right). ]

inputFormat

The input consists of two numbers \(a\) and \(b\) (which can be integers or floating-point numbers), representing the dimensions of the rectangular sheet.

outputFormat

Output a single number: the maximum possible side length \(s\) of the square. The answer should be printed with 10 decimal places.

sample

10 6
3.3333333333