($n,@b)=<>; @a=1; for(0..9){ $m=1e19;$o=-1e19; for(0..$#b){ $v=$a[$_+1]=($b[$_]-$a[$_])*(-1)**$_; if($_%4==1||$_%4==2){ $v=1e18+1-$v; } $m=$v if $m>$v; $o=$v if $o<$v; } if($m<1){ $a[0]+=1-$m; }elsif($o>1e18){ $a[0]-=$o-1e18; }else{ print join$/,$n+1,@a; exit; } } print -1;