JDCC '16 Contest 2 P1 - Simplify

View as PDF

Submit solution


Points: 3
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Nancy is in second grade and has just begun to learn about fractions. She's particularly intrigued by the fact that four eighths, two quarters and one half are all equal! However, because she isn't used to working with big numbers, she prefers that her fractions' numerators and denominators be expressed using the smallest numbers possible. Can you build a program Nancy can use to simplify her fractions?

Input

Each test case contains two integers N, D (1 \le N < D \le 10 000), the numerator and denominator of a fraction, separated by a forward slash.

Output

For each test case, output the corresponding simplified fraction.

Sample Input

1/2

Sample Output

1/2

Sample Input

3/9

Sample Output

1/3

Comments

There are no comments at the moment.