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