lst = input().split()
N = int(input())
K = int(len(lst))
if K < N:
    print(lst[K-1])
else:
    N-=1
    print(lst[N])