~/algor $ cat problems/sonlar-darajaning-oxirgi-raqami
Last digit of a power
Easy
1000 ms
128 MB
22%
You are given a positive integer $a$ and a non-negative integer $b$. Find the last digit of $a^{b}$. (We assume $a^{0} = 1$.) For example, $7^{3} = 343$, the last digit is $3$.
Input
One line with two integers: $a$ and $b$.
Output
One digit — the last digit of $a^{b}$.
Note
$1 \le a \le 10^{18}$
$0 \le b \le 10^{18}$
Examples
Input #1
7 3
Output #1
3
Input #2
2 10
Output #2
4