The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS activation code arrives.

A young hacker Vasya disassembled the program and found the algorithm that transforms the shown number into the activation code. Note: it is clear that Vasya is a law-abiding hacker, and made it for a noble purpose — to show the developer the imperfection of their protection.

The found algorithm looks the following way. At first the digits of the number are shuffled in the following order <first digit><third digit><fifth digit><fourth digit><second digit>. For example the shuffle of 12345 should lead to 13542. On the second stage the number is raised to the fifth power. The result of the shuffle and exponentiation of the number 12345 is 455 422 043 125 550 171 232. The answer is the 5 last digits of this result. For the number 12345 the answer should be 71232.

Vasya is going to write a keygen program implementing this algorithm. Can you do the same?


-----Input-----

The only line of the input contains a positive integer five digit number for which the activation code should be found.


-----Output-----

Output exactly 5 digits without spaces between them — the found activation code of the program.


-----Examples-----
Input
12345

Output
71232

Difficulty: interview

Starter code:

Solutions:
s = input()

x = int(s[0] + s[2] + s[4] + s[3] + s[1])
print(str(x**5)[-5:])

import sys
def fact(n):
	ret = 1
	for x in range(1, n + 1):
		ret = ret * x
	return ret

def C(n, k):
	return fact(n) // (fact(k) * (fact(n - k)))

def get(n, pos):
	while (pos > 0):
		n //= 10
		pos -= 1
	return n % 10
n = int(input())
k = get(n, 4)
k = k * 10 + get(n, 2)
k = k * 10 + get(n, 0)
k = k * 10 + get(n, 1)
k = k * 10 + get(n, 3)
k = k ** 5
q = (k % 100000)
a = []
for x in range(5):
	a.append(q % 10)
	q //= 10
for x in reversed(a):
	print(x, end="")


n = input()
n = int(n[0] + n[2] + n[4] + n[3] + n[1])
print(str((n ** 5) % 100000).zfill(5))


s = input()
n = int(s[0] + s[2] + s[4] + s[3] + s[1])
print(str(n ** 5)[-5:])

n = input()
n = n[0] + n[2] + n[4] + n[3] + n[1]

n = str(int(n) ** 5 % 100000)
print ('0' * (5 - len(n)) + n)

a, b, c, d, e = list(map(int, input()))
n = a*10000 + c*1000 + e*100 + d*10 + b
print(str(n**5)[-5:])



s = input()
s = s[0] + s[2] + s[4] + s[3] + s[1]
print(str(pow(int(s), 5, 100000)).rjust(5, '0'))

import sys


def fact(k):
    return k ** 2 * (k - 1) ** 2 * (k - 2) ** 2 * (k - 3) ** 2 * (k - 4) ** 2


s = input()

s1 = s[0] + s[2] + s[4] + s[3] + s[1]

n = int(s1)

k = n ** 5

s = str(k % 100000)

while len(s) < 5:
    s = '0' + s

print(s)


from functools import reduce
from math import factorial
n = input()
m = int(''.join((n[0], n[2], n[4], n[3], n[1])))
print('{:0>5d}'.format((m**5)%100000))


n2 = input()
n = ""
n += n2[0]
n += n2[2]
n += n2[4]
n += n2[3]
n += n2[1]
n = int(n)
n = str(n**5)
print(n[len(n)-5:])


n=input()

n=n[0]+n[2]+n[4]+n[3]+n[1]

x=str(int(n)**5)[-5:]

print(x)


def __starting_point():

    s = [c for c in input()]
    ss =s[0]+s[2]+s[4]+s[3]+s[1]
    num = int(ss)

    print(str(num**5)[-5:])
__starting_point()

def main():
    x1, x2, x3, x4, x5 = input()
    x1, x2, x3, x4, x5 = int(x1), int(x3), int(x5), int(x4), int(x2)
    z = x5 + 10 * (x4 + 10 * (x3 + 10 * (x2 + 10 * x1)))
    print(str(pow(z, 5, 100000)).zfill(5))

def __starting_point():
    main()
__starting_point()

import math
n = input()
arr = [int(i) for i in n]
n = int(arr[0])*10000+int(arr[2])*1000+int(arr[4])*100+int(arr[3])*10+int(arr[1])
n = (n**5) % 100000
print('%05d' % n)


st = input().strip()
st = st[0] + st[2] + st[4] + st[3] + st[1]
st = int(st)**5
st %= 100000
print(str(st).zfill(5))

a,b,c,d,e,*x=input()
s=str(pow(int(a+c+e+d+b),5,100000))
print(s.rjust(5,'0'))


n = int(input())
a1 = n // 10 ** 4
a2 = (n // 10 ** 3) % 10
a3 = (n // 10 ** 2) % 10
a4 = (n // 10) % 10
a5 = n % 10
m = str((a1 * 10**4 + a3 * 10**3 + a5 * 10 ** 2 + a4 * 10 + a2) ** 5 % 100000)
m = "0" * (5 - len(m)) + m
print(m)

s = input()
t = s[0] + s[2] + s[4] + s[3] + s[1]
print(str(int(t)**5)[-5:])


n = input()

a = n[0]
b = n[1]
c = n[2]
d = n[3]
e = n[4]

n = a+c+e+d+b
n = int(n)

ans = (n**5)%100000

if(ans<10): ans = "0000" + str(ans)
elif(ans<100): ans = "000" + str(ans)
elif(ans<1000): ans = "00" + str(ans)
elif(ans<10000): ans = "0" + str(ans)

print(ans)


n = input()
y = int(n[0] + n[2] + n[4] + n[3] + n[1])
t =(y ** 5) % 100000
print(str(t).zfill(5))

import re, sys, string, operator, functools, fractions, collections
sys.setrecursionlimit(10**7)
dX= [-1, 1, 0, 0,-1, 1,-1, 1]
dY= [ 0, 0,-1, 1, 1,-1,-1, 1]
RI=lambda x=' ': list(map(int,input().split(x)))
RS=lambda x=' ': input().rstrip().split(x)
mod=int(1e9+7)
eps=1e-6
#################################################
n=RS()[0]
s=int(n[0]+n[2]+n[4]+n[3]+n[1])
print("%05d"%(pow(s,5,100000)))


n = [letter for letter in input()]
new = int(n[0] + n[2] + n[4] + n[3] + n[1]) ** 5 % 100000
k = len(str(new))
print('0' * (5 - k), new, sep = '')


import sys

n = sys.stdin.readline()
m = n[0] + n[2] + n[4] + n[3] + n[1]
m = int(m)
m = m ** 5
m = str(m % 100000)

while len(m) < 5:
    m = '0' + m

print(m)

n = int(input())
m = (n // 10000) * 10000 + ((n // 100) % 10) * 1000 + (n % 10) * 100 + ((n // 10) % 10) * 10 + ((n // 1000) % 10)
k = m ** 5
print(format((k % 100000), '05d'))

n = input()
n = int(n[0] + n[2] + n[4] + n[3] + n[1])
ans = (n ** 5) % (10 ** 5)
ans = (5 - len(str(ans))) * '0' + str(ans)
print(ans)