ans = 0 gets.to_i.times { c,d = gets.split.map(&:to_i) ans += (c+1)/2*d ans %= 1000000007 } puts ans % 1000000007