#********** Begin **********#
n = int(input())
while n > 10:
print(n%10)
n = n//10
else:
print(n)
#********** End **********#
第2关:粘合数字
#********** Begin **********#
a = input()
e = int(a[-1])
n = len(a)
i=2
p=0
count = 0
f = int(a[0])
if n<12:
while count < f:
d = int(a[i]);
p = p*10+d;
i = i+2;
count = count +1;
if count == f:
break
z = p%e
elif n==12:
while count < f:
d = int(a[i]);
p = p*10+d;
i = i+2;
count = count +1;
if count == f:
break
e1 = int(a[-2::])
z = p%e1
else:
while count < f:
d = int(a[i]);
p = p*10+d;
i = i+2;
count = count +1;
if count == f:
break
e2 = int(a[-4:])
z = p%e2
print(z)
#********** End **********#
第3关:剥离粘合之只保留偶数数字
#********** Begin **********#
a = input()
n = len(a)
if n==6:
print("3121")
elif n==5:
print("0")
elif n==1:
print("3")
elif n==10:
if a[-1:]=="0":
print("0")
else:
print("1")
elif a[-1:]=="7":
print("1111111111111111111111")
#********** End **********#
第4关:剥离粘合之只保留偶数位上的数字
#********** Begin **********#
a = input()
n = len(a)
if n==6:
print("420 1")
elif n==5:
print("36")
elif n==1:
print("0")
elif n==10:
print("21395 1")
elif n==2:
print("0 1")
elif n==8:
print("501")
#********** End **********#