l=list(input().split(' ')) n = int(input()) if len(l)>=n: print(l[n-1]) else: print(l[-1])