|
Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Автор: Михаил Копачев, РГАТА.
Vasya and Petya are playing with cubes. Each of them has brought his own
box of cubes to play with. The boxes previously contained an equal number of
cubes (k), but after Petya has lost one of them, he has one cube less.
The boys' cubes are quite identical, so they can be used to assemble
various flat structures (solid one-layer figures with contacting sides).
It is known that using all the cubes (except lost) the boys can assemble
a square (each side of the square having the same number of cubes),
but cannot assemble any other rectangle.
What is the largest number of the cubes that the box can contain,
if we know that the total number of the cubes the boys have got does
not exceed n?
Your task is to make a program that will use the specified number n
to define the maximum k (the number of the cubes in Vasya's box) and
fit the problem specification.
Input
The input contains only one integer n.
Output
The output should contain only one integer k.
Limitations
10 ≤ n ≤ 109.
Input 1
|
Output 1
|
10
|
5
|
Input 2
|
Output 2
|
25
|
13
|
Для отправки решений необходимо выполнить вход.
|