APPROB - GETTING AN AP

no tags 

Little John has been learning about sequences of numbers and he is very excited about arithmetic progressions.

He takes three boxes and puts some chits in each of them. For deciding the number of chits, he randomly chooses a number n, and places n chits in first box, 2*n chits in the second box and 3*n chits in the third box. If a box contains x chits then the chits are numbered from 1 to x.

Now he randomly chooses a chit from each of the three boxes, and places them in order. (Chit from first box first, then the chit from second box and then the chit from third box). He wants to determine if the sequence so obtained form an arithmetic progression.

Given the number n that he chooses, find the probability that the chits he draws form an arithmetic progression.

Input

The input consists of a number of test cases. The first line of input contains T ,the number of test cases.

Then T lines follow , each containing the number n that Little John has chosen.

1<=T<=100000

1<=n<=100000

Output

The output for each test case should be of the form p/q , where p/q is an irreducible fraction denoting the probability of forming an arithmetic progression from the chits he picks. 

Example

Input:
2
1
2

Output:
1/3
1/8

hide comments
Tanmay: 2014-06-04 20:37:10

Can you tell me what's wrong with my code? It seems to be working for the cases which I can solve by hand. Submission ID: 11704711
Edit:
for n > 2, are (3, 2, 1) and the likes considered as arithmetic progressions?
Edit: AC. Yes, they are.

Last edit: 2014-06-05 10:38:10
adhikari vushesh babu: 2014-06-04 14:22:20

My 200th problem .:)

Julia Dream: 2014-06-04 09:14:43

Last edit: 2014-06-04 15:21:37
kk: 2014-06-03 23:41:15

Pls check my submission, id is 11699630

Tony Stark: 2014-06-03 22:11:43

Nice problem!!

Last edit: 2014-06-03 23:11:24
P_Quantum: 2014-06-03 19:47:06

Nice one!!

shiv prasad chabarval: 2014-06-02 21:25:32

yeah, got it :)

Last edit: 2014-06-03 19:39:27
Sarvesh Mahajan: 2014-06-02 20:14:43

@avinish chandra you need a faster algorithm
@Ford Tiburon the chits are drawn from the first ,then second and then third box as mentioned in the problem

black MaMbA: 2014-06-02 17:51:48

please take a look at my code,i think some syntax err or something is causing TLE

Ford Tiburon: 2014-06-02 16:44:18

Can the chits drawn be in any order?

Last edit: 2014-06-02 16:55:02

Added by:Sarvesh Mahajan
Date:2014-06-01
Time limit:1s-2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64