$"=''; $b=($a=1e9)+7; @N=<>=~/./g; $K=@N; $x=`dc -e'A $K 1-2/$a|A $K 2/$a|+2-p'`%$a; $y=`dc -e'A $K 1-2/$b|A $K 2/$b|+2-p'`%$b; $t+="@N[0..$K-1>>1,reverse 0..$K/2-1]"le"@N"; --$N[0]; $x+=`dc -e'@N[0..$K-1>>1] $t+$a%p'`;$x%=$a; $y+=`dc -e'@N[0..$K-1>>1] $t+$b%p'`;$y%=$b; print"$x\n$y"