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