sum = 0 gets.to_i.times do c,d=gets.split.map(&:to_i) sum += (c+1)/2*d end p sum