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
Anish kumar dey: 2015-06-06 14:28:08

nice problem only math

Dushyant Singh: 2015-05-27 02:39:18

@ [Mayank Pratap] :- For that you have to typecast your numerator and denominator because maximum value of n is 10^5. So maximimum value of numerator and denominator will be 3*10^10 and 6*10^15. And since range of long is between -2*10^9 to 2*10^9 therefore we need long long. Hope this helps.

Last edit: 2015-05-27 02:41:18
[Mayank Pratap]: 2015-05-26 20:10:28

@Sarvesh .... Sir, Please tell why i had to take input in long long int to get AC ??.... I was getting WA when i used int .... size of n <=100000.....Just i wanted to know .... Thanks in advance...

Vaporeon: 2015-05-21 23:01:03

AC! :D AP with negative common difference also possible! :P

Anubhav Balodhi : 2014-10-21 13:28:35

got wrong pattern, then got it right ,but still wa!
what's the answer for 10^5?
[edit] AC, got wrong pattern :-P

Last edit: 2014-10-24 09:10:23
Rahul Jain: 2014-09-28 21:26:04

my O(log n) solution is giving TLE,
admin..please check submission id 12431849

thewatch: 2014-09-23 21:49:42

Last edit: 2014-09-23 22:29:16
albertg: 2014-08-31 08:54:55

good problem :)

vaibhav lalka: 2014-08-29 20:15:48

simple math!

tushar aggarwal: 2014-08-27 08:19:39

1 1 1 is an AP ryt ? thts y for n=1 ans is 1/3
am i correct and admin please check submission id 12243634

Last edit: 2014-08-27 09:26:17

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