BETA

Difficulty Level:

Easy

Total Submissions: 968 Accuracy:

12.71%

First Digit
     

Given an array Arr[] of N numbers. You need to write a program to find the first digit of product of these N integers.

Input:
First line of input contains an integer T which denotes the number of test cases. Then T test cases follows. First line of each test case contains a single integer N which denotes the number of elements in the array. Second line of each test case contains N space separated integers which denotes the elements of the array.
Output:
For each test case, in a new line print the first digit of product of these N integers present in the array.

Constraints:
1<=T<=100
1<=N<=104
1<=Arr[i]<=105

Example:
Input:

2
4
5 8 3 7
3
6 7 9
Output:
8
3

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Harsh Agarwal

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.