class Problem0756: def solve(this): n = int(input()) res = ''.join([str(i) for i in range(1, 61)]) print(res[n-1]) if __name__ == "__main__": problem = Problem0756() problem.solve()