#include<bits/stdc++.h>
using namespace std;
int main(){
    int x,g,s,b,q,h;
    cin>>x;
    g=x%10;
    s=x/10%10;
    b=x/100%10;
    q=x/1000;
    h=q+b+s+g;
    cout<<h;
    
    
    return 0;
}
/**************************************************************
	Problem: 1390
	User: cyp
	Language: C++
	Result: Accepted
	Time:18 ms
	Memory:2072 kb
****************************************************************/