Fr=input().split() W=int(input()) if W<=len(Fr): print(Fr[W-1]) else: print(Fr[-1])