@x=@y,@y=split for<>;$d=2e6;$d-=$-=$d-$_-shift@x for@y;$,=$/;print$d,0,map$-=$d-$_,@y,0