Module: GCD (Greatest Common Divisor)


Problem

5 /10


Fraction reduction

Theory Click to read/hide

Let's find \(gcd(|a|, |b|)\) and divide both numbers by it - this will be the answer.

Problem

Given a fraction \(a \over b\). It is required to reduce it, that is, write the same number in the form \(c \over d\), where c — integer, d is a natural number and d is the smallest possible.
 
Input 
Enter two integers a and b (\(-100<=a<=100,\ 0<b<=100 \)).

Imprint 
Output two numbers c and d.
 
Examples
# Input Output
1 3 6  1 2
2 -2 5 -2 5