import sys

s = list(str(input()).split())
a = int(input())
if a<=len(s):
    print(s[a-1])
else:
    print(s[-1])