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 <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
//#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

signed main() {
    int n;
    while(cin >> n, n){
        int x, y, h, w, ans = 0;
        rep(i, 0, n){
            cin >> x >> y >> h >> w;
            int size = -1, l = x + y + h;
            if(l <= 60 && w <= 2) size = 0;
            else if(l <= 80 && w <= 5) size = 1;
            else if(l <= 100 && w <= 10) size = 2;
            else if(l <= 120 && w <= 15) size = 3;
            else if(l <= 140 && w <= 20) size = 4;
            else if(l <= 160 && w <= 25) size = 5;
            //if(l > 160 || w > 25) size = -1;
            //o(size);
            if(size != -1) ans += (2*size + 6)*100;
        }
        cout << ans << endl;
    }
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
using namespace std;
int main(){
	
	int n;
	int x,y,h,w;
	
	while(cin>>n,n!=0){
		long long sum=0;
		for(int i=0;i<n;i++){
		cin>>x>>y>>h>>w;
			int s=0;
			long long big = x+y+h;
			if(big<=60)
				s=600;
			else if(big<=80)
				s=800;
			else if(big<=100)
				s=1000;
			else if(big<=120)
				s=1200;
			else if(big<=140)
				s=1400;
			else if(big<=160)
				s=1600;
			else
				s=0;
			if(s!=0){
			if(w<=2)
			s=max(s,600);
			else if(w<=5)
			s=max(s,800);
			else if(w<=10)
			s=max(s,1000);
			else if(w<=15)
			s=max(s,1200);
			else if(w<=20)
			s=max(s,1400);
			else if(w<=25)
			s=max(s,1600);
			else
			s=0;
			}
			sum+=s;
		}
		
		cout<<sum<<endl;
		
	}
	
	
	
}

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

int main() {
	int charge[7] = {600,800,1000,1200
	,1400,1600,0 };

	int n;
	int a, b, c, d;
	while (cin >> n, n) {
		int sum = 0;

		for (int i = 0; i < n; i++) {
			int flga, flgb;
			cin >> a >> b >> c >> d;
			int e = a + b + c;

			if (e <= 60) { flga = 0; }
			else if (e <= 80) { flga = 1; }
			else if (e <= 100) { flga = 2; }
			else if (e <= 120) { flga = 3; }
			else if (e <= 140) { flga = 4; }
			else if (e <= 160) { flga = 5; }
			else { flga = 6; }

			if (d <= 2) { flgb = 0; }
			else if (d <= 5) { flgb = 1; }
			else if (d <= 10) { flgb = 2; }
			else if (d <= 15) { flgb = 3; }
			else if (d <= 20) { flgb = 4; }
			else if (d <= 25) { flgb = 5; }
			else { flgb = 6; }
			
			int flgc = max(flga, flgb);
			sum += charge[flgc];
		}
		cout << sum << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
    vector<int> len;
    len.push_back(60);
    for (int i = 0; i < 5; i++) {
        len.push_back(len[i] + 20);
    }

    vector<int> widht;
    widht.push_back(2);
    widht.push_back(5);
    for (int i = 2; i <= 5; i++) {
        widht.push_back(widht[1] * i);
    }

    vector<int> price;
    price.push_back(600);
    for (int i = 0; i < 5; i++) {
        price.push_back(price[i] + 200);
    }

    int N;
    while (cin >> N, N) {
        int sum  = 0;
        for (int i = 0; i < N; i++) {
            int x, y, z, d;
            cin >> x >> y >> z >> d;

            for (int j = 0; j < 6; j++) {
                if (len[j] >= x + y + z && widht[j] >= d) {
                    sum += price[j];
                    break;
                }
            }
        }

        cout << sum << endl;
    }

    return 0;
}

C++: // 2011/02/19 Tazoe

#include <iostream>
using namespace std;

int main()
{
	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;
			int z = x+y+h;
			if(z<=60&&w<=2)
				sum += 600;
			else if(z<=80&&w<=5)
				sum += 800;
			else if(z<=100&&w<=10)
				sum += 1000;
			else if(z<=120&&w<=15)
				sum += 1200;
			else if(z<=140&&w<=20)
				sum += 1400;
			else if(z<=160&&w<=25)
				sum += 1600;
		}

		cout << sum << endl;
	}

	return 0;
}

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

C++: #include<stdio.h>
int main(){
	int a;
	while(scanf("%d",&a),a){
		int sum=0;
		for(int i=0;i<a;i++){
			int b,c,d,e;
			scanf("%d%d%d%d",&b,&c,&d,&e);
			int f=b+c+d;
			if(f<=60&&e<=2)sum+=600;
			else if(f<=80&&e<=5)sum+=800;
			else if(f<=100&&e<=10)sum+=1000;
			else if(f<=120&&e<=15)sum+=1200;
			else if(f<=140&&e<=20)sum+=1400;
			else if(f<=160&&e<=25)sum+=1600;
		}
		printf("%d\n",sum);
	}
}

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

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

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

int slove(int sum, int w){
  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(){
  int n;
  while(cin >> n){
    if(n==0) break;
    int price=0;
    for(int i=0; i<n; i++){
      int x,y,h,w;
      cin >> x >> y >> h >> w;
      int sum=x+y+h;
      
      price += slove(sum,w);
    }
    cout << price << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)

int main(){
    int n;
	int size[] = {0, 60, 80, 100, 120, 140, 160};
	int weight[] = {0, 2, 5, 10, 15, 20, 25};
	int cost[] = {600, 800, 1000, 1200,	1400, 1600, 0};
	while(cin >> n, n) {
		int ret = 0;
		rep(i,n) {
			int x, w, a = 0;
			rep(j,3) {
				cin >> x;
				a += x;
			}
			cin >> w;
			for(int j = 6; j >= 0; --j) { 
				if(size[j] < a) {
					ret += cost[j];
					break;
				}
				if(weight[j] < w) {
					ret += cost[j];
					break;
				}
			}
		}
		cout << ret << endl;
	}
    return 0;
}