s = input().split()
n = int(input())
try:
    print(s[n-1])
except:
    print(s[-1])