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: MEDIUM

Solutions:
n = int(input())
a = n // 10000
b = n // 1000 % 10
c = n // 100 % 10
d = n // 10 % 10
e = n % 10
ans = a * 10000 + c * 1000 + e * 100 + d * 10 + b
ans1 = ans ** 5 % 100000
if ans1 < 10000:
	print(0, end='')
if ans1 < 1000:
	print(0, end='')
if ans1 < 100:
	print(0, end='')
if ans1 < 10:
	print(0, end='')
print(ans1)


import math
num = []
s = input()
for i in s:
	num.append(int(i))
number = 0
n = len(num)
num2 = []
num2.append(num[0])
num2.append(num[2])
num2.append(num[4])
num2.append(num[3])
num2.append(num[1])
for i in range(n):
	number = number * 10 + num2[i]
number = number ** 5
answer = number % 100000
l = [int(x) for x in str(answer)]
l.reverse()
while len(l) < 5:
	l.append(0)
l.reverse()
strans = ''.join((str(e) for e in l))
print(strans)


ss = input()
nn = ss[0] + ss[2] + ss[4] + ss[3] + ss[1]
n = int(nn)
s = str(pow(n, 5))
l = len(s)
print(s[l - 5:])


n = int(input())
(l, x) = ([], n)
for i in range(5):
	l.append(x % 10)
	x //= 10
l = l[::-1]
(l[0], l[1], l[2], l[3], l[4]) = (l[0], l[2], l[4], l[3], l[1])
n = 0
for i in l:
	n *= 10
	n += i
s = str(n ** 5 % 100000)
while len(s) < 5:
	s = '0' + s
print(s)


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))
main()


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


m = [int(i) for i in input()]
(m[1], m[2]) = (m[2], m[1])
(m[2], m[4]) = (m[4], m[2])
n = m[0] * 10000 + m[1] * 1000 + m[2] * 100 + m[3] * 10 + m[4]
a = pow(n, 5, 100000)
print(str(a).zfill(5))


def f(x):
	a = x[0] + x[2] + x[4] + x[3] + x[1]
	a = str(int(a) ** 5)
	return a[-5:]
print(f(input()))


n = input()
print(str(int(''.join([n[0], n[2], n[4], n[3], n[1]])) ** 5)[-5:])


import time
a = list(input())
start = time.time()
b = int(a[0]) * 10000 + int(a[2]) * 1000 + int(a[4]) * 100 + int(a[3]) * 10 + int(a[1])
c = str(b ** 5)
for i in c[-5:]:
	print(i, end='')
print()
finish = time.time()


s = input()
print('%05d' % (int(s[0] + s[2] + s[4] + s[3] + s[1]) ** 5 % 100000))


n = str(input())
g = [0] * 5
a = list()
g[0] = n[0]
g[1] = n[2]
g[2] = n[4]
g[3] = n[3]
g[4] = n[1]
f = ''.join(map(str, g))
j = int(f) ** 5
f = str(j)
a.append(f[-5])
a.append(f[-4])
a.append(f[-3])
a.append(f[-2])
a.append(f[-1])
print(''.join(map(str, a)))


s = input()
p = int(s[0] + s[2] + s[4] + s[3] + s[1])
p = str(p ** 5 % 100000)
print('0' * (5 - len(p)) + p)


from math import factorial as fac

def solve():
	s = input()
	a = ''
	a = s[0] + s[2] + s[4] + s[3] + s[1]
	a = int(a)
	a = a ** 5
	a = str(a % 10 ** 5)
	ans = (5 - len(a)) * '0' + a
	print(ans)
solve()


n = input()
s = ['', '', '', '', '']
s[0] = n[0]
s[1] = n[2]
s[2] = n[4]
s[3] = n[3]
s[4] = n[1]
s = int(''.join(s))
s = str(s ** 5 % 100000)
l = len(s)
if l == 1:
	print('0000', end='')
if l == 2:
	print('000', end='')
if l == 3:
	print('00', end='')
if l == 4:
	print('0', end='')
print(s)


x = input()
s = int(''.join([x[0], x[2], x[4], x[3], x[1]]))
print(str(s ** 5)[-5:])


import math
s = input()
new_s = s[0] + s[2] + s[4] + s[3] + s[1]
answer = str(int(new_s) ** 5 % 100000)
while len(answer) < 5:
	answer = '0' + answer
print(answer)


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


def parse(number):
	temp = number
	digit = 0
	while temp > 0:
		temp /= 10
		digit += 1
	for i in range(5 - digit - 1):
		print('0', end='')
	print(number)
s = input()
n = [0] * len(s)
n[0] = ord(s[0]) - ord('0')
n[1] = ord(s[2]) - ord('0')
n[2] = ord(s[4]) - ord('0')
n[3] = ord(s[3]) - ord('0')
n[4] = ord(s[1]) - ord('0')
number = 0
for i in range(5):
	number = number * 10 + n[i]
number = number ** 5
number = number % 100000
parse(number)


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


N = input()
O = int(N[0] + N[2] + N[4] + N[3] + N[1]) ** 5
P = str(O)
print(P[-5:])


import sys
import math
Number = int(input())
arr = []
for i in range(5):
	arr.append(1)
arr[0] = int(Number / 10000 % 10)
arr[1] = int(Number / 1000 % 10)
arr[2] = int(Number / 100 % 10)
arr[3] = int(Number / 10 % 10)
arr[4] = Number % 10
NewNumber = int(arr[0] * 10000 + arr[2] * 1000 + arr[4] * 100 + arr[3] * 10 + arr[1])
NewNumber = NewNumber * NewNumber * NewNumber * NewNumber * NewNumber
arr[4] = NewNumber % 10
arr[3] = int(NewNumber % 100 / 10)
arr[2] = int(NewNumber % 1000 / 100)
arr[1] = int(NewNumber % 10000 / 1000)
arr[0] = int(NewNumber % 100000 / 10000)
Result = str(arr[0])
Result += str(arr[1])
Result += str(arr[2])
Result += str(arr[3])
Result += str(arr[4])
print(Result)


n = eval(input())
fif = n % 10
n = n // 10
four = n % 10
n = n // 10
thir = n % 10
n = n // 10
two = n % 10
n = n // 10
fir = n
ans = str(fir) + str(thir) + str(fif) + str(four) + str(two)
x = int(ans)
ans = str(x ** 5)
print(ans[len(ans) - 5:])


n = int(input())
m = n // 10000 * 10000 + n // 100 % 10 * 1000 + n % 10 * 100 + n % 100 // 10 * 10 + n // 1000 % 10
m = m ** 5
first = m // 10000 % 10
second = m // 1000 % 10
third = m // 100 % 10
fourth = m // 10 % 10
fifth = m % 10
print(str(first) + str(second) + str(third) + str(fourth) + str(fifth))


num = input()
digits = [int(z) for z in list(num)]
stg1 = [digits[0], digits[2], digits[4], digits[3], digits[1]]
stg2 = str(int(''.join([str(w) for w in stg1])) ** 5)
print(stg2[-5:])


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


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 = int(input())
b = int(a // 10000 * 10000 + a // 100 % 10 * 1000 + a % 10 * 100 + a // 10 % 10 * 10 + a // 1000 % 10)
c = int(b ** 5 % 100000)
if c == 0:
	print('00000')
else:
	print(c)


n = input()
n = n[0] + n[2] + n[4] + n[3] + n[1]
n = int(n)
n = int(n ** 5)
n %= 100000
n = str(n)
l = len(n)
st = ''
for i in range(5 - l):
	st += '0'
n = st + n
print(n)


n = int(input())
s = n // 10000 * 10000 + n // 100 % 10 * 1000 + n % 10 * 100 + n // 10 % 10 * 10 + n // 1000 % 10
p = s ** 5 % 100000
print(p // 10000, p // 1000 % 10, p // 100 % 10, p // 10 % 10, p % 10, sep='')


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


n = int(input())
a = n // 10000
b = n // 1000 % 10
c = n // 100 % 10
d = n // 10 % 10
e = n % 10
n = 10000 * a + c * 1000 + e * 100 + d * 10 + b
n = n ** 5
print('%05d' % (n % 100000))


s = input()
copy = ''
copy += s[0]
copy += s[2]
copy += s[4]
copy += s[3]
copy += s[1]
num = int(copy)
num = num ** 5
nume = str(num)
ans = ''
ans += nume[-5]
ans += nume[-4]
ans += nume[-3]
ans += nume[-2]
ans += nume[-1]
print(ans)


S = input()
A = S[0] + S[2] + S[4] + S[3] + S[1]
N = int(A)
N = N ** 5 % 10 ** 5
S = str(N)
S = '00000' + S
print(S[-5:])


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


n = input()
t = [int(a) for a in n]
p = [0, 2, 4, 3, 1]
t1 = [-1] * 5
for i in range(5):
	t1[i] = t[p[i]]
n = int(''.join(map(str, t1)))
n = pow(n, 5, 10 ** 5)
n = str(n)
n = '0' * (5 - len(n)) + n
print(n)


a = input()
a = list(a)
(a[1], a[2], a[3], a[4]) = (a[2], a[4], a[3], a[1])
a = int(''.join(a))
print(str(a ** 5)[-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(1000000000.0 + 7)
eps = 1e-06
n = RS()[0]
s = int(n[0] + n[2] + n[4] + n[3] + n[1])
print('%05d' % pow(s, 5, 100000))


x = str(input())
vec = []
for i in x:
	vec.append(i)
a = str(vec[0] + vec[2] + vec[4] + vec[3] + vec[1])
a = int(a)
b = a ** 5
b = str(b)
w = b[-5:]
print(w)


num = input()
arr = list(num)
n = int(arr[0] + arr[2] + arr[4] + arr[3] + arr[1])
res = str(n ** 5 % 100000)
for i in range(0, 5 - len(res)):
	res = '0' + res
print(res)


def main():
	(a, b, c, d, e) = input()
	print('{:0>5d}'.format(pow(int(''.join((a, c, e, d, b))), 5, 100000)))
main()


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


ch = str(input())
(a, b, c, d, e) = (int(ch[0]), int(ch[1]), int(ch[2]), int(ch[3]), int(ch[4]))
m = b + 10 * (d + 10 * (e + 10 * (c + 10 * a)))
r = str(m ** 5 % 100000)
print('0' * (5 - len(r)) + r)


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


n = str(int(input()))
a = int(n[0] + n[2] + n[4] + n[3] + n[1])
res = str(a ** 5 % 100000)
while len(res) < 5:
	res = '0' + res
print(res)


n = list(input())
t = [n[0], n[2], n[4], n[3], n[1]]
s = ''
for i in range(5):
	s += str(t[i])
s = int(s) ** 5
s = str(s)
for i in range(len(s) - 5, len(s)):
	print(s[i], end='')


n = int(input())
l = []
while n > 0:
	l.append(n % 10)
	n //= 10
n += l[3] + 10 * l[1] + 100 * l[0] + 1000 * l[2] + 10000 * l[4]
n = pow(n, 5)
m = []
while n > 0:
	m.append(n % 10)
	n //= 10
i = 4
while i >= 0:
	print(m[i], end='')
	i -= 1


n = input()
s = int(''.join((n[i] for i in [0, 2, 4, 3, 1])))
s = str(s ** 5)
print(s[-5:])


num = input()
new_num = int(f'{num[0]}{num[2]}{num[4]}{num[3]}{num[1]}')
s = str(new_num ** 5)
print(s[-5:])


from decimal import *
x = list(input())
n = len(x)
for i in range(1, n - 1):
	aux = x[i]
	x[i] = x[i + 1]
	x[i + 1] = aux
aux = x[2]
x[2] = x[3]
x[3] = aux
x = ''.join(x)
x = int(x)
x = x ** 5
x = str(x)
n = len(x)
print(x[n - 5:n])


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:])


x = str(input())
vec1 = []
vec2 = [0, 0, 0, 0, 0]
for i in x:
	vec1.append(i)
y = str(vec1[0] + vec1[2] + vec1[4] + vec1[3] + vec1[1])
y = int(y)
w = y ** 5
w = str(w)
r = w[-5:]
print(r)


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 = int(input())
t = 0
t += n // 10000
t *= 10
t += n // 100 % 10
t *= 10
t += n % 10
t *= 10
t += n // 10 % 10
t *= 10
t += n // 1000 % 10
t = t ** 5
ans = str(t)
ans = ans[len(ans) - 5:]
print(ans)


s = input('')
num = s[0] + s[2] + s[4] + s[3] + s[1]
num = int(num)
num = str(num ** 5)
sol = num[len(num) - 5:]
if sol.count('0') == 5:
	print('00000')
else:
	print(int(sol))


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


n = input()
n = int(n[0] + n[2] + n[4] + n[3] + n[1])
sol = n * n % 100000
sol = sol * sol % 100000
sol = sol * n % 100000
print('{0:05d}'.format(sol))


n = int(input())
dig1 = int(n / 10000)
dig2 = int(n / 1000 % 10)
dig3 = int(n / 100 % 10)
dig4 = int(n / 10 % 10)
dig5 = int(n % 10)
n1 = dig1 * 10000 + dig3 * 1000 + dig5 * 100 + dig4 * 10 + dig2
n1 = n1 * n1 * n1 * n1 * n1
n1 = str(n1 % 100000)
while len(n1) != 5:
	n1 = '0' + n1
print(n1)


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


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


n = int(input())
x = list(str(n))
q = []
q.append(x[0])
q.append(x[2])
q.append(x[4])
q.append(x[3])
q.append(x[1])
U = int(''.join(q)) ** 5
C = list(str(U))
print(''.join(C[len(C) - 5:len(C)]))


ss = input()
sss = int(ss[0] + ss[2] + ss[4] + ss[3] + ss[1]) ** 5 % 100000
print('0' * (5 - len(str(sss))), end='')
print(sss)


import sys
import math

def main():
	n = input()
	n1 = int(''.join([n[0], n[2], n[4], n[3], n[1]]))
	n11 = n1
	for i in range(4):
		n11 *= n1
		n11 %= 10 ** 5
	n11 = str(n11)
	while len(n11) < 5:
		n11 = '0' + n11
	print(n11)
main()


x = input()
print('%05d' % pow(10000 * int(x[0]) + 1000 * int(x[2]) + 100 * int(x[4]) + 10 * int(x[3]) + int(x[1]), 5, 100000))


n = int(input())
a = n // 10000
b = n % 10000 // 1000
c = n // 100 % 10
d = n % 100 // 10
e = n % 10
n = a * 10000 + c * 1000 + e * 100 + d * 10 + b
res = n ** 5 % 100000
for i in range(5 - len(str(res))):
	print(0, end='')
print(res)


def main():
	s = list(input())
	t = s[1]
	s[1] = chr(ord(s[2]))
	s[2] = chr(ord(s[4]))
	s[4] = t
	a = int(0)
	for i in range(5):
		a = a * 10 + int(s[i])
	ans = int(1)
	for i in range(5):
		ans = ans * a % 100000
	print('%05d' % ans)
main()


from sys import stdin
txt = stdin.readline()
p = txt[0] + txt[2] + txt[4] + txt[3] + txt[1]
m = n = int(p)
n = n * n % 100000
n = n * n % 100000
n = n * m % 100000
print('{0:0=5d}'.format(n))


x = int(input())

def split5(num):
	return [num // 10000, num // 1000 % 10, num // 100 % 10, num // 10 % 10, num % 10]
(x1, x2, x3, x4, x5) = split5(x)
p = x1 * 10000 + x3 * 1000 + x5 * 100 + x4 * 10 + x2
p_2 = p ** 2
p_2p = p_2 % 100000
result = p_2p * (p_2p * (p % 100000) % 100000) % 100000
(r1, r2, r3, r4, r5) = split5(result)
print(r1, r2, r3, r4, r5, sep='')


a = list(map(str, input()))
number = int(a[0] + a[2] + a[4] + a[3] + a[1]) ** 5 % 100000
a = str(number)
k = len(a)
ans = ''
if number < 100000:
	while k != 5:
		ans += '0'
		k += 1
	ans += a
	print(ans)
else:
	print(a)


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


n = int(input())
print(str(pow(n // 10000 * 10000 + n // 100 % 10 * 1000 + n % 10 * 100 + n // 10 % 10 * 10 + n // 1000 % 10, 5, 100000)).zfill(5))


n = input()
print('%05d' % (pow(int(''.join([n[0], n[2], n[4], n[3], n[1]])), 5) % 100000))


A = input()
B = A[0] + A[2] + A[4] + A[3] + A[1]
C = int(B)
print('%05d' % (C ** 5 % 100000))


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'))


import math

def choose(n, r):
	return math.factorial(n) // math.factorial(n - r) // math.factorial(r)

def choose2(n, r):
	return math.factorial(n) // math.factorial(n - r)
input_numbers = [int(c) for c in input()]
shuffled = []
shuffled.append(input_numbers[0])
shuffled.append(input_numbers[2])
shuffled.append(input_numbers[4])
shuffled.append(input_numbers[3])
shuffled.append(input_numbers[1])
number = 0
for i in range(5):
	number += int(shuffled[4 - i]) * 10 ** i
power = str(number ** 5)
print(power[-5:])


s = input()
s = s[0] + s[2] + s[4] + s[3] + s[1]
d = int(s)
d = d ** 5
if s[4] == '0':
	print('00000')
else:
	print(d % 100000)


import re
n = input()
k = [n[0], n[2], n[4], n[3], n[1]]
k = ''.join(k)
k = int(k) ** 5
p = str(k)[::-1]
p = p[:5]
print(p[::-1])


conv = (10000, 1, 1000, 10, 100)
num = input()
starting = 0
index = 0
for c in num:
	starting += int(c) * conv[index]
	index += 1
starting = starting ** 5
res = ''
prev = 1
now = 10
for i in range(0, 5):
	toRem = int(starting % now / prev)
	res = str(toRem) + res
	starting -= toRem
	now *= 10
	prev *= 10
print(res)


import sys
import math

def main():
	s = list(sys.stdin.readline().strip())
	n = int(s[0] + s[2] + s[4] + s[3] + s[1])
	s = str(n ** 5)
	print(s[len(s) - 5:])
main()


sn = input()
news = sn[0] + sn[2] + sn[4] + sn[3] + sn[1]
x = int(news)
x = x ** 5
x = x % 10 ** 5
ans = str(x)
if len(ans) < 5:
	ans = (5 - len(ans)) * '0' + ans
print(ans)


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


s = input()
a = ''
t = [1, 3, 5, 4, 2]
for i in t:
	a += s[i - 1]
x = int(a)
ans = str(pow(x, 5) % 100000)
while len(ans) < 5:
	ans += '0'
print(ans)


a = int(input())
c1 = a // 10000
c2 = a // 1000 % 10
c3 = a // 100 % 10
c4 = a // 10 % 10
c5 = a // 1 % 10
b = c1 * 10000 + c3 * 1000 + c5 * 100 + c4 * 10 + c2
b = b ** 5
b = b % 100000
c1 = b // 10000
c2 = b // 1000 % 10
c3 = b // 100 % 10
c4 = b // 10 % 10
c5 = b // 1 % 10
print(c1, c2, c3, c4, c5, sep='')


n = input()
m = []
m.append(n[0])
m.append(n[2])
m.append(n[4])
m.append(n[3])
m.append(n[1])
m = ''.join(m)
m = int(m)
m = m ** 5 % 10 ** 5
m = str(m)
for i in range(5 - len(m)):
	print('0', end='')
print(m)


n = input()
n = n[0] + n[2] + n[4] + n[3] + n[1]
n = int(n)
d = str(pow(n, 5) % 100000)
print('0' * (5 - len(d)) + d)


import os, sys, pdb
import time, calendar, datetime
import math, itertools
import operator as op
from functools import reduce

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom
(a, b, c, d, e) = [int(x) for x in input()]
x = 10000 * a + 1000 * c + 100 * e + 10 * d + b
print('%05d' % (x ** 5 % 100000))


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


n = input()
z = int(n[0]) * 10000 + int(n[2]) * 1000 + int(n[4]) * 100 + int(n[3]) * 10 + int(n[1])
v = 1
for i in range(5):
	v *= z
if v % 100000 == 0:
	print('00000')
else:
	print(v % 100000)


n = int(input())
s = str(n)
s = (5 - len(s)) * '0' + s
digits = int(s[0] + s[2] + s[4] + s[3] + s[1])
final = str(pow(digits, 5, 100000))
print((5 - len(final)) * '0' + final)


n = input()
a = int(n[0])
b = int(n[1])
c = int(n[2])
d = int(n[3])
e = int(n[4])
ans = a * 10000 + c * 1000 + e * 100 + d * 10 + b
s = str(ans ** 5 % 100000)
while len(s) < 5:
	s = '0' + s
print(s)


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)


n = int(input())
n = (n // 10000 * 10000 + n % 1000 // 100 * 1000 + n % 10 * 100 + n % 100 // 10 * 10 + n % 10000 // 1000) ** 5
print('%s%s%s%s%s' % (n % 100000 // 10000, n % 10000 // 1000, n % 1000 // 100, n % 100 // 10, n % 10))


n = int(input())
n1 = n // 10000
n2 = n % 10000 // 1000
n3 = n % 1000 // 100
n4 = n % 100 // 10
n5 = n % 10
ch = 10000 * n1 + 1000 * n3 + 100 * n5 + 10 * n4 + n2
otv = ch ** 5 % 100000
so = str(otv)
while len(so) < 5:
	so = '0' + so
print(so)


s = input()
n = str(s[0]) + str(s[2]) + str(s[4]) + str(s[3]) + str(s[1])
x = str(int(n) ** 5 % 100000)
while len(x) < 5:
	x = '0' + x
print(x)


n = int(input())
q = int(n)
arr = []
while q != 0:
	(q, r) = divmod(q, 10)
	arr.insert(0, r)
nn = arr[0]
nn = nn * 10 + arr[2]
nn = nn * 10 + arr[4]
nn = nn * 10 + arr[3]
nn = nn * 10 + arr[1]
nn = pow(nn, 5)
qq = int(nn)
ar2 = []
while qq != 0:
	(qq, r) = divmod(qq, 10)
	ar2.insert(0, r)
ar3 = ar2[-5:]
print(''.join([str(ar3[i]) for i in range(0, len(ar3))]))


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


i = input()
num = int(i[0]) * 10000 + int(i[2]) * 1000 + int(i[4]) * 100 + int(i[3]) * 10 + int(i[1])
coded = num ** 5
rez = str(coded % 100000)
rez = ''.join(['0' for x in range(5 - len(rez))]) + rez
print(rez)


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


s = input()
n = int(s[0] + s[2] + s[4] + s[3] + s[1])
curr = n
for i in range(4):
	curr = curr * n % 100000
ans = str(curr)
ans = '0' * (5 - len(ans)) + ans
print(ans)


import math
n = input()
n = n[0] + n[2] + n[4] + n[3] + n[1]
n = int(n)
n = pow(n, 5, 100000)
n = str(n)
if len(n) != 5:
	ans = ''
	for i in range(5 - len(n)):
		ans += '0'
	n = ans + n
print(n)


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	s = input()
	s = s[0] + s[2] + s[4] + s[3] + s[1]
	n = int(s)
	y = n ** 5 % 10 ** 5
	print(str(y) + '0' * (len(s) - len(str(y))))
for _ in range(1):
	solve()


n = input()
n = int(n[0] + n[2] + n[4] + n[3] + n[1])
n = n * n % 100000 * (n * n % 100000) % 100000 * n % 100000
n = ''.join(reversed(list(str(n)))) + '0000'
print(n[4] + n[3] + n[2] + n[1] + n[0])


s = input()
s1 = ''
s1 += s[0]
s1 += s[2]
s1 += s[4]
s1 += s[3]
s1 += s[1]
n = int(s1)
otv = n ** 5 % 100000
s2 = str(otv)
k = 5 - len(s2)
s3 = ''
for i in range(k):
	s3 += '0'
for i in range(len(s2)):
	s3 += s2[i]
print(s3)


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 = str(input())
a = n[0]
b = n[2]
c = n[4]
d = n[3]
e = n[1]
number = a + b + c + d + e
ans = int(number) * int(number) * int(number) * int(number) * int(number)
mod = str(ans % 100000)
if ans % 100000 < 10000:
	mod = '0' + mod
if ans % 100000 < 1000:
	mod = '0' + mod
if ans % 100000 < 100:
	mod = '0' + mod
if ans % 100000 < 10:
	mod = '0' + mod
print(mod)


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


num = input()
a = []
b = []
for i in range(len(num)):
	if i % 2:
		b.append(num[i])
	else:
		a.append(num[i])
c = str(int(str(''.join(a) + ''.join(b)[::-1])) ** 5)
print(c[len(c) - 5:])


s = input().strip()
x = s[0] + s[2] + s[4] + s[3] + s[1]
x = int(x) ** 5
x %= 100000
x = str(x)
print('0' * (5 - len(x)) + str(x))


inp = input()
shuf = inp[0] + inp[2] + inp[4] + inp[3] + inp[1]
shuf = int(shuf) ** 5
print('{:0>5d}'.format(shuf % 100000))


n = list(input())
l = (n[0], n[2], n[4], n[3], n[1])
l = int(''.join(l))
ans = str(pow(l, 5))
print(ans[len(ans) - 5:])


num = list(input())
num2 = num[0] + num[2] + num[4] + num[3] + num[1]
num2 = int(num2) ** 5
num2 = str(num2)
print(num2[-5:])


a = input()
rearr = int(a[0] + a[2] + a[4] + a[3] + a[1])
answer = rearr ** 5 % 100000
print('%05d' % answer)


x = input()
y = x[0] + x[2] + x[4] + x[3] + x[1]
z = int(y)
a = str(z ** 5)
print(a[len(a) - 5:])


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


s = input()
s = s[0] + s[2] + s[4] + s[3] + s[1]
s = int(s) ** 5
print('{:05}'.format(s % 100000))


s = input()
n = int(s[0]) * 10000 + int(s[2]) * 1000 + int(s[4]) * 100 + int(s[3]) * 10 + int(s[1])
ans = str(pow(n, 5) % 100000)
for i in range(0, 5 - len(ans)):
	print('0', end='')
print(ans)


n = int(input())
lst = [0] * 5
l = 4
while n != 0:
	lst[l] = n % 10
	n = n // 10
	l = l - 1
num = 0
num = 10 * num + lst[0]
num = 10 * num + lst[2]
num = 10 * num + lst[4]
num = 10 * num + lst[3]
num = 10 * num + lst[1]
num = num ** 5
st = str(num)
n = len(st)
for i in range(n - 5, n):
	print(st[i], end='')


s = input()
r = s[0] + s[2] + s[4] + s[3] + s[1]
r = int(r) ** 5
print('{:05}'.format(r % 10 ** 5))


import sys
n = sys.stdin.readline()
n = n[0] + n[2] + n[4] + n[3] + n[1]
n = int(n)
ans = n ** 5
ans = str(ans)
print(ans[len(ans) - 5:])


def power(a, b=5):
	if b == 0:
		return 1
	return a * power(a, b - 1)

def last_five(number):
	n = number // 10000 % 10 * 10000 + number // 100 % 10 * 1000 + number % 10 * 100 + number // 10 % 10 * 10 + number // 1000 % 10
	n1 = str(power(n, 5))
	return n1[-5:len(n1)]
print(last_five(int(input())))


n = input()
n = int(n[0] + n[2] + n[4] + n[3] + n[1])
x = n ** 5 % 100000
if x == 0:
	print('00000')
else:
	print(x)


x = input()
y = x[0] + x[2] + x[4] + x[3] + x[1]
ans = int(y)
now = ans * ans * ans * ans * ans
if now % 100000 == 0:
	print('00000')
else:
	print(now % 100000)


n = input()
temp = [0 for i in range(5)]
temp[0] = n[0]
temp[1] = n[2]
temp[2] = n[4]
temp[3] = n[3]
temp[4] = n[1]
n = int(''.join(map(str, temp)))
temp = str(n ** 5 % 100000)
print('0' * (5 - len(temp)) + temp)


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


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)


n = int(input())
l = []
while n:
	l.append(n % 10)
	n = n // 10
while len(l) < 5:
	l.append(0)
n = l[4] * 10000 + l[3] + l[2] * 1000 + l[1] * 10 + l[0] * 100
x = pow(n, 5)
l2 = []
while x:
	l2.append(x % 10)
	x = x // 10
while len(l2) < 5:
	l2.append(0)
l3 = []
for i in range(5):
	l3.append(l2[i])
l3.reverse()
for i in l3:
	print(i, end='')


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


num = int(input())
x5 = num % 10
num = int((num - x5) / 10)
x4 = num % 10
num = int((num - x4) / 10)
x3 = num % 10
num = int((num - x3) / 10)
x2 = num % 10
num = int((num - x2) / 10)
x1 = num % 10
newnum = x2 + 10 * x4 + 100 * x5 + 1000 * x3 + 10000 * x1
get = newnum * newnum * newnum * newnum * newnum
answer = get % 100000
if answer >= 10000:
	print(answer)
elif answer >= 1000:
	print('0' + str(answer))
elif answer >= 100:
	print('00' + str(answer))
elif answer >= 10:
	print('000' + str(answer))
else:
	print('0000' + str(answer))


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
n = is1()
n = int(''.join([n[0], n[2], n[4], n[3], n[1]]))
res = str(n ** 5 % 100000)
if len(res) < 5:
	res = '0' * (5 - len(res)) + res
print(res)


n = input()
s = list(n)
first = int(''.join([s[0], s[2], s[4], s[3], s[1]]))
second = first ** 5
output = str(second % 100000)
n = len(output)
while n < 5:
	output = '0' + output
	n = len(output)
print(output)


n = input()
m = [n[0], n[2], n[4], n[3], n[1]]
print('{:05d}'.format(int(''.join(m)) ** 5 % 100000))


n = int(input())
a = []
while n:
	a.append(n % 10)
	n //= 10
a.reverse()
ans = 0
b = [10000, 1, 1000, 10, 100]
for i in range(5):
	ans += a[i] * b[i]
ans = ans ** 5 % 100000
s = str(ans)
s = s.zfill(5)
print(s)


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='')


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


def read():
	inputs = input().strip()
	return list(map(int, inputs.split()))
n = input()
x = n[0] + n[2] + n[4] + n[3] + n[1]
p = int(x) ** 5 % 100000
print(str(p // 10000) + str(p % 10000 // 1000) + str(p % 1000 // 100) + str(p % 100 // 10) + str(p % 10))


number = int(input())
first_digit = number // 10000
second_digit = number // 1000 % 10
third_digit = number // 100 % 10
fourth_digit = number // 10 % 10
fifth_digit = number % 10
generated_number = first_digit * 10000 + third_digit * 1000 + fifth_digit * 100 + fourth_digit * 10 + second_digit
code = generated_number ** 5 % 100000
code_first_digit = code // 10000
code_second_digit = code // 1000 % 10
code_third_digit = code // 100 % 10
code_fourth_digit = code // 10 % 10
code_fifth_digit = code % 10
print(f'{code_first_digit}{code_second_digit}{code_third_digit}{code_fourth_digit}{code_fifth_digit}')


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))


def main():
	n = int(input())
	a = n // 10000 % 10
	b = n // 1000 % 10
	c = n // 100 % 10
	d = n // 10 % 10
	e = n // 1 % 10
	n = (a * 10000 + c * 1000 + e * 100 + d * 10 + b) ** 5 % 100000
	a = n // 10000 % 10
	b = n // 1000 % 10
	c = n // 100 % 10
	d = n // 10 % 10
	e = n // 1 % 10
	x = [a, b, c, d, e]
	for i in x:
		print(i, end='')
main()


s = list(input())
(s[1], s[2]) = (s[2], s[1])
(s[2], s[4]) = (s[4], s[2])
x = [int(l[0]) for l in s]
y = int(''.join(map(str, x)))
z = y ** 5
Q = int(z % 100000)
if Q == 0:
	print('00000')
else:
	print(Q)


a = input()
b = a[0] + a[2] + a[4] + a[3] + a[1]
b = int(b) ** 5
b = str(b)
c = 0
for i in range(len(b) - 5, len(b)):
	print(b[i], end='')


n = input()
shuffle = n[0] + n[2] + n[4] + n[3] + n[1]
intshuf = int(shuffle)
answer = str(intshuf ** 5 % 100000)
while len(answer) < 5:
	answer = '0' + answer
print(answer)


def fmt(s, ln):
	while len(s) < ln:
		s = '0' + s
	return s
s = input().strip()
sprime = [None] * 5
sprime[0] = s[0]
sprime[1] = s[2]
sprime[2] = s[4]
sprime[3] = s[3]
sprime[4] = s[1]
num = int(''.join(sprime))
print(fmt(str(num ** 5 % 10 ** 5), 5))


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


import math
a = input()
a = a[0] + a[2] + a[4] + a[3] + a[1]
a = int(a)
a **= 5
a = str(a)[::-1]
print(a[4] + a[3] + a[2] + a[1] + a[0])


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 = input()
s = int(n[0] + n[2] + n[4] + n[3] + n[1])
e = s
for _ in range(4):
	e = e * s % 100000
print('%05d' % e)


n = list(input())
new = [n[0], n[2], n[4], n[3], n[1]]
s = ''.join(new)
s = str(int(s) ** 5)
s = s[-5:]
print(s)


import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def SieveOfEratosthenes(n):
	prime = []
	primes = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if primes[p] == True:
			prime.append(p)
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	return prime

def primefactors(n):
	fac = []
	while n % 2 == 0:
		fac.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 2):
		while n % i == 0:
			fac.append(i)
			n = n // i
	if n > 1:
		fac.append(n)
	return sorted(fac)

def factors(n):
	fac = set()
	fac.add(1)
	fac.add(n)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			fac.add(i)
			fac.add(n // i)
	return list(fac)

def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x
n = int(input())
s = ''
n = str(n)
s = n[0] + n[2] + n[4] + n[3] + n[1]
s = int(s)
p = pow(s, 5)
p = str(p)
print(p[-5] + p[-4] + p[-3] + p[-2] + p[-1])


def shuffle(s):
	ans = s[0] + s[2] + s[4] + s[3] + s[1]
	return ans
s = input()
s = shuffle(s)
s = int(s)
s = s ** 5
s = str(s)
a = int(len(s)) - 5
b = int(len(s))
for i in range(a, b):
	print(s[i], sep='', end='')


n = int(input())
dig = []
dig.append(n % 10)
n //= 10
dig.append(n % 10)
n //= 10
dig.append(n % 10)
n //= 10
dig.append(n % 10)
n //= 10
dig.append(n % 10)
n = dig[4] * 10000 + dig[2] * 1000 + dig[0] * 100 + dig[1] * 10 + dig[3]
n = n ** 5 % 100000
k = n
cant = 0
while k:
	k //= 10
	cant += 1
s = '0' * (4 - cant) + str(n)
print(s)


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


s = input()
n = int(s[0] + s[2] + s[4] + s[3] + s[1])
res = n ** 5 % 10 ** 5
st = ''
n = res
if n < 10:
	st += '0'
if n < 100:
	st += '0'
if n < 1000:
	st += '0'
if n < 10000:
	st += '0'
print(st, res, sep='')


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


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


def func(num):
	num = int(num)
	num = num * num * num * num * num
	num = str(num)
	l = len(num)
	s = num[l - 5] + num[l - 4] + num[l - 3] + num[l - 2] + num[l - 1]
	print(s)
a = input()
n1 = a[0]
n2 = a[1]
n3 = a[2]
n4 = a[3]
n5 = a[4]
num = '' + n1 + n3 + n5 + n4 + n2
func(num)


num = input()
shuff_num = num[0] + num[2] + num[4] + num[3] + num[1]
power_num = int(shuff_num) ** 5
power_num = str(power_num)[-5:]
print(power_num)


n = input()
n = n[0] + n[2] + n[4] + n[3] + n[1]
ans = str(pow(int(n), 5))
lne = len(ans)
print(ans[lne - 1 - 4:])


k = input()
k = list(k)
a = str(k[0]) + str(k[2]) + str(k[4]) + str(k[3]) + str(k[1])
a = int(a) ** 5 % 10 ** 5
a = str(a)
while len(a) < 5:
	a = '0' + a
print(a)


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)


s = list(input())
c = ['' for i in range(5)]
c[0] = s[0]
c[1] = s[2]
c[2] = s[4]
c[3] = s[3]
c[4] = s[1]
n = int(''.join(c))
s = str(n ** 5 % 100000)
while len(s) < 5:
	s = '0' + s
print(s)


n = input()
m = [0, 2, 4, 3, 1]
x = ['0'] * 5
for i in range(5):
	x[i] = n[m[i]]
y = int(''.join(x))
print(str(y ** 5)[-5:])


n = int(input())
a5 = n % 10
n //= 10
a4 = n % 10
n //= 10
a3 = n % 10
n //= 10
a2 = n % 10
a1 = n // 10
k = a1 * 10000 + a3 * 1000 + a5 * 100 + a4 * 10 + a2
k = k * k * k * k * k
x5 = k % 10
k //= 10
x4 = k % 10
k //= 10
x3 = k % 10
k //= 10
x2 = k % 10
k //= 10
x1 = k % 10
print(repr(x1) + repr(x2) + repr(x3) + repr(x4) + repr(x5))


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


s = input()
c = 0
m = [0, 2, 4, 3, 1]
for i in range(5):
	c += int(s[m[i]]) * 10 ** (4 - i)
c = c ** 5
c %= 100000
d = [int(c / 10 ** (4 - i)) % 10 for i in range(5)]
print(d[0], d[1], d[2], d[3], d[4], sep='')


s = input()
n = int(s[0]) * 10000 + int(s[2]) * 1000 + int(s[4]) * 100 + int(s[3]) * 10 + int(s[1])
ans = str(n * n * n * n * n)
print(ans[len(ans) - 5:len(ans)])


from sys import stdin

def modpow(n, p, m):
	e = 1
	for i in range(p):
		e = e * n % m
	return e
num = stdin.readline().strip()
new_num = num[0] + num[2] + num[4] + num[3] + num[1]
print('{:0>5d}'.format(modpow(int(new_num), 5, 10 ** 5)))


s = input()
n = int(s[0] + s[2] + s[4] + s[3] + s[1])
a = n * n * n * n * n
a %= 100000
d = str(a)
while len(d) < 5:
	d = '0' + d
print(d)


n = int(input())
m = int(n / 10000) * 10000 + int(n / 100) % 10 * 1000 + n % 10 * 100 + int(n / 10) % 10 * 10 + int(n / 1000) % 10
ans = 1
for i in range(5):
	ans = int(ans * m % 100000)
print('{:05d}'.format(ans))


a = int(input())
c1 = int(a / 10000)
a = a % 10000
c2 = int(a / 1000)
a = a % 1000
c3 = int(a / 100)
a = a % 100
c4 = int(a / 10)
a = a % 10
c5 = a
d = c1 * 10000 + c3 * 1000 + c5 * 100 + c4 * 10 + c2
d = d * d * d * d * d % 100000
k = 0
if d < 10000:
	k = k + 1
if d < 1000:
	k = k + 1
if d < 100:
	k = k + 1
if d < 10:
	k = k + 1
i = 1
s = ''
while i <= k:
	i = i + 1
	s = s + '0'
print(s, d, sep='')


n = input()
n = int(n[0] + n[2] + n[4] + n[3] + n[1]) ** 5
s = str(n)
while len(s) < 5:
	s = '0' + s
print(s[-5:-1], end='')
print(s[-1])


n = input()
a = n[0] + n[2] + n[4] + n[3] + n[1]
b = int(a)
c = str(pow(b, 5))
print(c[-5:])


n = int(input())
n5 = n % 10
n4 = n // 10 % 10
n3 = n // 100 % 10
n2 = n // 1000 % 10
n1 = n // 10000
new = n1 * 10000 + n3 * 1000 + n5 * 100 + n4 * 10 + n2
new = new ** 5
r0 = new % 100000
r5 = r0 % 10
r4 = r0 // 10 % 10
r3 = r0 // 100 % 10
r2 = r0 // 1000 % 10
r1 = r0 // 10000
print('' + str(r1) + str(r2) + str(r3) + str(r4) + str(r5))


def main():
	num = input()
	new_num = num[0] + num[2] + num[4] + num[3] + num[1]
	num = int(new_num)
	num = num ** 5
	res = str(num)
	print(res[-5:])
main()


a = input()
a1 = int(a[0] + a[2] + a[4] + a[3] + a[1])
a1 = str(a1 ** 5)
print(a1[-5:-1], a1[len(a1) - 1], sep='')


import collections
import math
a = list(input())
b = a[0] + a[2] + a[4] + a[3] + a[1]
print(str(int(b) ** 5)[-5:])


n = input()
z = int(n[0] + n[2] + n[4] + n[3] + n[1])
z = z ** 5 % 100000
if z < 10:
	print('0000' + str(z))
elif z < 100:
	print('000' + str(z))
elif z < 1000:
	print('00' + str(z))
elif z < 10000:
	print('0' + str(z))
else:
	print(str(z))


cad = input()
cad = cad[0] + cad[2] + cad[4] + cad[3] + cad[1]
n = int(cad)
ans = pow(n, 5, 100000)
print('{:05d}'.format(ans))


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


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


s = int(input())
a = s // 10000
b = s // 1000 % 10
c = s // 100 % 10
d = s // 10 % 10
e = s % 10
ans = a * 10000 + c * 1000 + e * 100 + d * 10 + b
ans = ans ** 5
ans = ans
ss = str(ans)
print(ss[-5:])


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


import math
A = input()
B = int(A[0]) * 10000 + int(A[2]) * 1000 + int(A[4]) * 100 + int(A[3]) * 10 + int(A[1])
d = B
c = int(B * B)
c = int(c * c)
c = int(c * d)
e = str(c)
f = e[-5:]
print(f)


n = input()
t = n[0] + n[2] + n[4] + n[3] + n[1]
t = int(t)
k = t
for i in range(2):
	t = t ** 2 % 10 ** 5
m = k * t % 10 ** 5
print('0' * (5 - len(str(m))) + str(m))


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


s = input()
c = s[0] + s[2] + s[4] + s[3] + s[1]
n = int(c)
n = n ** 5
n = n % 100000
s = str(n)
z = ''
for i in range(5 - len(s)):
	z = z + '0'
z = z + s
print(z)