題目來源:judgegirl from ntu prof. pangfeng Liu
Task Description
Write a program to calculate addition, subtraction, multiplication, and division for two mixed fractions. You will be given two mixed fractions -- and . For example, if , , and , then you have 1.75. You can also represent negative number by a negative , so if , , and , then the result is -1.75. For simplicity we assume that and are always non-zero, and are always non-negative, and and are always positive. Also, and have to be simplified. For example, you cannot have , , and . Also when or is 0, and must be 1. We will be given an extra number as the operator. If is 0, 1, 2, 3, then the operation is addition, subtraction, multiplication, and division, respectively. Now given , compute the final result as a mixed fraction .
Limits
The ranges of numbers are as follow. and are non-zero and between -100 and 100 inclusively. , and are non-negative and no more than 100. and are positive and no more than 100. is always between 0 and 3 inclusively.
Input
Output
The output follows the same rules as the input. You should output , , and in three lines.
Sample input
1
3
4
0
-2
3
4
Sample output
-1
0
1
Sample input
2
0
1
2
-1
1
3
Sample output
-2
2
3