LSTDGT - Last Digit of Power

no tags 

Given two numbers a and b. Find the last digit of a^b. (a to the power b)

Input

There will be t (1<=t<=10) testcases. In each case there will be two number a (1<=a<=10^100000) and b (1<=b<=10^100000) separated by a space. 

Output

Print the last digit of a^b in a single line. 

 

Sample Input:

2
3 10
6 2

2

3 10

6 2

 

Sample Output:

9

6


hide comments
ssunitk: 2017-06-01 21:28:27

well quite easy one...

Francky: 2017-06-01 19:39:55

To be moved to tutorial very soon !

[Lakshman]: 2017-06-01 16:46:02

@Jamil Siam: Changing time limit is not an good idea after you publish the Problem. We have all ready many problem slimier to this.

Jamil Siam: 2017-06-01 16:32:08

@all: TL has been updated. Please try again.

Last edit: 2017-06-01 16:33:46
[Lakshman]: 2017-06-01 09:19:29

Please move this to tutorials ASAP.

yash_18: 2017-05-31 16:03:51

Last edit: 2017-05-31 21:29:54

Added by:Jamil Siam
Date:2017-05-31
Time limit:0.100s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All