import java.util.*;
import java.lang.*;
import java.io.*;
class Main {
public static void main
(String[] args
) { Scanner scan
= new Scanner
(System.
in); int n = scan.nextInt();
int m = 1;
while (true) {
if (m < 10) { //1 digit
n -= 1;
} else if (m < 100) { //2 digits
n -= 2;
} else if (m < 1000) { //3 digits
n -= 3;
} else { //4 digits
n -= 4;
}
if (n < 0) {
m = 0;
}
if (n <= 0) {
break;
}
m++;
}
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBNYWluIHsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB7CgkJU2Nhbm5lciBzY2FuID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCQlpbnQgbiA9IHNjYW4ubmV4dEludCgpOwoJCWludCBtID0gMTsKCQl3aGlsZSAodHJ1ZSkgewoJCQlpZiAobSA8IDEwKSB7CS8vMSBkaWdpdAoJCQkJbiAtPSAxOwoJCQl9IGVsc2UgaWYgKG0gPCAxMDApIHsJLy8yIGRpZ2l0cwoJCQkJbiAtPSAyOwoJCQl9IGVsc2UgaWYgKG0gPCAxMDAwKSB7CS8vMyBkaWdpdHMKCQkJCW4gLT0gMzsKCQkJfSBlbHNlIHsJLy80IGRpZ2l0cwoJCQkJbiAtPSA0OwoJCQl9CgkJCWlmIChuIDwgMCkgewoJCQkJbSA9IDA7CgkJCX0KCQkJaWYgKG4gPD0gMCkgewoJCQkJYnJlYWs7CgkJCX0KCQkJbSsrOwoJCX0KCQlTeXN0ZW0ub3V0LnByaW50KG0pOwoJfQp9