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: size = [60,80,100,120,140,160]        
weight = [2,5,10,16,20,25]
fee= [600,800,1000,1200,1400,1600]
while True:
    n = int(input())
    if n==0:
        break
    total = 0
    for _ in range(n):
        [x,y,h,wt] = list(map(int, input().split()))
        sz = x+y+h
        if sz > size[-1] or wt > weight[-1]:
            #print("NotAccept")
            continue
        isz = len(list(filter(lambda x: x<sz,   size)))
        iwt = len(list(filter(lambda x: x<wt, weight)))
        f   = fee[max(isz,iwt)]
        #print("%d %d %d %d %d" % (x,y,h,wt,f))
        total += f

    print(total)

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

Python: size = [60,80,100,120,140,160]        
weight = [2,5,10,16,20,25]
fee= [600,800,1000,1200,1400,1600]
while True:
    n = int(input())
    if n==0:
        break
    total = 0
    for _ in range(n):
        [x,y,h,wt] = list(map(float, input().strip().split()))
        sz = x+y+h
        if sz <= size[-1] and wt <= weight[-1]:
            isz = len(list(filter(lambda x: x<sz,   size)))
            iwt = len(list(filter(lambda x: x<wt, weight)))
            f   = fee[max(isz,iwt)]
            #print("%d %d %d %d %d" % (x,y,h,wt,f))
            total += f
    print(total)

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

Python: while True:
    e=0
    k=0
    l=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
        l+=k
    print(l)

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0160
AC
"""
import sys
from sys import stdin
from collections import namedtuple
from bisect import bisect_left
input = stdin.readline
price = namedtuple('price', ['size', 'weight', 'cost'])


def main(args):
    prices = [price(60, 2, 600), price(80, 5, 800), price(100, 10, 1000), price(120, 15, 1200),
              price(140, 20, 1400), price(160, 25, 1600), price(float('inf'), float('inf'), 0)]

    while True:
        n = int(input())
        if n == 0:
            break

        s_key = [x.size for x in prices]
        w_key = [x.weight for x in prices]
        total = 0
        for _ in range(n):
            x, y, h, w = map(int, input().split())
            i = bisect_left(s_key, x+y+h)
            j = bisect_left(w_key, w)
            total += prices[max(i, j)].cost

        print(total)



if __name__ == '__main__':
    main(sys.argv[1:])

Python: while True:
    e=0
    k=0
    l=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
        l+=k
    print(l)

Python: SENTINEL = 9999
SIZE = (60, 80, 100, 120, 140, 160, SENTINEL)
WEIGHT = (2, 5, 10, 15, 20, 25, SENTINEL)
PRICE = (600, 800, 1000, 1200, 1400, 1600, SENTINEL)


def check(item, base_list, output):
    for index, base in enumerate(base_list):
        if item <= base:
            return output[index]


while True:

    input_count = int(input())

    if input_count == 0:
        break

    sum = 0

    for _ in range(input_count):
        vertical, horizontal, height, weight = [int(item) for item in input().split(" ")]
        size = vertical + horizontal + height

        price = max(check(size, SIZE, PRICE), check(weight, WEIGHT, PRICE))

        if price != SENTINEL:
            sum += price

    print(sum)