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