L = list(range(1, 56)) S = ''.join(map(str, L)) print(S[int(input())-1])