BETA

Difficulty Level: Easy

Total Submissions: 473 Accuracy:

12.9%

First Digit of Product of Numbers
     

Given an array of ‘n’ numbers. We need to find the first digit of the product of these ‘n’ numbers.

Input:
The first line of input contains an integer T denoting the number of test cases. Each test case contains an integer n which denotes the number of elements in the array a[]. Next line contains space separated n elements in the array a[].‚Äč

Output:
Print a single digit number which is the first digit of the product of N numbers.

Constraints:
1<=T<=100
1<=n<=10000
1<=a[i]<=1000

Example:
Input:

2
2
50 42
5
1 2 3 4 5

Output:
2
1

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

Contributor: Shashwat Jain

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.