#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,z,m;
int main(){
    cin>>z;
    a=z%10;
    b=z%100/10;
    c=z%1000/100;
    d=z/1000;
    m=a+b+c+d;
    cout<<m; 
}
/**************************************************************
	Problem: 1390
	User: chenyichuen
	Language: C++
	Result: Accepted
	Time:14 ms
	Memory:2072 kb
****************************************************************/