BETA

Difficulty Level: Easy

Submissions: 282 Accuracy:

17.73%

Find unit digit in a Product
       

Given 6 numbers a,b,c,d,e,f. Find the last digit of (a^b)*(c^d)*(e^f).

Input:
The first line of the test case contains an integer T, denoting number of test cases. Following T lines contains six space separated integers a, b, c, d, e and f.

Output:
For each of the test case print the required answer in separate lines.

Constraints:
1<=T<=3.4*10^3
1<=a,b,c,d,e,f<=10^9

Example:
Input:
1
3 66 6 41 7 53
Output:
8

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

Contributor: ShivamKD

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.