Given an array** Arr[]** of** N** numbers, you need to write a program to find the **first digit(from left side) **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 <= 10^{4}

1 <= Arr[i] <= 10^{5}

**Example:
Input:**

2

4

5 8 3 7

3

6 7 9

8

3

Author: harsh.agarwal0

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.

mantan_g | 267 |

tushki | 198 |

aksht7 | 182 |

ayush1101 | 128 |

namansharmacse17 | 110 |

ARUN_PUNDIR | 730 |

manishgupta8497 | 627 |

AMAN__JAIN | 625 |

Abhimanyu_kumar | 562 |

AJ786 | 541 |

blackshadows | 5335 |

Ibrahim Nash | 5223 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4584 |

Login to report an issue on this page.