Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"strings"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	tbl := []int{600, 800, 1000, 1200, 1400, 1600}
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			 break
		}
		fee := 0
		for i := 0; i < n; i++ {
			scanner.Scan()
			buf := strings.Split(scanner.Text(), " ")
			x, _ := strconv.Atoi(buf[0])
			y, _ := strconv.Atoi(buf[1])
			h, _ := strconv.Atoi(buf[2])
			w, _ := strconv.Atoi(buf[3])
			s := x + y + h
			if s <= 160 && w <= 25 {
				k1, k2 := 0, 0
				if s <= 60 {
					k1 = 0
				} else {
					k1 = (s-61)/20 + 1
				}
				if w <= 2 {
					k2 = 0
				} else {
					k2 = (w-1)/5 + 1
				}
				if k1 < k2 {
					k1 = k2
				}
				fee += tbl[k1]
			}
		}
		fmt.Println(fee)
	}
}

Python: while True:
    counter = int(input())
    if counter == 0:
        break
    deliv_price = 0
    for i in range(0,counter):
        data = input().split(" ")
        size = int(data[0]) + int(data[1]) + int(data[2])
        weight = int(data[3])

        if size <= 60 and weight <= 2:
            deliv_price += 600
        elif size <= 80 and weight <=5:
            deliv_price += 800
        elif size <= 100 and weight <=10:
            deliv_price += 1000
        elif size <= 120 and weight <=15:
            deliv_price += 1200
        elif size <= 140 and weight <=20:
            deliv_price += 1400
        elif size <= 160 and weight <=25:
            deliv_price += 1600
    print(deliv_price)

Python: while 1:
    n,v=int(input()),0
    if n==0:break
    for _ in range(n):
        x,y,h,w=map(int,input().split())
        x=x+y+h
        if x<61 and w<3:v+=600
        elif x<81 and w<6:v+=800
        elif x<101 and w<11:v+=1000
        elif x<121 and w<16:v+=1200
        elif x<141 and w<21:v+=1400
        elif x<161 and w<26:v+=1600
    print(v)

Python: while 1:
    n = int(input())
    if n == 0:
        break

    price = 0
    for _ in range(n):
        x, y, h, w = map(int, input().split())
        size = x + y + h

        if size <= 60 and w <= 2:
            price += 600
        elif size <= 80 and w <= 5:
            price += 800
        elif size <= 100 and w <= 10:
            price += 1000
        elif size <= 120 and w <= 15:
            price += 1200
        elif size <= 140 and w <= 20:
            price += 1400
        elif size <= 160 and w <= 25:
            price += 1600

    print(price)

Python: def ryoukin(x, y, h, w) :
    length = x + y + h
    if length <= 60 and w <= 2 :
        return 600
    elif length <= 80 and w <= 5 :
        return 800
    elif length <= 100 and w <= 10 :
        return 1000
    elif length <= 120 and w <= 15 :
        return 1200
    elif length <= 140 and w <= 20 :
        return 1400
    elif length <= 160 and w <= 25 :
        return 1600
    else :
        return 0

while True :
    n = int(input())
    if n == 0 :
        break
    ans = 0
    for i in range(n) :
        x, y, h, w = map(int, input().split())
        ans += ryoukin(x, y, h, w)
    print(ans)

Python: # AOJ 0160 Delivery Fee
# Python3 2018.6.18 bal4u


tbl = [ 600, 800, 1000, 1200, 1400, 1600 ]

while True:
	n = int(input())
	if n == 0: break
	fee = 0
	for i in range(n):
		x, y, h, w = list(map(int, input().split()))
		s = x+y+h
		if s <= 160 and w <= 25:
			k1 = k2 = 0
			if s <= 60: k1 = 0
			else: k1 = (s-61)//20 + 1
			if w <= 2: k2 = 0;
			else: k2 = (w-1)//5 + 1
			if k1 < k2: k1 = k2
			fee += tbl[k1]
	print(fee)

Python: S = [60, 80, 100, 120, 140, 160]
W = [2, 5, 10, 15, 20, 25]
P = [600, 800, 1000, 1200, 1400, 1600]

while 1:
    n = int(input())
    if n == 0:
        break
    r = 0
    for i in range(n):
        x, y, h, w = map(int, input().split())
        s = x + y + h
        for j in range(6):
            if s <= S[j] and w <= W[j]:
                r += P[j]
                break
    print(r)

Python: INF = 10000000000
sl = [60,  80,  100,  120,  140,  160,  INF]
wl = [2,   5,   10,   15,   20,   25,   INF]
pl = [600, 800, 1000, 1200, 1400, 1600, 0  ]

def le(n, l):
  for i, v in enumerate(l):
    if v >= n:
      return i

while True:
  N = input()
  if not N:
    break
  s = 0
  for i in range(N):
    x, y, h, w = map(int, raw_input().split())
    s += pl[max(le(max(x, y, h), sl), le(w, wl))]
  print(s)

Python: while 1:
    n,v=int(input()),0
    if n==0:break
    for _ in range(n):
        x,y,h,w=map(int,input().split())
        x=x+y+h
        if x<61 and w<3:v+=6
        elif x<81 and w<6:v+=8
        elif x<101 and w<11:v+=10
        elif x<121 and w<16:v+=12
        elif x<141 and w<21:v+=14
        elif x<161 and w<26:v+=16
    print(v*100)

Python: INF = 10000000000
sl = [0,   60,  80,  100,  120,  140,  160,  INF]
wl = [0,   2,   5,   10,   15,   20,   25,   INF]
pl = [600, 800, 1000, 1200, 1400, 1600, 0  ]

def le(n, l):
  for i, v in enumerate(l):
    if v >= n:
      return i - 1

while True:
  N = input()
  if not N:
    break
  s = 0
  for i in range(N):
    x, y, h, w = map(int, raw_input().split())
    s += pl[max(le(max(x, y, h), sl), le(w, wl))]
  print(s)

Python: def charge(x, y, h, w):
  size = x + y + h
  if size <= 60 and w <= 2:
    return 600
  elif size <= 80 and w <= 5:
    return 800
  elif size <= 100 and w <= 10:
    return 1000
  elif size <= 120 and w <= 15:
    return 1200
  elif size <= 140 and w <= 20:
    return 1400
  elif size <= 160 and w <= 25:
    return 1600
  else:
    return 0
while True:
  n = int(input())
  if n == 0:
    break
  
  c_sum = 0 
  for _ in range(n):
    x, y, h, w = map(int, input().split())
    c_sum += charge(x, y, h, w)
  print(c_sum)

Python: while True:
    e=0
    k=0
    po=0
    kk=0
    n=int(input())
    if n==0:
        break
    for i in range(n):
        ans1=0
        ans2=0
        a,b,c,d=0,0,0,0
        a,b,c,d=map(int,input().split())
        a=a+b+c
        if a<=60:
            ans1=1
        elif a<=80:
            ans1=2
        elif a<=100:
            ans1=3
        elif a<=120:
            ans1=4
        elif a<=140:
            ans1=5
        elif a<=160:
            ans1=6
        else:
            kk=1
        if d<=2:
            ans2=1
        elif d<=5:
            ans2=2
        elif d<=10:
            ans=3
        elif d<=15:
            ans2=4
        elif d<=20:
            ans2=5
        elif d<=25:
            ans2=6
        else:
            kk=1
        if ans1<ans2:
            e=ans2
        elif ans1>ans2:
            e=ans1
        elif ans1==ans2:
            e=ans1
        if kk==1:
            k=0
        elif e==6:
            k=1600
        elif e==5:
            k=1400
        elif e==4:
            k=1200
        elif e==3:
            k=1000
        elif e==2:
            k=800
        elif e==1:
            k=600
        else:
            k=0
        po+=k
    print(po)

Python: while True:
  n =int(input())
  if n==0:
    break
  ans=0
  for i in range(n): 
    x,y,h,w=map(int, input().split())
    size=x+y+h
    if size<=60 and w<=2:
      pay=600    
    elif size<=80 and w<=5:
      pay=800
    elif size<=100 and w<=10:
      pay=1000
    elif size<=120 and w<=15:
      pay=1200
    elif size<=140 and w<=20:
      pay=1400
    elif size<=160 and w<=25:
      pay=1600
    else:
      pay =0
    ans+=pay      
  print(ans)