1.
var g,kg:integer;
begin
readln(g);
writeln('kg: ', g div 1000);
writeln('g: ', g mod 1000);
end.
2.
var a,b:integer;
begin
readln(a,b);
writeln(a mod 10, a div 10);
writeln(b mod 10, b div 10);
end.
3.
var a:integer;
begin
readln(a);
writeln(a div 100 * a div 10 mod 10 * a mod 10);
end.
4.
var a:integer;
begin
readln(a);
write(a div 1000 + a mod 1000 div 100 + a mod 1000 div 10 mod 10 + a mod 10);
end.