var x1,x2,x3,x4,x5:integer;
begin
read(x1,x2,x3,x4,x5);
x1:=x1 div 3;x5:=x5+x1;x2:=x1+x2;
x2:=x2 div 3;x1:=x1+x2;x3:=x3+x2;
x3:=x3 div 3;x2:=x2+x3;x4:=x3+x4;
x4:=x4 div 3;x3:=x3+x4;x5:=x5+x4;
x5:=x5 div 5;x1:=x1+x5;x4:=x4+x5;
writeln(x1,' ',x2,' ' ,x3,' ' ,x4,' ',x5);
readln;
end.