gets count = 0 while line = gets do c, d = line.split.map(&:to_i) count += (c + 1) / 2 * d end puts count % (10 ** 9 + 7)