N = gets.to_i C, D = (1..N).map {gets.split.map(&:to_i)}.transpose ans = C.zip(D).map {|c, d| (c + 1) / 2 * d}.inject(:+) puts ans