Tianjin University Online Judge
Contests Virtual Contests Problems Submit Runs Status Rank List Forum

2558.   Medium Size Summations (R2D2)
Time Limit: 5.0 Seconds   Memory Limit: 65536K
Total Runs: 123   Accepted Runs: 53



R2-D2 (our well known friendly robot) needs to perform some operations quickly to save his space ship. These operations require computing long summations and a division. Moreover, he needs to find the exact solution and he is required to present a report with the results. For that, he needs to simplify his solution as much as possible.

We assume that there is an array available (X1, X2 , ...) of 99999999 elements.

The array has the peculiar property that the average of the first K numbers is equal to the average of the index K and the number 1.

R2-D2 needs to do the following: Given a natural number N less than 99999999, his assignment is to compute the function:

F(N) = F1(N) / F2(N) where:

F1(N) = N × (Σ_{0 ≤ k ≤ N} k4/Xk)

F2(N) = (Σ_{0 ≤ k ≤ N} k3/Xk) × (Σ_{0 ≤ k ≤ N} k2/Xk )

That is, F1(N) = N × ( 1/X1 + 16/X2 + ... + N4/XN) and

F2(N) = ( 1/X1 + 8/X2 + ... + N3/XN) × ( 1/X1 +4/X2 + ... + N2/XN)

Since R2-D2 needs an exact solution, we ask him to report the following:
The solution needs to be given as a pair of relative prime numbers a,b such that f(N) = a/b if the solution is not an exact integer. Otherwise just give the exact integer. The numbers processed by R2-D2 were of eight digits (99999999). Remember that R2-D2 was built long long time ago. His circuits are not that fast but he is clever. R2-D2 was able to perform one of these operations in less than one second. Can you do this assignment as fast as R2-D2 did it?

Input

You will receive an input line with natural numbers separated by comma. Each number is less than 99999999. You will receive no more than 20 numbers.

Output

You need to give a sequence of lines each one with the solution of the corresponding input case. The solution is either a pair of natural numbers separated by the symbol / representing the pair a,b mentioned above (when the division is not exact) or just one natural number (when the division is exact). Notice that these numbers could require more than 8 digits.

Sample Input

1,2

Sample Output

1
6/5


Source: Mexico and Central America 2006
Submit   List    Runs   Forum   Statistics

Tianjin University Online Judge v1.3.0
Maintance:Fxz. Developer: SuperHacker, G.D.Retop, Fxz