#include #include #include #include #include //--------------------------- using namespace std; //--------------------------- #define REP(i,n) for(int i = 0; i < (n); i++) #define P(x) cout << (x) << "\n" //--------------------------- int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); string s;cin>>s; int t = s.size(); vector v;//string各文字のAscii for (int i = 0; i < t; i++) { char c = s[i]; v.push_back(c); } int cnt[11] = {}; REP(i,9){ cnt[i+1] = count(v.begin(),v.end(),49+i); } int ans = 0; REP(i,9){ ans += (i+1) * cnt[i + 1]; } P(ans); return 0; }