import java.util.*;
import java.lang.Math.*;
class Task3
{
public static void main
(String[] args
) {
int N;
Scanner in
= new Scanner
(System.
in); N = in.nextInt();
for (int i = 1; true; i++) // i - номер страницы, будем отнимать от N количество цифр в i
{
if (N == 0) // если лишних цифр у нас не осталось
{
break;
}
else if (N < 0) // иначе выводим "0"
{
break;
}
}
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLk1hdGguKjsKCmNsYXNzIFRhc2szCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKQoJewoJaW50IE47CglTY2FubmVyIGluID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCU4gPSBpbi5uZXh0SW50KCk7Cglmb3IgKGludCBpID0gMTsgdHJ1ZTsgaSsrKSAvLyBpIC0g0L3QvtC80LXRgCDRgdGC0YDQsNC90LjRhtGLLCDQsdGD0LTQtdC8INC+0YLQvdC40LzQsNGC0Ywg0L7RgiBOINC60L7Qu9C40YfQtdGB0YLQstC+INGG0LjRhNGAINCyIGkKCXsKCQlOIC09IE1hdGguZmxvb3IoTWF0aC5sb2cxMChpKSArIDEpOwoJCWlmIChOID09IDApIC8vINC10YHQu9C4INC70LjRiNC90LjRhSDRhtC40YTRgCDRgyDQvdCw0YEg0L3QtSDQvtGB0YLQsNC70L7RgdGMCgkJewoJCQlTeXN0ZW0ub3V0LnByaW50bG4oaSk7CgkJCWJyZWFrOwoJCX0KCQllbHNlIGlmIChOIDwgMCkgLy8g0LjQvdCw0YfQtSDQstGL0LLQvtC00LjQvCAiMCIKCQl7CgkJCVN5c3RlbS5vdXQucHJpbnRsbigwKTsKCQkJYnJlYWs7CgkJfQoJfQoJfQp9