while 1:

  n = eval(input())

  if n==0: break

  A = []

  for _ in [0]*n:

    x,y,h,w = list(map(int, input().split()))

    a = max(5-(160-x-y-h)/20, 0)

    b = 5-(25-w)/5 if w>2 else 0

    A.append(max(a, b))

  print(sum([600 + e*200  for e in A if e<6]))
def f(x):

  A = []

  for i,e in enumerate(x): A += [i]*e

  return A



A = f([61]+[20]*5)

B = f([3]*2+[5]*4)

C = list(range(600,1800,200))



while 1:

  n = eval(input())

  if n==0: break

  s = 0

  for _ in [0]*n:

    x, y, h, w = list(map(int, input().split()))

    size = x + y + h

    if size <161 and w < 26:

      s += C[max(A[size], B[w])]

  print(s)
while 1:
    n = eval(input())
    if n == 0:
        break
    A = []
    for _ in [0] * n:
        x, y, h, w = list(map(int, input().split()))
        a = max(5 - (160 - x - y - h) / 20, 0)
        b = 5 - (25 - w) / 5 if w > 2 else 0
        A.append(max(a, b))
    print(sum([600 + e * 200 for e in A if e < 6]))

def f(x):
    A = []
    for i, e in enumerate(x):
        A += [i] * e
    return A


A = f([61] + [20] * 5)
B = f([3] * 2 + [5] * 4)
C = list(range(600, 1800, 200))
while 1:
    n = eval(input())
    if n == 0:
        break
    s = 0
    for _ in [0] * n:
        x, y, h, w = list(map(int, input().split()))
        size = x + y + h
        if size < 161 and w < 26:
            s += C[max(A[size], B[w])]
    print(s)

+def f(x): +    A = [] +    for i, e in enumerate(x): +        A += [i] * e +    return A + + +A = f([61] + [20] * 5) +B = f([3] * 2 + [5] * 4) +C = list(range(600, 1800, 200)) -    A = [] +    s = 0 -        a = max(5 - (160 - x - y - h) / 20, 0) -        b = 5 - (25 - w) / 5 if w > 2 else 0 -        A.append(max(a, b)) -    print(sum([600 + e * 200 for e in A if e < 6])) +        size = x + y + h +        if size < 161 and w < 26: +            s += C[max(A[size], B[w])] +    print(s)