Power et al.

Finding the exponent of any number can be very troublesome as it grows exponentially. But in this problem you will have to do a very simple task. Given two non-negative numbers m and n, you will have to find the last digit of mn in decimal number system. Input The input file contains less than 100000 lines. Each line contains two integers m and n (Less than 10101. Input is terminated by a line containing two zeroes. This line should not be processed. Output For each set of input you must produce one line of output which contains a single digit. This digit is the last digit of mn. Sample Input 22 25 00 Sample Output 4 2