Time limit
2s
Memory limit
128 MB
Given two fractions A/B and C/D whose numerators and denominators are natural numbers, compute their sum and write it as a reduced fraction. A reduced fraction is one whose numerator and denominator have greatest common divisor 1.
The first line contains the numerator and denominator A B of the first fraction. The second line contains the numerator and denominator C D of the second fraction. All four numbers are natural numbers no greater than 30,000.
Print the numerator and denominator of the reduced sum, separated by one space.