#include <iostream>
#include <math.h>
using namespace std;
int main() {
int n = 3;
int i = 10;
int res = 0;
while(i < n){
res += (i - i/10)*log10(i);
i *= 10;
}
res += (n - i/10)*log10(i)+ceil(log10(n));
cout<<res;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWF0aC5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbiA9IDM7CglpbnQgaSA9IDEwOwoJaW50IHJlcyA9IDA7IAoJd2hpbGUoaSA8IG4pewoJCXJlcyArPSAoaSAtIGkvMTApKmxvZzEwKGkpOwoJCWkgKj0gMTA7Cgl9CglyZXMgKz0gKG4gLSBpLzEwKSpsb2cxMChpKStjZWlsKGxvZzEwKG4pKTsKCWNvdXQ8PHJlczsKCXJldHVybiAwOwp9