answer = 0 N = gets.to_i N.times do c, d = gets.split.map(&:to_i) answer += (c / 2 + (c.even? ? 0 : 1)) * d end puts answer