cho.sh
Notes
Loading...

Find the Fraction

Time limit

0.5s

Memory limit

256 MB

Problem

In an infinite table, the cell in row r and column c contains the fraction r/c.

1/11/21/31/41/5...
2/12/22/32/4......
3/13/23/3.........
4/14/2............
5/1...............
..................

The fractions are read in a zigzag order along diagonals: 1/1, 1/2, 2/1, 3/1, 2/2, and so on.

Given an integer X, print the X-th fraction in this order.

Input

The first line contains an integer X. (1 <= X <= 10,000,000)

Output

Print the X-th fraction in numerator/denominator format on the first line.