Problem: Chris always struggle in converting angles from degree to radian or vice-verse. You being his best friend whom he trusts so much, decided to help him out. Sam has T angles you need to convert them in radian and represent them in fraction(i.e P/Q) and simplest form.
[Note]: be careful with sign convention here π=$.

Input

The first line contains a single integer(T), the number of test cases.
Then next T lines follow, each having integral value of angle(denoted by A).  

Output

You need to print the equivalent value of degree in radian.
Sam wants the answer in fractional form and the symbol pi to be denoted by '$' sign(without the quotes).

Constraints
1 ≤ T ≤ 1000
1 ≤ A ≤ 10^9

SAMPLE INPUT
5
90
180
87
720
4

SAMPLE OUTPUT
$/2
$
29$/60
0$
$/45

Solution (in PYTHON):

Solution:
from fractions import gcd
t=int(raw_input())
while(t):
	angle=int(raw_input())
	if angle>=360:
		angle=angle-360*(angle//360)
	g=gcd(angle,180)
	rad=180
	
	while(g!=1):
		angle=angle/g
			
		rad/=g
		g=gcd(angle,rad)
	
	if angle==1 and rad!=1:
		print "$"+"/"+str(rad)
	elif angle!=1 and rad==1:
		print str(angle)+"$"
	elif angle==1 and rad==1:
		print "$"
	else:
		print str(angle)+"$"+"/"+str(rad)		
		
	t-=1