Round and Round Snail

A snail walks a clockwise square spiral from the origin, one cell per second; given n seconds, print its coordinates.

Easy3ImplementationSimulationMathArrayInterviewNo attempts yetTime limit1sMemory limit128 MB

Problem

A snail starts at the origin of the coordinate plane and moves one cell per second, tracing a clockwise spiral. At second 1 the snail is at (0, 1), and from there it keeps turning clockwise as in the figure below. Given how many seconds have passed, print the position of the snail at that moment.

Input

The time nn in seconds that the snail has moved is given. (0n10000 \le n \le 1000, and nn is an integer no smaller than 0.)

Output

Print the current position of the snail as the xx coordinate and then the yy coordinate, separated by a space on one line.

Hint

  • Whether the xx coordinate and the yy coordinate grow or shrink follows a rule that depends on the direction.
  • Count one side of the snail's trail as one turn. The side length stays the same for two turns, and each time the length changes it grows by 1.