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: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0160

"""
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[0] for x in prices]
        w_key = [x[1] 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: 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().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: 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(x + y + h, sl), le(w, wl))]
  print(s)

Python: size = [60,80,100,120,140,160]        
weight = [2,5,10,15,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().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:
    n=int(input())
    if n==0:
        break
    s=0
    for i in range(n):
        x,y,h,w=map(int,input().split())
        k=x+y+h
        if k<=60 and w<=2:
            s+=600
        elif k<=80 and w<=5:
            s+=800
        elif k<=100 and w<=10:
            s+=1000
        elif k<=120 and w<=15:
            s+=1200
        elif k<=140 and w<=20:
            s+=1400
        elif k<=160 and w<=25:
            s+=1600
        else:
            pass
    print (s)

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: 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)