eolymp
bolt
Try our new interface for solving problems
Problems

Fractions: addition and subtraction

Fractions: addition and subtraction

Two fractions are given. Find their sum or difference. \InputFile Each line contains an example of addition or subtraction of fractions. The numerator and denominator of each fraction is a positive integer, not greater than $10^9$. \OutputFile For each input example, print in a separate line the answer in the form of an irreducible fraction. If the answer is negative, a minus sign in front of the fraction should be printed.
Time limit 1 second
Memory limit 128 MiB
Input example #1
1/2 + 3/4
4/5 - 7/3
3/2 + 5/6
7/6 - 1/6
3/2 - 3/2
Output example #1
5/4
-23/15
7/3
1/1
0/1
Author Michael Medvedev