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

C++: #include <iostream>
using namespace std;
int main(void) {
  int n, x, y, h, w;
  int sum;
  while(cin >> n, n!=0) {
    sum = 0;
    for(int i = 0 ; i < n ; i++) {
      cin >> x >> y >> h >> w;
      int size = x + y + h;
      if(size <= 60 && w <= 2) sum += 600;
      else if(size <= 80 && w <= 5) sum += 800;
      else if(size <= 100 && w <= 10) sum += 1000;
      else if(size <= 120 && w <= 15) sum += 1200;
      else if(size <= 140 && w <= 20) sum += 1400;
      else if(size <= 160 && w <= 25) sum += 1600;
    }
    cout << sum << endl;
  }
  return 0;
}

C++: #include <cstdio>

int main(){
	int x, y, h, w, size, fee, sumfee;
	int n;
	
	while(scanf("%d", &n) != EOF){
		sumfee = 0;
		for(int i = 0; i < n; i++){
			scanf("%d %d %d %d", &x, &y, &h, &w);
			size = x + y + h;
			fee = 0;
			if(size <= 60){
				fee = 600;
			}else if(size <= 80){
				fee = 800;
			}else if(size <= 100){
				fee = 1000;
			}else if(size <= 120){
				fee = 1200;
			}else if(size <= 140){
				fee = 1400;
			}else if(size <= 160){
				fee = 1600;
			}
		
			if(w <= 2 && fee <= 600){
				fee = 600;
			}else if(w <= 5 && fee <= 800){
				fee = 800;
			}else if(w <= 10 && fee <= 1000){
				fee = 1000;
			}else if(w <= 15 && fee <= 1200){
				fee = 1200;
			}else if(w <= 20 && fee <= 1400){
				fee = 1400;
			}else if(w <= 25 && fee <= 1600){
				fee = 1600;
			}else {
				fee = 0;
			}
		
			sumfee += fee;
		}
		printf("%d\n", sumfee);
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	while(true){
	cin>>n;
	if(n==0)
		break;
	int x,y,h,w;
	int ans=0;
	for(int u=0;u<n;u++){
		cin>>x>>y>>h>>w;
		int count=0;
		if(x+y+h<=160&&w<=25)
			count=1600;
		if(x+y+h<=140&&w<=20)
			count=1400;
		if(x+y+h<=120&&w<=15)
			count=1200;
		if(x+y+h<=100&&w<=10)
			count=1000;
		if(x+y+h<=80&&w<=5)
			count=800;
		if(x+y+h<=60&&w<=2)
			count=600;
		ans+=count;
	}
	cout<<ans<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;

int main()
{
  int n;
  for(;cin>>n,n;)
    {
      int sum=0;
      for(int i=0;i<n;i++)
	{
	  int x,y,h,w;
	  cin>>x>>y>>h>>w;
	  int size=x+y+h;
	  if(size<61&&w<3)
	    sum+=600;
	  else if(size<81&&w<6)
	    sum+=800;
	  else if(size<101&&w<11)
	    sum+=1000;
	  else if(size<121&&w<16)
	    sum+=1200;
	  else if(size<141&&w<21)
	    sum+=1400;
	  else if(size<161&&w<26)
	    sum+=1600;
	}
      cout<<sum<<endl;
    }
}

C++: #include <iostream>
using namespace std;

int main(void){
  int n;
  while(cin >> n && n != 0){
    int x, y, h, w, fee = 0;
    for(int i = 0; i < n; i++){
      cin >> x >> y >> h >> w;
      int size = x + y + h;
      if(size <= 60 && w <= 2) fee += 600;
      else if(size <= 80 && w <= 5) fee += 800;
      else if(size <= 100 && w <= 10) fee += 1000;
      else if(size <= 120 && w <= 15) fee += 1200;
      else if(size <= 140 && w <= 20) fee += 1400;
      else if(size <= 160 && w <= 25) fee += 1600;
    }
    cout << fee << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int n;
	while (cin >> n){
		if (n == 0)return 0;
		int sum = 0;
		for (int i = 0; i < n; i++){
			int a, b, c, d; cin >> a >> b >> c >> d;
			a += b + c;
			if		(a <= 60 && d <= 2)sum += 600;
			else if (a <= 80 && d <= 5)sum += 800;
			else if (a <= 100 && d <= 10)sum += 1000;
			else if (a <= 120 && d <= 15)sum += 1200;
			else if (a <= 140 && d <= 20)sum += 1400;
			else if (a <= 160 && d <= 25)sum += 1600;
			else {}
		}
		cout << sum << endl;
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	char s[6] = { 'A','B','C','D','E','F' };
	int big[6] = { 60,80,100,120,140,160 };
	int h[6] = { 2,5,10,15,20,25 };
	int m[6] = { 600,800,1000,1200,1400,1600 };
	int n;
	while (cin >> n&&n != 0) {
		int sum = 0;
		for (int z = 0; z < n; z++) {
			int k, l, o, p,q=-1,r=-1;
			cin >> k >> l >> o >> p;
			k += (l + o);
			for (int i = 0; i < 6; i++) {
				if (k <= big[i]) {
					q = m[i];
					break;
				}
			}
			for (int i = 0; i < 6; i++) {
				if (p <= h[i]) {
					r = m[i];
					break;
				}
			}
			if (q != -1 && r != -1) {
				sum += max(q, r);
			}
		}
		cout << sum << endl;
	}
}

C++: #include<stdio.h>

int main(){

int n;

while(1){

scanf("%d",&n);if(n==0)break;

int x,y,h,w;
int S=0;
for(int i=0;i<n;i++)
{
scanf("%d %d %d %d",&x,&y,&h,&w);
int s=x+y+h;
int T1=0,T2=0;

if(s<=60)T1=1;
else if(s<=80)T1=2;
else if(s<=100)T1=3;
else if(s<=120)T1=4;
else if(s<=140)T1=5;
else if(s<=160)T1=6;
else if(s>160)T1=10;

if(w<=2)T2=1;
else if(w<=5)T2=2;
else if(w<=10)T2=3;
else if(w<=15)T2=4;
else if(w<=20)T2=5;
else if(w<=25)T2=6;
else if(w>25)T2=10;


if(T1<T2)T1=T2;

int p=0;
switch(T1){
case 1:
p=600;break;

case 2:
p=800;break;

case 3:
p=1000;break;

case 4:
p=1200;break;
case 5:
p=1400;break;
case 6:
p=1600;break;
case 10:
p=0;break;
}
S+=p;
}
printf("%d\n",S);

}
return 0;
}

C++: #include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

int main(){

	int n,sum,a,b,c,size,w;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		sum = 0;

		for(int i = 0; i < n; i++){
			scanf("%d %d %d %d",&a,&b,&c,&w);

			size = a+b+c;

			if(size <= 60 && w <= 2){
				sum += 600;
			}else if(size <= 80 && w <= 5){
				sum += 800;
			}else if(size <= 100 && w <= 10){
				sum += 1000;
			}else if(size <= 120 && w <= 15){
				sum += 1200;
			}else if(size <= 140 && w <= 20){
				sum += 1400;
			}else if(size <= 160 && w <= 25){
				sum += 1600;
			}
		}

		printf("%d\n",sum);
	}

    return 0;
}

C++: #include<iostream>
using namespace std;

int judge(int size, int w){
	if(size <= 120 && w <= 15){
		if(size <= 80 && w <= 5){
			if(size <= 60 && w <= 2) return 600;
			else return 800;
		} else if(size <= 100 && w <= 10) return 1000;
		else return 1200;
	} else if(size <= 160 && w <= 25){
		if(size <= 140 && w <= 20) return 1400;
		else return 1600;
	} else return 0;
}

int main(){
	int n, x, y, h, w, charge, sum;
	while(1){
		cin >>n;
		if(n == 0) break;
		
		sum = 0;
		for(int i = 0; i < n; i++){
			cin >>x >>y >>h >>w;
			sum += judge((x + y + h), w);
		}
		cout <<sum <<endl;
	}
	return 0;
}

C++: #include <cstdio>

int main(){
	int x, y, h, w, size, fee, sumfee;
	int n;
	
	for(;;){
                scanf("%d", &n);
		if(n == 0) break;
                sumfee = 0;
		for(int i = 0; i < n; i++){
			scanf("%d %d %d %d", &x, &y, &h, &w);
			size = x + y + h;
			fee = 0;
			if(size <= 60){
				fee = 600;
			}else if(size <= 80){
				fee = 800;
			}else if(size <= 100){
				fee = 1000;
			}else if(size <= 120){
				fee = 1200;
			}else if(size <= 140){
				fee = 1400;
			}else if(size <= 160){
				fee = 1600;
			}
		
			if(w <= 2 && fee <= 600){
				fee = 600;
			}else if(w <= 5 && fee <= 800){
				fee = 800;
			}else if(w <= 10 && fee <= 1000){
				fee = 1000;
			}else if(w <= 15 && fee <= 1200){
				fee = 1200;
			}else if(w <= 20 && fee <= 1400){
				fee = 1400;
			}else if(w <= 25 && fee <= 1600){
				fee = 1600;
			}else {
				fee = 0;
			}
		
			sumfee += fee;
		}
		printf("%d\n", sumfee);
	}
	return 0;
}