l, i = input().split(), int(input()) - 1
print(l[i] if i < len(l) else l[-1])