Find unit digit in a Product
Submissions: 697   Accuracy:

22.41%

  Difficulty: Easy   Marks: 2

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 **

Author: ShivamKD


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.



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


to report an issue on this page.