use bigint; sub MD(){1000000007} ($a,$b)=map$_+0,glob<>; print+(($a%MD*2+1)*($b%MD*2+1)+1)%MD*((MD+1)/2)%MD-($a+$b&1);