#t474. 最简分数
最简分数
Simplest Fraction
Problem Description
Compute the sum of two fractions and output it in simplest form (the denominator is not necessarily larger than the numerator). If the denominator is , output error; if the denominator is , the denominator need not be output; if the result is , output 0 directly.
Input Format
Two fractions. For each fraction, first input the numerator, then the denominator. Both numerator and denominator are integers in the range .
Output Format
The simplest fraction, in the format shown in the samples. It is guaranteed that the results fit within the int range.
Sample Input 1
2 3 3 6
Sample Output 1
7/6
Sample Input 2
2 1 3 0
Sample Output 2
error
Sample Input 3
4 6 4 3
Sample Output 3
2
Sample Input 4
0 2 0 3
Sample Output 4
0