#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    
    int thousands = n / 1000;
    int hundreds = (n / 100) % 10;
    int tens = (n / 10) % 10;
    int ones = n % 10;

    int sum = thousands + hundreds + tens + ones;

    cout << sum << endl;

    return 0;
}