gets;s=0;$<.map{|c|n,m=c.split.map &:to_i;s+=-~n/2*m};p s%=10**9+7