D = int(input()) C = [0] * 101 def keta(n): c = 1 while 10 ** c <= n: c += 1 return c start = 1 now = 1 while start <= 100: k = keta(now) memo = now for i in range(k): C[start] = now // (10 ** (k - 1 - i)) start += 1 now = now % (10 ** (k - 1 - i)) if start > 100:break now = memo + 1 print(C[D])