https://www.acmicpc.net/problem/5692
using System;
using System.Text;
class Program
{
static void Main() {
StringBuilder sb = new StringBuilder();
for(;;){
int a=int.Parse(Console.ReadLine());
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;
}
sb.Append(sum+"\n");
}
Console.Write(sb.ToString());
}
}