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

