Problems
Do It Wrong, Get It Right
Do It Wrong, Get It Right
In elementary school, students learn to subtract fractions by first getting a common denominator and then subtracting the numerators. However, sometimes a student will work the problem incorrectly and still arrive at the correct answer. For example, for the problem
\includegraphics{https://static.e-olymp.com/content/17/17b9298bff35d33370137855663f36a3c8afde88.jpg}
one can subtract the numbers in the numerator and then subtract the numbers in the denominator, simplify and get the answer. i.e.
\includegraphics{https://static.e-olymp.com/content/3f/3f140a85857b15a5315e8fa70cfbf45c0da0a384.jpg}
For a given fraction \textbf{b/n}, your task is to find all of the values \textbf{a} and \textbf{m}, where \textbf{a} ≥ \textbf{0} and \textbf{m} > \textbf{0}, for which
\includegraphics{https://static.e-olymp.com/content/aa/aa8c7ca94856ae7c430974e05ff6c1ed1a4abe5a.jpg}
\InputFile
Consists of several test cases. Each test case will consist of a single line with two integers \textbf{b }and \textbf{n }(\textbf{1 }≤ \textbf{b}, \textbf{n }≤ \textbf{10^6}). The input will end with a line with two \textbf{0}s.
\OutputFile
For each case, output all of the requested fractions on a single line, sorted from smallest to largest. For equivalent fractions, print the one with the smaller numerator first. Output each fraction in the form \textbf{a}/\textbf{m} with no spaces immediately before or after the \textbf{/}. Output a single space between fractions. Output no extra spaces, and do not separate answers with blank lines.
Input example #1
9 12 12 14 4 12 0 0
Output example #1
0/24 5/20 8/16 8/8 5/4 0/28 9/21 9/7 0/24 3/18 3/6