Adam has N chocolates of unequal lengths.He wants that each chocolate should be of equal lengths.In order to do so,at each step,he picks two unequal length chocolates and takes their length difference 'd' and then he eats the bigger one and make it's length 'd'.He stops when all the chocolates are of equal length.Find the final length of all chocolates.
Input contains T test cases.The first line of each test case contains a single integer N, denoting the number of chocolates. The second line contains N positive integers(Ai), each separated by a single space denoting lengths of chocolates.
For each test case, output a single integer - the value of lengths of all the chocolates when they are equal (and the game terminates), in a new line.
1 ≤ T ≤ 100
1 ≤ N ≤ 1000
1 ≤ Ai ≤ 109
6 10 15
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.