406192: GYM102307 F Fraction Formula
Description
Mr. Potato Head has been promoted and now is a math professor at the UNAL.
For his first course he is willing to teach hard subjects, so at the moment he is teaching how to add and subtract fractions.
To complete his course the students have to do a long series of exercises, each exercise corresponds to a valid formula containing only additions and subtractions of fractions.
Formally a valid formula is one of the following:
- A fraction
- $$$F_1+F_2$$$
- $$$F_1-F_2$$$
- $$$(F_1)$$$
Mr. Potato Head knows that the exam would be impossible if fractions are too large or if they are negative, so he decides that for every fraction $$$a/b$$$, $$$0 \leq a \leq 100$$$ and $$$0 < b \leq 20$$$.
Can you pass the course of Mr. Potato Head?
InputThe input consists of several lines, each line contains a valid formula without spaces.
It is guaranteed that all lines contains valid formulas and the total number of characters in all formulas does not exceed $$$2*10^5$$$
OutputFor each formula output a line with an irreducible fraction $$$a/b$$$, $$$b>0$$$ $$$-$$$ The solution of the corresponding formula
ExampleInput1/2+1/3 1/5-2/10 1/2+(1/2-2/1)Output
5/6 0/1 -1/1Note
A fraction is irreducible if its numerator and denominator do not have common divisors greater than 1