var
a:array [1..1000000] of longint;
N,S,i:longint;
begin
Readln(N);
For i:=1 to N do begin Read(a[i]); S:=S+a[i]; end; Readln;
Writeln(S);
For i:=1 to N do Write(a[i],' ');
end.
var
a:array [1..1000000] of longint;
N,S,i:longint;
begin
Readln(N);
For i:=1 to N do begin Read(a[i]); S:=S+a[i]; end; Readln;
Writeln(S);
For i:=1 to N do Write(a[i],' ');
end.