while n = gets.to_i
  break if n.zero?

  total = 0
  n.times do
    x, y, h, w = gets.split.map(&:to_i)
    s = x + y + h
    if s <= 60 && w <= 2
      total += 600
    elsif s <= 80 && w <= 5
      total += 800
    elsif s <= 100 && w <= 10
      total += 1000
    elsif s <= 120 && w <= 15
      total += 1200
    elsif s <= 140 && w <= 20
      total += 1400
    elsif s <= 160 && w <= 25
      total += 1600
    end
  end
  puts total
end