# frozen_string_literal: true n = gets.chomp.to_i desks = [] n.times do c, d = gets.chomp.split.map(&:to_i) desks << [c, d] end student = desks.map { |desk| Rational(desk[0], 2).ceil * desk[1] }.sum max = 1_000_000_000 + 7 puts student % max