https://www.acmicpc.net/problem/5692
#include <iostream>
using namespace std;
int main() {
for(;;){
int a;
scanf("%d",&a);
if(a==0) break;
int count=1;
int num=1;
int sum=0;
while(a>0){
int n=a%10;
sum+=n*num;
a/=10;
num*=++count;
}
cout<<sum<<'\n';
}
}