a = input().split() n = int(input()) try: res = a[n - 1] except IndexError: print(a.pop()) else: print(res)