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++: // #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;

#define MP make_pair
#define fastIO	cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c)	for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
//#define foreach_it(type,it,c) for(type::iterator it=c.begin(); it!=c.end(); ++it)
// fast?
#define foreach_it(type,it,c) for(type::iterator it=c.begin(), c_end=c.end(); it!=c_end; ++it)

int Yen(int x, int y, int h, int w){
	int ret = 0;
	int inSize = x + y + h;
	int inWeight = w;
	// C++11
	vector<pair<int, int> > size_weight_List
	{MP(60,2),MP(80,5),MP(100,10),MP(120,15),MP(140,20),MP(160,25)};
	VI feeList{ 600, 800, 1000, 1200, 1400, 1600 };

	FOR(i, 0, size_weight_List.size()){
		if (inSize <= size_weight_List[i].first && inWeight <= size_weight_List[i].second){
			ret = feeList[i];
			break;
		}
	}
	return ret;
}

int main(){
	int n;
	int x, y, h, w;
	long long ans = 0;
	fastIO;
	
	while (cin >> n){
		while (n--){
			cin >> x >> y >> h >> w;
			ans += Yen(x, y, h, w);
		}
		cout << ans << endl;
		ans = 0;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> P;

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) break;

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

    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

int main(){
	int N;
	while(cin>>N,N){
		int ans = 0;
		for(int i=0;i<N;i++){
			int X,Y,H,W; cin>>X>>Y>>H>>W;
			int b = X+Y+H;
			if(b<=60 && W<=2) ans += 600;
			else if(b<=80 && W<=5) ans += 800;
			else if(b<=100 && W<=10) ans += 1000;
			else if(b<=120 && W<=15) ans += 1200;
			else if(b<=140 && W<=20) ans += 1400;
			else if(b<=160 && W<=25) ans += 1600;
		}
		printf("%d\n",ans);
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int size[] = {60, 80, 100, 120, 140, 160};
    int weight[] = {2, 5, 10, 15, 20, 25};
    int value[] = {600, 800, 1000, 1200, 1400, 1600, 0};

    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        int ret = 0;
        while(--n >= 0){
            int x, y, h, w;
            cin >> x >> y >> h >> w;
            int i = lower_bound(size, size+6, x+y+h) - size;
            int j = lower_bound(weight, weight+6, w) - weight;
            ret += value[max(i, j)];
        }
        cout << ret << endl;
    }
}

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

int main(void)
{
	int n;
	while (cin >> n, n){
		int x, y, h, w;
		int ret = 0;
		for (int i = 0; i < n; ++i)
		{
			cin >> x >> y >> h >> w;
			int max_type = 0, sum = x + y + h;
			if (sum <= 60) max_type = 1;
			else if (sum <= 80) max_type = 2;
			else if (sum <= 100) max_type = 3;
			else if (sum <= 120) max_type = 4;
			else if (sum <= 140) max_type = 5;
			else if (sum <= 160) max_type = 6;
			else max_type = 7;

			if (w <= 2) max_type = max(max_type, 1);
			else if (w <= 5) max_type = max(max_type, 2);
			else if (w <= 10) max_type = max(max_type, 3);
			else if (w <= 15) max_type = max(max_type, 4);
			else if (w <= 20) max_type = max(max_type, 5);
			else if (w <= 25) max_type = max(max_type, 6);
			else max_type = 7;

			if (max_type == 1) ret += 600;
			else if (max_type == 2) ret += 800;
			else if (max_type == 3) ret += 1000;
			else if (max_type == 4) ret += 1200;
			else if (max_type == 5) ret += 1400;
			else if (max_type == 6) ret += 1600;
		}

		cout << ret << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

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