list = input().split()
indx = int(input())
last = len(list) - 1
if indx > len(list):
  print(list[last])
else:
  print(list[indx-1])