spoj#MATHS. Mathematics
Mathematics
One could define mathematics as the study of quantity, structure, space and change and as the science of infinity. Sometimes very abstract, mathematics finds nevertheless applications in many engineering domains. The figure below shows so-called Ford circles. These circles are disjoint or tangent and fill the space in a very compact way! Starting with large circles, the space between these circles can be filled with circles of smaller diameter, and so on and so forth.
Mathematicians observed that the diameters and positions of the centers of these circles follow a given scheme, which can be described with the help of Farey sequences. The Farey sequence of order N is the sequence of completely reduced fractions between 0 and 1, which have denominators less than or equal to N, arranged in increasing size. Thus each Farey sequence starts with the value 0, denoted by the fraction 0⁄1, and ends with the value 1, denoted by the fraction 1⁄1.
The Amazing Circle Mathematicians (ACM) are interested in the number of terms contained in such a Farey sequence as well as in certain precise terms, which they name Interesting and Curious Position In Circle (ICPC). Your job is to provide the ACMs with this abstract information, which helps them to better understand the Ford circles.
INPUT
The input consists of several test-cases, one per line. Each test-case consists of two numbers, the first is the order N (2<=N<=106) of the Farey sequence the ACM is interested in and the second is the ICPC P (1<=P<=104) . Input terminates on a line containing 0 0 which must not be processed.
OUTPUT
For each test-case, output first the ICPC, then the total number of terms in the given Farey sequence.
SAMPLE INPUT
2 2
6 12
14 35
0 0
SAMPLE OUTPUT
1/2 3
5/6 13
6/11 65