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<cstdio>
using namespace std;
int main(){
    int n;
    while(scanf("%d",&n),n){
        int sum=0;
        while(n--){
            int s=0,h;
            for(int i=0;i<3;i++){
                int l;
                scanf("%d",&l);
                s+=l;
            }
            scanf("%d",&h);
            if(s<=60&&h<=2)sum+=600;
            else if(s<=80&&h<=5)sum+=800;
            else if(s<=100&&h<=10)sum+=1000;
            else if(s<=120&&h<=15)sum+=1200;
            else if(s<=140&&h<=20)sum+=1400;
            else if(s<=160&&h<=25)sum+=1600;
        }
        printf("%d\n",sum);
    }
    return 0;
}

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

class Box {
public:
  int x, y, h, w;
  int cost() {
    int sum = x + y + h;
    if(sum <= 60 && w <= 2) return 600;
    if(sum <= 80 && w <= 5) return 800;
    if(sum <= 100 && w <= 10) return 1000;
    if(sum <= 120 && w <= 15) return 1200;
    if(sum <= 140 && w <= 20) return 1400;
    if(sum <= 160 && w <= 25) return 1600;
    return 0;
  }
};

int main() {
  while(1) {
    int n;
    cin >> n;
    if(n == 0) break;
    Box b[n];
    int sum = 0;
    for(int i = 0; i < n; i++) {
      cin >> b[i].x >> b[i].y >> b[i].h >> b[i].w;
      sum += b[i].cost();
    }
    cout << sum << endl;
  }
  return 0;
}

C++: #include <iostream>
int whatPrice(int, int);

int main(){
	int n;
	while(std::cin >> n, n){
		int price = 0;
		while(n--){
			int x, y, h, w;
			std::cin >> x >> y >> h >> w;
			price += whatPrice(x+y+h, w);
		}
		std::cout << price << std::endl;
	}
}

int whatPrice(int size, int weight){
	int price = 0;
	//A size
	if(size <= 60 && weight <= 2){
		price = 600;
	}
	//B size
	else if(size <= 80 && weight <= 5){
		price = 800;
	}
	//C size
	else if(size <= 100 && weight <= 10){
		price = 1000;
	}
	//D size
	else if(size <= 120 && weight <= 15){
		price = 1200;
	}
	//E size
	else if(size <= 140 && weight <= 20){
		price = 1400;
	}
	//F size
	else if(size <= 160 && weight <= 25){
		price = 1600;
	}
	//FTCYð´¦êÎCifÉøÁ©©ç¸úlÌ0ÆÈéD

	return price;
}

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

int length[6] = {60,80,100,120,140,160};
int weight[6] = {2,5,10,15,20,25};
int fee[6] = {600,800,1000,1200,1400,1600};

int main(int argc, const char * argv[]) {
    
    while (true) {
        int n;
        cin >> n;
        if(n == 0){
            break;
        }
        
        int sum = 0;
        for(int i=0;i<n;i++){
            int x,y,h,w;
            cin >> x >> y >> h >> w;
            
            for(int j=0;j<6;j++){
                if(length[j] >= x+y+h && weight[j] >= w){
                    sum+= fee[j];
                    break;
                }
            }
            
        }
        
        cout << sum << endl;
    }
    
    return 0;
}

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<iostream>
#include<vector>
#include<string>
using namespace std;

int main() {
	while (1) {
		int a;
		cin >> a;
		if (a == 0)break;
		int s = 0;
		for (int b = 0; b < a; b++) {
			int c, d, e, f, g;
			cin >> c >> d >> e >> f;
			g = c + d + e;
			if (g > 160 || f > 25)s += 0;
			else 	if (g > 140 || f > 20)s += 1600;
			else if(g > 120 || f > 15)s += 1400;
			else if (g > 100 || f > 10)s += 1200;
			else if (g > 80 || f > 5)s += 1000;
			else if (g > 60 || f > 2)s += 800;
			else s += 600;
		}
		cout << s << endl;
	}
}

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

int main(){
   int i,n,a[3],w,total,sum;
   int big[] = {60,80,100,120,140,160,0};
   int wai[] = {2,5,10,15,20,25,0};
   int price[] = {600,800,1000,1200,1400,1600,0};
   bool judge;
   while(cin >> n,n){
      sum = 0;
      while(n--){
         cin >> a[0] >> a[1] >> a[2] >> w;
         total = a[0] + a[1] + a[2];
         for(i=0;i<6;i++,judge = false){
            if(total > big[i]) judge = true;
            if(w > wai[i]) judge = true;
            if(!judge) break;
         }
         sum += price[i];
      }
      cout << sum << endl;
   }
}

C++: #include <bits/stdc++.h>
#define r(i,a,n) for(int i=a;i<n;i++)
#define R(i,a,n) for(int i=a;i>=n;i--)
using namespace std;
int main(){
	long int n,a,b,c,s,w;
	while(cin>>n,n){
		long int p=0;
		r(i,0,n){
		cin>>a>>b>>c>>w;
		s=a+b+c;
		if(s<=60&&w<=2)p+=600;
		else if(s<=80&&w<=5)p+=800;
		else if(s<=120&&w<=15)p+=1200;
		else if(s<=140&&w<=20)p+=1400;
		else if(s<=160&&w<=25)p+=1600;
	    }
	    cout<<p<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;
int price[6] = {600, 800, 1000, 1200, 1400, 1600};

void solve()
{
	int n;
	while(cin >> n, n)
	{
		int x, y, h, w;
		int pos1 = 0;
		int pos2 = 0;
		int sum = 0;
		while(n--)
		{
			cin >> x >> y >> h >> w;
			int size = x + y + h;
			if(size <= 60)
			{
				pos1 = 0;
			}
			else if(size <= 80)
			{
				pos1 = 1;
			}
			else if(size <= 100)
			{
				pos1 = 2;
			}
			else if(size <= 120)
			{
				pos1 = 3;
			}
			else if(size <= 140)
			{
				pos1 = 4;
			}
			else if(size <= 160)
			{
				pos1 = 5;
			}
			else
			{
				pos1 = 6;
			}

			if(w <= 2)
			{
				pos2 = 0;
			}
			else if(w <= 5)
			{
				pos2 = 1;
			}
			else if(w <= 10)
			{
				pos2 = 2;
			}
			else if(w <= 15)
			{
				pos2 = 3;
			}
			else if(w <= 20)
			{
				pos2 = 4;
			}
			else if(w <= 25)
			{
				pos2 = 5;
			}
			else
			{
				pos2 = 6;
			}
			if(pos1 < pos2)
			{
				swap(pos1, pos2);
			}
			if(pos1 == 6)
			{
				continue;
			}
			sum += price[pos1];
		}
		cout << sum << endl;
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include<iostream>

using namespace std;

char length(int in){
  if(in > 160) return 'Z';
  if(in > 140) return 'F';
  if(in > 120) return 'E';
  if(in > 100) return 'D';
  if(in > 80) return 'C';
  if(in > 60) return 'B';
  return 'A';
}

char weight(int in){
  if(in > 25) return 'Z';
  if(in > 20) return 'F';
  if(in > 15) return 'E';
  if(in > 10) return 'D';
  if(in > 5) return 'C';
  if(in > 2) return 'B';
  return 'A';
}

int price(char x){
  if(x == 'Z') return 0;
  if(x == 'A') return 600;
  if(x == 'B') return 800;
  if(x == 'C') return 1000;
  if(x == 'D') return 1200;
  if(x == 'E') return 1400;
  return 1600;
}
int main(){

  int n;
  while (cin >> n){
    if(n == 0) break;
    int sum = 0;
    for(int i = 0; i < n; i++){
      int x,y,h,w,len;
      cin >> x>>y>>h>>w;
      len = x+y+h;
      char judgel = length(len);
      char judgew = weight(w);
      char judge;
      if(judgel >= judgew) judge = judgel;
      else judge = judgew;

      sum += price(judge);

    }
    cout << sum << endl;
  }
  return 0;
}