Given N rational numbers in the form “numerator/denominator”, you are supposed to calculate their sum. 给定N个有理数的形式“分子/分母”,你应该计算他们的和。
Each input file contains one test case. Each case starts with a positive integer N (<=100), followed in the next line N rational numbers “a1/b1 a2/b2 …” where all the numerators and denominators are in the range of “long int”. If there is a negative number, then the sign must appear in front of the numerator. 每个输入文件包含一个测试用例。每种情况都以正整数N(<=100)开头,在下一行N有理数“A1/b1a2/b2.”所有分子和分母都在“long int”的范围内。如果有负数,则符号必须出现在分子前面。
For each test case, output the sum in the simplest form “integer numerator/denominator” where “integer” is the integer part of the sum, “numerator” < “denominator”, and the numerator and the denominator have no common factor. You must output only the fractional part if the integer part is 0. 对于每个测试用例,输出最简单形式的和“整数分子/分母”,其中“整数”是和的整数部分,“分子”<“分母”,分子和分母没有公共因子。如果整数部分为0,则只能输出小数部分。