#include <iostream>
using namespace std;
int main() {
int x;
cin >> x;
int a = x % 10;
int b = (x % 100) / 10;
int c = (x % 1000 - b * 10 - a) / 100;
int d = (x % 10000 - c * 100 -b * 10 - a) / 1000;
int e = (x % 100000 - d * 1000 - c * 100 - b * 10 - a) / 10000;
int f = (x % 1000000 - e * 10000 - d * 1000 - c * 100 - b * 10 - a) / 100000;
int g = (x % 10000000 - f * 100000 - e * 10000 - d * 1000 - c * 100 - b * 10 - a) / 1000000;
cout << b + c + d + e + f + g + a << endl;
return 0;
}