2002 Canadian Computing Competition, Stage 1

Problem J4/S2: Fraction Action

Many advanced calculators have a fraction feature that will simplify fractions for you.

You are to write a program that will accept for input a non-negative integer as a numerator and a positive integer as a denominator, and output the fraction in simplest form. That is, the fraction cannot be reduced any further, and the numerator will be less than the denominator. You can assume that all input numerators and denominators will produce valid fractions.

Examples

Input

28
7


Output

4

Input

13
5


Output

2 3/5

Input

0
7


Output

0

Input

55
10


Output

5 1/2

All Submissions
Best Solutions


Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Sep 28, 2008

Problem Types: [Show]

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

any case div by 0?

"You can assume that all input numerators and denominators will produce valid fractions."

Was this program homework?
Because lots of you did this simultaneously.

You're right. Good job observing that.