(lambda s, i: print(s[i] if i < len(s) else s[-1]))(input().split(), int(input()) - 1)