Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

Language:
Maclaurin Series of Reciprocals
 Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 194 Accepted: 63 Case Time Limit: 2000MS

Description

Any function f(x) that is infinitely differentiable in the neighborhood of the point x = 0 can be expanded into a Maclaurin series

,

or more compactly,

.

Under certain conditions, f(x) is equal to its Maclaurin series for all x sufficiently close to 0.

Often, the Maclaurin series of f(x) is written up to only order xn-1 with a Peano remainder term, i.e.,

,

which facilitates the evaluation of f(x). The series being truncated to the xn-1 term, details about higher-order terms are inevitably lost. However, certain information concerning the series remains well-preserved. For instance, the Maclaurin series of 1/f(x) with an identical Peano remainder term can still be found.

Given the Maclaurin series of a function f(x) with a Peano remainder term, determine that of the reciprocal of f(x).

Input

The input consists of a single test case.

The first line contains an integer n (1 ≤ n ≤ 100). Each of the next n lines contains a fraction pk/qk (0 ≤ k ≤ n - 1) where pk and qk (-100 ≤ pk ≤ 100, 1 ≤ qk ≤ 100) are integers coprime to each other in the form either pk/qk (if qk ≠ 1) or pk (if qk = 1). It is guaranteed that p0 ≠ 0.

The given numbers represent the Maclaurin series

of some function f(x).

Output

Let the Maclaurin series of 1/f(x) be

where qk' > 0, and pk' and qk' are integers coprime to each other. Output n lines each of the form either pk'/qk' (if qk' ≠ 1) or pk' (if qk' = 1), listing the coefficients of 1, x, x2, ... , xn-1 in order.

Sample Input

10
1/2
-46/3
9/40
61/80
-22/5
-87/41
1/11
-42/5
-4/13
-21/44

Sample Output

2
184/3
169199/90
6223213/108
28611844561/16200
107867589093163/1992600
545525329585163771/328779000
401297234058997162673/7890696000
2398505849871035056778279/1538685720000
882189800570641237196128639/18464228640000

Source

[Submit]   [Go Back]   [Status]   [Discuss]