@b=<>;map{@a=$v=1-$m;$m=0;map{push@a,$v=($v-$b[$_])*(-1)**$_;$m=$v-1if$m>=$v}1..$#b}0,1;print$m<0?-1:join$/,@a+0,@a