eolymp
bolt
Try our new interface for solving problems
Problems

Farey sequences

Farey sequences

A fraction h / k is called a proper fraction if it lies between 0 and 1 and if h and k have no common factors. For any positive integer n1, the Farey sequence of order n, Fn, is the sequence of all proper fractions with denominators which do not exceed n together with the "fraction" 1 / 1, arranged in increasing order. So, for example, F5 is the sequence:

prb1512.gif

For a given n, you are to find the k-th fraction in the sequence Fn.

Input

Input consists of a sequence of lines containing two natural numbers n and k, 1n1000 and k sufficiently small such that there is the k-th term in Fn. (The length of Fn is approximately 0.3039635n^2).

Output

For each line of input print one line giving the k-th element of Fn in the format as shown in example.

Time limit 1 second
Memory limit 128 MiB
Input example #1
5 5
5 1
5 9
5 10
117 348
288 10000
Output example #1
1/2
1/5
4/5
1/1
9/109
78/197