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