Hasan and Tanveer are two naughty boys of the class. They spent most of their class time playing `Tic Tac Toe' whenever they get a chance to sit in back bench. But their teacher doesn't think that playing cross and naught is a way of making a class enjoyable. So, whenever she sees them playing she brings them to the front seat and makes them hear what she says. And you know listening to the teacher is not as enjoyable as playing `Tic Tac Toe'. So, within a couple of minutes, their eyes become dizzy and they fall into sleep resting their heads on the table. The teacher notices that and exclaims, ``You two naughty boys! Come over here.'' and she gives them some problem to solve which is lengthy and cumbersome. They try all the time not to get caught by the teacher while playing, or, for the least, not to get sleepy. But, pity for them, they hardly escapes the eagle eye of the teacher. Now, they are again caught red handed, brought to front bench, and as you know the usual case, they become sleepy. (poor Hasan and Tanveer! Couldn't the teacher be a little bit sympathetic to them?) This time the teacher is very angry and gives them a problem which is really too much for them. She asks them if she writes down the numbers from 1 to 1000 one after another what will be the 1000-th digit. You see what a tough problem for two little boys. Alam and Dalim start thinking that if they write down all the numbers like 1234567891011121314 ... ... it will take many hours for them. Moreover, the answer will possibly be incorrect because they can easily lose track of the numbers written. So, they are trying to find out a way to fool the teacher with the right answer. Can you find a way out for them?

** **

**Input**

The input will contain one or more line each containing a positive integer N (N<100000000). Total line of the input file will not exceed 11000.

** **

**Output**

For every N, you should calculate
the N-th digit of the number 123456789101112 ... ... and print it on a line
itself.

Sample Input

`3`

`9`

`10`

`11`

`10000`

`50000`

Sample Output

`3`

`9`

`1`

`0`

`7`

1

**Problem-setter: Tanveer & Tahseen,
**

** **

** **

** **

**“”Playing tic-tac-toe is
not that bad actually. It helps you **

**to understand game trees
:-)?/B>**