const fi='docao.inp'; fo='docao.out';
var i,n,j,t,sum:integer;
A:array[1..1000] of longint;
s:string;
f:text;
procedure doc;
begin
assign(f,fi);
reset(f);
readln(f,n);
for i:=1 to n do
read(f,A[i]);
close(f);
end;
procedure xl;
begin
assign(f,fo);
rewrite(f);
for i:=1 to n do
begin
str(A[i],s);
sum:=0;
for j:=1 to length(s) do
begin
val(S[j],t);
sum:=sum+t;
end;
write(f,sum,' ');
end;
close(f);
end;
Begin
doc;
xl;
END.