The invariable units digit
##### Submissions: 738   Accuracy: 25.23%   Difficulty: Easy   Marks: 2

You are given two integers N and P. N represents an integer number, and P represents the power to which N will be raised. You need the determine, if the units digit of the NP will be same as the units digit of N.

Input:
The first line of the input contains a single integer T, denoting the number of test cases. Then T test case follows. Each test case contains 2 lines,The number N and the power P.

Output:
For each testcase, print 0 if the units digit changes, else print 1.

Constraints:
1 <= T <= 100
1 <= N <= 1030
1 <= P <= 100

Example:
Input:
3
2
1
3
5
4
2

Output:
1
1
0

Explanation:
For testcase 1: 21=2 so units digit remains same. Therefore, we print 1
For testcase 3: 42=16 so units digit changes from 4 to 6. Therefore, we print 0

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

Contributor: Ankit Sharma
Author: Soul_xhacker

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.