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<stdio.h>

int main(void){
	int x,y,z,w,n,i;
	int sum,l;

	while(0==0){
		scanf("%d",&n);
		if(n==0)break;
		sum=0;
		for(i=0;i<n;i++){
		  scanf("%d %d %d %d",&x,&y,&z,&w);
		  l=x+y+z;
		  if(l<=60 && w<=2) sum+=600;
		  else if(l<=80 && w<=5) sum+=800;
		  else if(l<=100 && w<=10) sum+=1000;
		  else if(l<=120 && w<=15) sum+=1200;
		  else if(l<=140 && w<=20) sum+=1400;
		  else if(l<=160 && w<=25) sum+=1600;
		}
		printf("%d\n",sum);
	}
	return 0;
}

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

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

C++: #include<iostream>
#include<vector>
using namespace std;
int main() {
	vector<int>l;
	int n;
	int a, b, c, x;
	while (true){
		cin >> n;
		if (n == 0)break;
		int sum = 0;
		for (int i = 0; i < n; i++){
			cin >> a >> b >> c >> x;
			a += b + c;
			if		(a <= 60 && x <= 2)sum += 600;
			else if (a <= 80 && x <= 5)sum += 800;
			else if (a <= 100 && x <= 10)sum += 1000;
			else if (a <= 120 && b <= 15)sum += 1200;
			else if (a <= 140 && b <= 20)sum += 1400;
			else if (a <= 160 && b <= 25)sum += 1600;
			l.push_back(sum);
		}
	}
	for (int i : l) 
		cout << i << endl;
	getchar();
}

C++: #include <stdio.h>


int main(void){
    int datas;
    int x,y,h,w,size;
    int fee;
    
    while (scanf("%d", &datas)){
        if (datas==0) break;
        fee=0;
        for (int i=0; i<datas; i++){
            scanf("%d %d %d %d", &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;
        }
        printf("%d\n", fee);
    }
    return 0;
}

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)
	{
		int ans = 0,x,y,h,w;

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

			int a = x + y + h;

			if(20 < w && w <= 25 && a <= 160) ans += 1600;
			else if(15 < w && a <= 140) ans += 1400;
			else if(10 < w && a <= 120) ans += 1200;
			else if(5 < w && a <= 100) ans += 1000;
			else if(2 < w && a <= 80) ans += 800;
			else if(a <= 60) ans += 600;
		}

		cout << ans << endl;
	}
	return 0;
}

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

int main() {
	ll n;
	while (scanf("%lld", &n), n) {
		ll sum = 0;
		rep(i, n) {
			ll x, y, h, w; scanf("%lld%lld%lld%lld", &x, &y, &h, &w);
			x += y + h;
			if (x <= 60 && w <= 2)sum += 600;
			else if (x <= 80 && w <= 5)sum += 800;
			else if (x <= 100 && w <= 10)sum += 1000;
			else if (x <= 120 && w <= 15)sum += 1200;
			else if (x <= 140 && w <= 20)sum += 1400;
			else if (x <= 160 && w <= 25)sum += 1600;
		}
		printf("%lld\n", sum);
	}
}

C++: #include<iostream>
using namespace std;
int main(void){
    while(true){
        int ans=0,n;
        cin >> 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;
    }
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)
vector<int> sz,w,v;
int main()
{
	for(int i=60;i<=160;i+=20){sz.pb(i);v.pb(i*10);}
	w.pb(2);
	for(int i=1;i<=5;i++)w.pb(i*5);
	while(1)
	{
		int n;
		int ans = 0;
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<n;i++)
		{
			int x,y,h,we;
			scanf("%d %d %d %d",&x,&y,&h,&we);
			int s = x+y+h;
			for(int j=0;j<6;j++)
			{
				if(s<=sz[j]&&we<=w[j])
				{
					ans+=v[j];
					break;
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

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

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

C++: #include<iostream>
using namespace std;
int main(){
  int x,y,h,w,n,size,money=0;
  while(1){
    cin >> n;
    if(n==0){
      break;
    }
    money=0;
    for(int i=0;i<n;i++){
      cin >> x >> y >> h >> w;
      size=x+y+h;

      if(size<=60 && w<=2){
	money+=600;
      }
      else if(size<=80 && w<=5){
	money+=800;
      }
      else if(size<=100 && w<=10){
	money+=1000;
      }
      else if(size<=120 && w<=15){
	money+=1200;
      }
      else if(size<=140 && w<=20){
	money+=1400;
      }
      else if(size<=160 && w<=25){
	money+=1600;
      }
    }
    cout << money << endl;
  }
  return (0);
}