Fractional arithmetic#1017

Fractional arithmetic

1 second
64 megabytes
Easy

Write a program that performs addition, subtraction, multiplication, and division of fractions. The format for fractions in the input and output is as follows:

Examples of fraction representation: -7 3/4, 8 1/2, -7/11, 0, 11.

Input

The first line contains a fraction (the first operand), the second line contains the operation sign ("+" for addition, "-" for subtraction, "*" for multiplication, "/" for division), and the third line contains a fraction (the second operand). Both fractions may be reducible.

The integer part can take values from to , the numerator and denominator can take values from to , and for division, the second operand is not equal to zero.

Output

Print a single irreducible proper fraction (the result) in the described format.

Examples

Example 1

Loading
Loading