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