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