List = [str(i) for i in input().split()]
N = int(input())

if len(List) < N:
    print(List[-1])
else:
    print(List[N - 1])