data = list(input().split())
idx = int(input()) - 1
print(data[idx] if idx < len(data) else data[len(data) - 1])