var a:integer;
Begin
readln(a);
Writeln(a mod 10 + a div 10 mod 10 + a div 10 div 10 mod 10 + a div 1000);
end.
var a:integer;
Begin
readln(a);
Writeln(a mod 10 + a div 10 mod 10 + a div 10 div 10 mod 10 + a div 1000);
end.