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 <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
using namespace std;
int main(void){
    int n,sum,a,b,c,size,w;
 
    while(true){
        cin >> n;
        if(n == 0)break;
 
        sum = 0;
 
        for(int i = 0; i < n; i++){
            cin >> 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;
            }
        }
 
        cout << sum << endl;
    }
 
    return 0;
}

C++: #include<cstdio>
using namespace std;
#define rep(i,j) for(int i=0;i<j;i++)
int main(){
    int n;
    while(scanf("%d",&n),n){
        int ans = 0;
        rep(i,n){
            int x,y,h,w;
            scanf("%d%d%d%d",&x,&y,&h,&w);
            int size = x+y+h;
            (size<=60&&w<=2) ? ans+=600 : (size<=80&&w<=5) ? ans+=800 : (size<=100&&w<=10) ? ans+=1000 : (size<=120&&w<=15) ? ans+=1200 : (size<=140&&w<=20) ? ans+=1400 : (size<=160&&w<=25) ? ans+=1600 :ans+=0;
        }
        printf("%d\n",ans);
    }
    return 0;
}

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

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

int checkSize(int x, int y, int h);
int checkWeight(int w);

int main()
{
    int n;
    while(1)
    {
        int ans = 0;
        cin >> n;
        if(n == 0)
        {
            break;
        }
        for(int i=0; i<n; i++)
        {
            int x;
            int y;
            int h;
            int w;
            int rank;
            cin >> x >> y >> h >> w;
            rank = std::max(checkSize(x, y, h),checkWeight(w));
            if(rank < 6)
            {
                ans += fee_list[rank];
            }
        }
        cout << ans << endl;
    }
    return 0;
}

int checkSize(int x, int y, int h)
{
    int total = x + y + h;
    int ret_value;

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

int checkWeight(int w)
{
    int ret_value;

    if(w <= 2)
    {
        ret_value = 0;
    }
    else if(w <= 5)
    {
        ret_value = 1;
    }
    else if(w <= 10)
    {
        ret_value = 2;
    }
    else if(w <= 15)
    {
        ret_value = 3;
    }
    else if(w <= 20)
    {
        ret_value = 4;
    }
    else if(w <= 25)
    {
        ret_value = 5;
    }
    else
    {
        ret_value = 6;
    }
    return ret_value;
}

C++: #include<iostream>

using namespace std;

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

C++: // 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 <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define all(a) (a).begin(), (a).end()

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

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

C++: #include <bits/stdc++.h>

using namespace std;

const int BaseMoney = 600;

int judge(const int sumLength, int w) {
	int index;

	if (w <= 2 && sumLength <= 60) {
		index = 0;
	}
	else if (w <= 5 && sumLength <= 80) {
		index = 1;
	}
	else if (w <= 10 && sumLength <= 100) {
		index = 2;
	}
	else if (w <= 15 && sumLength <= 120) {
		index = 3;
	}
	else if (w <= 20 && sumLength <= 140) {
		index = 4;
	}
	else if (w <= 25 && sumLength <= 160) {
		index = 5;
	}
	else {
		return 0;
	}

	return BaseMoney + 200 * index;
}

int main(void) {
	int n, x, y, h, w, sumLength, sum;

	while (cin >> n, n) {
		sum = 0;
		for (int i = 0; i < n; i++) {
			cin >> x >> y >> h >> w;

			sumLength = x + y + h;
			sum += judge(sumLength, w);
		}
		cout << sum << endl;
	}

	return 0;
}