PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000040. Tỉ lệ vòng quay của các bánh răng (Rings)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Tỉ lệ vòng quay của các bánh răng (Rings)

Rings

Source: Kattis

Version: Phuoc Hung OJ Extended

Problem Statement

There are NN circular rings of radii r1,…,rNr_1,\ldots,r_N. When the first ring completes one revolution, ring ii completes r1/rir_1/r_i revolutions, assuming no slipping. For each i>1i>1, output this ratio as a reduced fraction p/q.

Input

The first line contains NN; the second contains all rir_i.

Output

Print N−1N-1 reduced fractions for r1/rir_1/r_i in order.

Subtasks

  • Subtask 1 (20 points): 2≤N≤52 \le N \le 5; 1≤ri≤1001 \le r_i \le 100
  • Subtask 2 (30 points): 2≤N≤502 \le N \le 50; 1≤ri≤10001 \le r_i \le 1000
  • Subtask 3 (50 points): 2≤N≤1002 \le N \le 100; 1≤ri≤10001 \le r_i \le 1000

Examples

Input

3
8 4 6

Output

2/1
4/3

Explanation

Ring two makes 8/4=28/4=2 revolutions; ring three makes 8/6=4/38/6=4/3 revolutions.