n = input() m = int(n) b = 0 c = 1 while b < m: d = len(str(c)) b = b + d c = c + 1 else: c = c - 1 f = b - m - 1 print(str(c)[f])