def f (x,y,h,w)
  l = x + y + h
  return 600 if l<=60 and w<=2
  return 800 if l<=80 and w<=5
  return 1000 if l<=100 and w<=10
  return 1200 if l<=120 and w<=15
  return 1400 if l<=140 and w<=20
  return 1600 if l<=160 and w<=25
  return 0
end

loop{
  n = gets.to_i
  break if n==0
  puts n.times.map{f(*gets.split.map(&:to_i))}.reduce(:+)
}
