Every year, hundreds of people come to summer camps, they learn new algorithms and solve hard problems.

This is your first year at summer camp, and you are asked to solve the following problem. All integers starting with 1 are written in one line. The prefix of these line is "123456789101112131415...". Your task is to print the *n*-th digit of this string (digits are numbered starting with 1.
The only line of the input contains a single integer *n* (1 ≤ *n* ≤ 1000) — the position of the digit you need to print.
In the first sample the digit at position 3 is '3', as both integers 1 and 2 consist on one digit.

In the second sample, the digit at position 11 is '0', it belongs to the integer 10.
3
3
11
0
12
1
13
1
29
9
30
2
1000
3
999
9
100
5
123
6
8
8
157
3
289
1
179
4
942
0
879
9
394
1
423
7
952
3
121
5
613
2
945
1
270
6
781
2
453
7
171
0
643
2
570
6
750
6
500
0
2
2
1
1
108
5
500
0
189
9
491
0
191
0
import sys
import math

#to read string
get_string = lambda: sys.stdin.readline().strip()
#to read list of integers
get_int_list = lambda: list( map(int,sys.stdin.readline().strip().split()) )
#to read non spaced string and elements are integers to list of int
get_intList_from_str = lambda: list(map(int,list(sys.stdin.readline().strip())))
#to read non spaced string and elements are character to list of character
get_charList_from_str = lambda: list(sys.stdin.readline().strip())
#get word sepetared list of character
get_char_list = lambda: sys.stdin.readline().strip().split() 
#to read integers
get_int = lambda: int(sys.stdin.readline().strip())
#to print faster
pt = lambda x: sys.stdout.write(str(x))

#--------------------------------WhiteHat010--------------------------------------#
n = get_int()
if n <= 9:
    print(n)
elif n <= 99:
    left = n-9
    residue = left%2
    increase = left//2 + residue
    num = str(9+increase)
    if residue == 1:
        print(num[0])
    else:
        print(num[1])
elif n <= 999:
    left = n-189
    residue = left%3
    increase = left//3 + residue
    num = str(99+increase)
    if residue == 1:
        print(num[0])
    elif residue == 2:
        print(num[1])
    else:
        print(num[2])
elif n <= 9999:
    left = n-2889
    residue = left%4
    increase = left//4 + residue
    num = str(999+increase)
    if residue == 1:
        print(num[0])
    elif residue == 2:
        print(num[1])
    elif residue == 3:
        print(num[2])
    else:
        print(num[3])

