# -*- coding: utf-8 -*- d = int(input()) champ = "" for i in range(1,d): champ += str(i) champ = list(champ) if d == 1: print("1") else: print(champ[d-1])