n = int(input())
s = ''.join(map(str,range(1,n+1)))#构造从1到n的所有整数构成的字符串
print(s[n-1])