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,n){
		while (n--){
			cin >> x >> y >> h >> w;
			ans += Yen(x, y, h, w);
		}
		cout << ans << endl;
		ans = 0;
	}
	return 0;
}

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+w+h || weight[j] < w){
                    continue;
                }
                else{
                    sum+= fee[j];
                    break;
                }
            }
            
        }
        
        cout << sum << endl;
    }
    
    return 0;
}

C++: #include <iostream>

using namespace std;

int cost[6] = {600, 800, 1000, 1200, 1400, 1600};

int main(int argc, char **argv)
{
	int w, x, y, z, n, sum;
	
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		sum = 0;
		for(int i = 0; i < n; i++){
			cin >> x >> y >> z >> w;
			
			x = (x > y && x > z)? x : ((y > x && y > z)? y : z);
			if(w > 25 || x > 160){
				continue;
			}
			
			if(x <= 60){
				y = 0;
			} else {
				if(x%20 == 0){
					x--;
				}
				y = (int)(x/20) - 2;
			}
			
			if(w <= 2){
				z = 0;
			} else {
				if(w%5 == 0){
					w--;
				}
				z = (int)(w/5)+1;
			}
			sum += cost[((y < z)? z : y)];
		}
		cout << sum << endl;
	}
	
	return 0;
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define MP make_pair

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

		REP(i, n) {
			int x, y, h, w;
			scanf("%d %d %d %d", &x, &y, &h, &w);

			int s = x + y + h;
			int size1 = ceil((s - 60) / 20.0);
			if (size1 > 5) continue;
			if (size1 < 0) size1 = 0;

			int dw[] = {2, 5, 10, 15, 20, 25};
			int size2 = 0;
			REP(i, 6) if (w > dw[i]) size2++;
			if (size2 > 5) continue;

			ans += 600 + 200*max(size1, size2);
		}
		cout << ans << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

int main(int argc, char **argv)
{
	long long int w, x, y, z, n, sum;
	
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		sum = 0;
		for(int i = 0; i < n; i++){
			cin >> x >> y >> z >> w;
			
			x = x + y + z;
			if(w > 25 || x > 160){
				continue;
			}
			
			y = z = 0;
			for(int i = 0; i < 6; i++){
				if(x <= sc[i]){
					y = i;
					break;
				}
			}
			
			for(int i = 0; i < 6; i++){
				if(w <= we[i]){
					z = i;
					break;
				}
			}
			
			sum += cost[((y < z)? z : y)];
		}
		cout << sum << endl;
	}
	
	return 0;
}

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

int main(){
	int fee = 0;
	int x, y, h, w;
	int n;
	int size;

	while(cin >> n, n){
		fee = 0;
		for(int l=0; l < n; l++){
			cin >> x >> y >> h >> w;
			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;
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	int n;
	while(cin >> n && n)
	{
		long long ans = 0;
		int x,y,h,w;

		rep(i,n)
		{
			cin >> x >> y >> h >> w;

			int a = x + y + h;
			
			if(a <= 60 && w <= 2) ans += 600;
			else if(a <= 80 && w <= 5) ans += 800;
			else if(a <= 100 && w <= 10) ans += 1000;
			else if(a <= 120 && w <= 15) ans += 1200;
			else if(a <= 140 && w <= 20) ans += 1400;
			else if(a <= 160 && w <= 25) ans += 1600;	
		}
		cout << ans << endl;
	}
	return 0;
}

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

C++: /*
 * 0160.cpp
 *
 *  Created on: 2011/07/29
 *      Author: isa
 */

#include <iostream>

using namespace std;

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

int main(void){
	int n,x,y,z,w;
	while(cin >> n && n){
		int ret=0;
		for(int i=0;i<n;i++){
			cin>>x>>y>>z>>w;
			ret += chk(x+y+z,w);
		}
		cout << ret << endl;
	}
}