Finding the exponent of any number can be very troublesome as it grows exponentially J. 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.



The input file contains less than 100000 lines. Each line contains two integers m and n (Less than 10^101). Input is terminated by a line containing two zeroes. This line should not be processed.



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                                 Output for Sample Input

2 2

2 5
0 0




Problemsetter: Shahriar Manzoor