#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define mp(a,b) make_pair(a,b) #define pb(a) push_back(a) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="< vec; char c; while(scanf("%c", &c)){ if(c=='\n') break; vec.pb(c-'0'); } int n =vec.size(); long res = 0; long ue=n-1, shita=1; long cc=1; rep(i,n){ res += (long)vec[i] * cc; cc = cc * ue / shita; dbg(cc); ue--; shita++; while(res>10){ res = res/10 + res%10; } } printf("%d\n", res); } return 0; }