Under construction

Still being built. Things may change

Line on Paper

Time limit1sMemory limit1024 MB

Summary
Given a step count N up to 10^18, the task is to find the grid cell reached by a spiral-like polyline path starting at (1, 1).
Level

Easy3 of 10

Topics
Math, Simulation
Solved
No attempts yet

Problem

We trace the polyline shown in the figure below, moving one grid cell per step.

If we start at step 00 on the cell with coordinates (1;1), which cell are we on at step NN?

Input

The only line of the text file contains an integer NN (0≤N<10180 \le N < 10^{18}).

Output

Print one line with two integers separated by a space: the X and Y coordinates of the final cell.

Examples1

  1. Example 1

    Input
    7
    
    Expected output
    3 2