distance in front of the initial position. Next, there are. qquestions, each time asking how much rice at least it takes for Jerry to move forward. .Note that each question is an independent one.
Although Jerry is a mouse, he likes perfect square numbers. If a number can be expressed as the square of an integer, it is called perfect square numbers. Jerry can use magic to move forward or backward a distance of any perfect square numbers, which costs a grain of rice each time. And the position after each use of magic can not be behind the initial position or more than 10^5 10 5 distance in front of the initial position. Next, there are q q questions, each time asking how much rice at least it takes for Jerry to move forward d_i d i .Note that each question is an independent one.