eolymp
bolt
Try our new interface for solving problems
Problems

Sum of fractions

Sum of fractions

Find the sum of two proper fractions $a / b$ and $c / d$. Present the result as an irreducible fraction. If the result is an integer, then print only this integer. \InputFile One line contains four positive integers $a, b, c, d$ --- the numerators and denominators of the fractions. All numbers do not exceed $1000$. \OutputFile Print the numerator and denominator of the resulting fraction, or an integer if the result is a whole number.
Time limit 1 second
Memory limit 128 MiB
Input example #1
1 2 1 4
Output example #1
3 4
Input example #9
3 4 1 4
Output example #9
1
Author sveta_p
Source ІІ этап Всеукраинськой олімпиады по информатике