import scala.io.StdIn.{readLine,readInt}

object Main {

  def getFee(x:Int,y:Int,h:Int,w:Int) = {
    val l = x+y+h
    if(l<=60 && w <= 2) 600
    else if(l<=80 && w<=5) 800
    else if(l<=100 && w<=10) 1000
    else if(l<=120 && w<=15) 1200
    else if(l<=140 && w<=20) 1400
    else if(l<=160 && w<=25) 1600
    else 0
  }

  def main(args:Array[String]) = {
    var n = 0
    while({n=readInt;n} != 0) {
      val sum = (1 to n).map { i =>
        val m = readLine.split(" ").map(_.toInt)
        getFee(m(0),m(1),m(2),m(3))
      }.sum
      println(sum)
    }
  }
}