L = [str(i) for i in input().split()]
N = int(input())
if len(L) < N:
    print(L[-1])
else:
    print(L[N - 1])