eolymp
Competitions

DSA Week 2

Sum of fractions

Find the sum of two proper fractions a / b and c / d. Give the result in the form of irreducible fraction. If the result is an integer, print this one integer.

Input

One line contains four positive integers a, b, c, d – the numerators and denominators of the fractions. All numbers are not greater than 1000.

Output

Print the numerator and denominator of resulting fraction or one integer.

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 ІІ этап Всеукраинськой олімпиады по информатике