Competitions

# Old man and chessboard

Kratos has travelled to many different places during his journey. So, today he wandered into a small village, where he was sheltered by a gray-haired old man, fed and gave a place for an overnight stay. Instead, the old man asked only one thing - to make a chessboard for him, because he loves this game so much.

The old man has n white and m black squares 1 * 1, out of which he wants to make not an ordinary board 8 * 8, but the largest possible, which firstly will be square, and secondly will have a checkerboard coloring, that is, where any two adjacent cells on the side will be of different colors (while the corner cells can be either white or black, in contrast to the usual chessboard). Kratos did not quite understand why the old man needed such a board, but did not argue, and set to work. However, our titanium has very bad mathematics, so finding the length of the side of the square, which should eventually turn out, turned out to be an impossible task for him, and he turned to you for help. Help him - find the maximum length of a chessboard, which can be made up of existing squares.

#### Input

Two integers n and m (0n, m109) - the number of white and black squares respectively. It is guaranteed that n + m > 0.

#### Output

Print the length of the side of the maximum possible square having a checkerboard coloring, which can be made up of the old man's squares. You do not need to use all squares.

Time limit 1 second
Memory limit 128 MiB
Input example #1
8 9

Output example #1
4

Input example #2
15 12

Output example #2
5

Source 2018 Cycle of Internet Olympiads for schoolchildren, second team season olympiad, Basic nomination, October 20, Problem C