module Main where
import Control.Monad
import Control.Applicative
import Data.Maybe
import Data.List
import qualified Text.Printf
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BC

------------------------------------------

main :: IO ()
main = do
    n <- readInt
    if n == 0 then return ()
    else do
        prices <- replicateM n $ do
            [x, y, h, w] <- readInts
            let size = x + y + h
                price1
                  | size <= 60 = 600
                  | size <= 80 = 800
                  | size <= 100 = 1000
                  | size <= 120 = 1200
                  | size <= 140 = 1400
                  | size <= 160 = 1600
                  | otherwise = 0
                price2
                  | w <= 2 = 600
                  | w <= 5 = 800
                  | w <= 10 = 1000
                  | w <= 15 = 1200
                  | w <= 20 = 1400
                  | w <= 25 = 1600
                  | otherwise = 0
            return $ if price1 == 0 || price2 == 0 then 0 else max price1 price2
        print $ sum prices
        main

------------------------------------------

{- Int input -}

parseInt :: BC.ByteString -> Int
parseInt = fst . fromJust . BC.readInt

parseInts :: BC.ByteString -> [Int]
parseInts = map parseInt <$> BC.words

readInt :: IO Int
readInt = parseInt <$> BC.getLine

readInts :: IO [Int]
readInts = parseInts <$> BC.getLine

{- Double Formatting -}

doubleFormat :: Double -> String
doubleFormat = Text.Printf.printf "%.12f"