c=(list(map(str, input().split()))) n=int(input()) b=len(c) if b<n: print(c[b-1]) else: print (c[n-1])