sub muri { print -1; exit; } $n=<>; @a=glob<>; @b=glob<>; for(0..$n-1){ $s-=$b[$_]-=$a[$_]; } $n==2 ? $s==0 : $s%($n-2)==0 or muri; $n==2 or $s/=$n-2; for(0..$n-1){ $b[$_]+$s&1 and muri; $t+=$u=($b[$_]+$s)/2; } print "s=$s t=$t\n"; $s==$t or muri; print $s;