Олимпиадный тренинг

Задача 31872. Add two fractions


Given two rational fractions: \(a \over b\) and \(c \over d\)< /span>. Add them up and write the result as an irreducible fraction \(m \over n\).
 
Input 
The program receives as input 4 natural numbers a, b, c, d, not exceeding 100.
 
Output 
The program should output 2 natural numbers m and n such that \({m \over n} = {a \over b }+ {c \over d}\) and fraction \(m \over n\) – irreducible.
 
Examples
# Input Output
1  1 3 1 2 5 6

Запрещенные операторы:gcd