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