Solve the Mystery.  

Input :
First line contains T - No. of Test cases.
Each Test case consists of 2 lines.
First line contains K.
Second line contains 3 space separated Integers A1 ,A2 ,A3.

Output : 
Print required answers in separate lines.

Constraints :
1 ≤ T ≤ 100
1 ≤ K ≤ 10
0 ≤ Ai ≤10  

SAMPLE INPUT
2
2
5 4 3
3
1 2 2

SAMPLE OUTPUT
144
125
from sys import stdin
tcc = raw_input()
#blank = raw_input()
for i in stdin:
	n = int(i)
	s = stdin.next()
	a,b,c = s.split()
	print (int(a)+int(b)+int(c))**(n)