Abhi Ram analyses london stock exchange and invests in a software company C-.gate . He wants to sell his shares after 5 weeks.

Given the investment  m, increase or decrease of share prices of 5 weeks(+/- pi) , help him to calculate his net profit or loss percentage(n%) of his investment to establish his own company KMC.

-----Input:-----

- The first line contains an integer T which denotes the number of test cases.
- Each test case comprises of two lines: the first line contains the integer m which denotes the amount invested.

The second line consists of five space separated integers(p1, p2, p3, p4, p5) each preceeded by + (increase) or - (decrease) which give the percentage of change in share prices over 5 weeks.
.

-----Output:-----
The output contains a single number n which gives the percentage of profit or loss preceeded by + (profit) or - (loss).

-----Constraints:-----
- 1 ≤ T ≤ 100
- 1 ≤ m ≤ 105
- -100 ≤ pi ≤ 100

-----Example:-----
Input:
2
10000
+5 -3 -2 +10 +15
6256250
-24 +22 +4 -16 +20

Output:
+26.2634
-2.79977

Difficulty: interview

Starter code:

Solutions:
for i in range(int(input())):
	 n = int(input())
	 P = list(map(float, input().split()))
	 pr = 1
	 for p in P:
		  a = 100+p
		  pr = (pr*a)/100
	 pr = (pr-1)*100
	 x = 6-len(str(int(abs(pr))))
   	 if (x==1):
   	 	 if (pr==0):
   	 	 	print(0)
		 elif (pr>0):
		 	print("+"+str("%.1f" % round(pr,x)))
		 else:
		 	print(str("%.1f" % round(pr,x)))
	 elif (x==2):
   	 	 if (pr==0):
   	 	 	print(0)
		 elif (pr>0):
		 	print("+"+str("%.2f" % round(pr,x)))
		 else:
		 	print(str("%.2f" % round(pr,x)))
	 elif (x==3):
   	 	 if (pr==0):
   	 	 	print(0)
		 elif (pr>0):
		 	print("+"+str("%.3f" % round(pr,x)))
		 else:
		 	print(str("%.3f" % round(pr,x)))
	 elif (x==4):
   	 	 if (pr==0):
   	 	 	print(0)
		 elif (pr>0):
		 	print("+"+str("%.4f" % round(pr,x)))
		 else:
		 	print(str("%.4f" % round(pr,x)))
	 elif (x==5):
   	 	 if (pr==0):
   	 	 	print(0)
		 elif (pr>0):
		 	print("+"+str("%.5f" % round(pr,x)))
		 else:
		 	print(str("%.5f" % round(pr,x)))
	 elif (x==6):
   	 	 if (pr==0):
   	 	 	print(0)
		 elif (pr>0):
		 	print("+"+str("%.6f" % round(pr,x)))
		 else:
		 	print(str("%.6f" % round(pr,x)))