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