uses crt;
var a,b,c,d,ch:integer; sr:real;
begin
readln(ch);
a:= ch div 1000;
b:= ( ch div 100) mod 10;
c:= ( ch div 10) mod 10;
d:=ch mod 10;
if ch mod 2 = 0 then
writeln((a+b+c+d)/4)
else
writeln(sqr(a),' ',sqr(b),' ',sqr(c),' ',sqr(d));
readln;
end.