Last eight digits of a power tower

No attempts yetTime limit1sMemory limit256 MB

Problem

For positive integers aa and bb, write the bb-th power tower of aa as aba \uparrow\uparrow b. It is defined by

a1=aa \uparrow\uparrow 1 = a

a(k+1)=a(ak)a \uparrow\uparrow (k + 1) = a^{(a \uparrow\uparrow k)}

For example, 32=33=273 \uparrow\uparrow 2 = 3^3 = 27 and 33=327=76255974849873 \uparrow\uparrow 3 = 3^{27} = 7625597484987.

Find the last 8 digits of aba \uparrow\uparrow b.

Input

The first line contains two positive integers aa and bb, separated by a space. (1a,b200001 \le a, b \le 20000)

Output

Print the last 8 digits of aba \uparrow\uparrow b on one line.

If aba \uparrow\uparrow b has 9 or more digits, print those last 8 digits exactly, including any zeros at the front of them. If aba \uparrow\uparrow b has 8 or fewer digits, print the whole value without adding leading zeros.