QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 64 MB Total points: 100

#13173. Lights

统计

Little Johny has received a most unusual Christmas present. The sign 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 but one end: it begins at some point, but does not end anywhere. Attached to the cable are fairy lights, numbered (in order of attachment) with successive natural numbers, starting with 0. The cable itself is plugged to a control panel. There is a number of buttons on the panel, each uniquely colored and each inscribed with unique positive integer. The numbers inscribed to the buttons are pairwise relatively prime.

Upon unwrapping, no light was turned on. Thinking little at the time, Johny pressed all the buttons one by one, from first to last. To his increasing amusement he noticed that pressing the ith button turns on exactly the lights which numbers are multiples of pi, the number inscribed on the ith button. Moreover, they are burning in the color $k_i$, the one of the button. In particular, all the lights whose numbers are multiples of pi that were previously lit, change their color to $k_i$.

Johny gazes infatuated at the infinite multicolour chain and wonders what fraction of the lights burns with each particular colour. Let $L_{i,r}$ denote the number of lights burning with the colour $k_i$ among the lights with numbers $0,1,…,r$. Formally, the fraction $C_i$ of the lights burning with colour $k_i$ is defined as: $C_i= \displaystyle \lim_{r \to \infty} {\frac {L_{i.r}}{r}}$

Write a programme that:

  • reads the descriptions of the buttons on the control panel from the standard input,
  • for each colour $k_i$ calculates the fraction $C_i$, denoting the fraction of lights burning with the colour $k_i$,
  • writes out the result to the standard output.

Input

The first line of the standard input contains a single integer $n$ ($1 ≤ n ≤ 1\,000$), denoting the number of buttons on the control panel. Each of the following n lines contains a single integer $p_i$ ($1 ≤ p_i ≤ 1\,000\,000\,000$), meaning that pressing the $i-$th button makes the lights numbered with multiples of $p_i$ burn with the colour $k_i$. The numbers $p_i$ are given precisely in the order Johny had pressed them. The numbers $p_i$ are pairwise relatively prime (and thus different).

Output

Your programme should write out exactly $n$ lines to the standard output. The $i-$th line should contain the fraction $C_i$ of the lights burning with colour $k_i$, written as a fraction $a/b$, where a jest is an integer, $b$ is a positive integer and $a$ and $b$ are relatively prime. If $C_i=0$, the fraction should be written as 0/1

Example

Input

3
2
3
5

Output

4/15
4/15
1/5
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.