#include <iostream>
using namespace std;
int main()
{
int n,t,sum = 0;
int i = 1;
cin >> n;
//n翻转,比如n=123,翻转后n=321
while(n)
{
t = n%10;
sum = sum *10 + t;
n/=10;
}
//cout << sum<<endl;
n = sum;
sum = 0;
while(n)
{
t = n%10;
sum += t*i;
n/=10;
i++;
}
cout << sum << endl;
return 0;
}