puts Array.new(gets.to_i) { gets.split.map(&:to_i).map { (_1 + 1) / 2 * _2 } }.sum