read n; awk '{mo=1000000007; ret+=(int(($1+1)/2)%mo*($2%mo))%mo; ret=ret%mo}END{print ret%mo}'