#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d,z,m;
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: xuezihong1
Language: C++
Result: Accepted
Time:14 ms
Memory:2072 kb
****************************************************************/