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