a = list(map(str,input().split())) b = int(input()) if len(a) > b: print(a[b-1]) else: print(a[-1])