#include <stdio.h>
int sum(n);
int main(void) {
int a;
return 0;
}
int sum(n){
int sum=0;
int num=n;
for(int i=0; i<n; i++){
sum=sum+num;
num=num*10+n;
}
return sum;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgc3VtKG4pOwoKaW50IG1haW4odm9pZCkgewoJaW50IGE7CglzY2FuZigiJWQiLCZhKTsKCXByaW50ZigiJWQiLHN1bShhKSk7CglyZXR1cm4gMDsKfQoKaW50IHN1bShuKXsKCWludCBzdW09MDsKCWludCBudW09bjsKCWZvcihpbnQgaT0wOyBpPG47IGkrKyl7CgkJc3VtPXN1bStudW07CgkJbnVtPW51bSoxMCtuOwoJfQoJcmV0dXJuIHN1bTsKfQo=