D = int(input()) if D <= 9: print(D) else: remaining = D - 9 k = 2 q, rem = divmod(remaining - 1, k) number = 10 + q print(str(number)[rem])