import java.util.*;
import java.lang.*;
import java.io.*;
class A
{
{
Scanner in
= new Scanner
(System.
in); int n, m, minus = 1;
n = in.nextInt();
m = 1;
for (int a = 1; n> 0; a *= 10) {
for (int b = a; b < a*10; b++) {
if ((n - minus) < 0) {
return;
}
if ((n - minus) == 0) {
return;
}
n-= minus;
m++;
}
minus++;
}
in.close();
return;
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CiAKY2xhc3MgQQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlTY2FubmVyIGluID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCQlpbnQgbiwgbSwgbWludXMgPSAxOwoJCW4gPSBpbi5uZXh0SW50KCk7CgkJbSA9IDE7CgkJZm9yICAoaW50IGEgPSAxOyBuPiAwOyBhICo9IDEwKSB7CgkJICBmb3IgIChpbnQgYiA9IGE7IGIgPCBhKjEwOyBiKyspIHsKCQkJaWYgKChuIC0gbWludXMpIDwgMCkgewoJCQkgIFN5c3RlbS5vdXQucHJpbnQoMCk7CgkJCSAgcmV0dXJuOwoJCQl9CgkJCWlmICgobiAtIG1pbnVzKSA9PSAwKSB7CgkJCQlTeXN0ZW0ub3V0LnByaW50KG0pOwoJCQkgIHJldHVybjsKCQkJfQoJCQluLT0gbWludXM7CgkJCW0rKzsKCQkgIH0KCQkgIG1pbnVzKys7CgkJfQoJCWluLmNsb3NlKCk7CgkJcmV0dXJuOwoJfQp9