This page is still under construction.

Parts of this page are still being built. What you see may change.

Fairy Lights

Time limit1sMemory limit128 MB

Summary
For each pressed button, compute the limiting fraction of integers whose final color is that button's color.
Level

Medium6 of 10

Topics
Math, Number theory, Combinatorics, Prefix sum
Solved
No attempts yet

Problem

Little Johny has received a most unusual Christmas present. The label on the freshly unwrapped box read “Infinite chain of fairy lights”. Amused, the boy laid out his new toy on the floor.

Johny's chain is a cable with only one end: it begins at some point but never ends, stretching on forever. Fairy lights hang from the cable, numbered with consecutive natural numbers in the order they were attached, starting from 00. The cable is plugged into a control panel. The panel has several buttons, each with a unique colour and a unique positive integer written on it. The integers written on the buttons are pairwise relatively prime.

At first no light was on. Johny pressed every button one by one, from the first to the last. Pressing the ii-th button turns on exactly the lights whose numbers are multiples of pip_i (the integer on that button), and they shine in that button's colour kik_i. In particular, any light that was already on but whose number is a multiple of pip_i changes its colour to kik_i.

So the final colour of each light is the colour kik_i of the last-pressed button whose pip_i divides that light's number.

Let Li,rL_{i,r} be the number of lights shining with colour kik_i among the lights numbered 0,1,…,r0, 1, \dots, r. The fraction CiC_i of lights shining with colour kik_i is defined as:

Ci=lim⁡r→∞Li,rrC_i = \lim_{r \to \infty} \frac{L_{i,r}}{r}

Write a program that, for each colour kik_i, computes the fraction CiC_i of lights shining with that colour.

Input

The first line contains a single integer nn (1≤n≤1,0001 \le n \le 1{,}000), the number of buttons on the control panel. Each of the next nn lines contains a single integer pip_i (1≤pi≤1,000,000,0001 \le p_i \le 1{,}000{,}000{,}000), meaning that pressing the ii-th button makes the lights whose numbers are multiples of pip_i shine with colour kik_i. The values pip_i are given in exactly the order Johny pressed the buttons. The values pip_i are pairwise relatively prime (and therefore all different).

Output

Print exactly nn lines. The ii-th line must contain the fraction CiC_i of lights shining with colour kik_i, written as a fraction a/ba/b where aa is an integer, bb is a positive integer, and aa and bb are relatively prime. If Ci=0C_i = 0, print it as 0/10/1.

Examples1

  1. Example 1

    Input
    3
    2
    3
    5
    
    Expected output
    4/15
    4/15
    1/5