var n,s:integer; x1,x2,x3,x4:integer;beginwrite('Vvedite N = ');read(n);x1:=n div 1000;x2:=n mod 1000 div 100;x3:=n mod 100 div 10;x4:=n mod 10 div 1;s:=x1+x2+x3+x4;writeln(s);end.
var n,s:integer;
x1,x2,x3,x4:integer;
begin
write('Vvedite N = ');
read(n);
x1:=n div 1000;
x2:=n mod 1000 div 100;
x3:=n mod 100 div 10;
x4:=n mod 10 div 1;
s:=x1+x2+x3+x4;
writeln(s);
end.