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 <iostream>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(n==0) break;
		const int SIZ[]={60,80,100,120,140,160};
		const int W[]={2,5,10,15,20,25};
		const int FEE[]={600,800,1000,1200,1400,1600,0};
		int x,y,h,w,sum=0;
		for(int i=0;i<n;++i){
			cin>>x>>y>>h>>w;
			int j,size = max(h,max(x,y));
			for(j=0;j<6;++j)if(size<=SIZ[j]&&w<=W[j]) break;
			sum+=FEE[j];
		}
		cout<<sum<<"\n";
	}
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	int size[]={60,80,100,120,140,160,INT_MAX};
	int weight[]={2,5,10,15,20,25,INT_MAX};
	int price[]={600,800,1000,1200,1400,1600,0};
	for(int n;cin>>n,n;){
		int sum=0;
		rep(i,n){
			int x,y,h,w; cin>>x>>y>>h>>w;
			sum+=price[max(lower_bound(size,size+6,x+y+h)-size,lower_bound(weight,weight+6,w)-weight)];
		}
		cout<<sum<<endl;
	}
	
	return 0;
}

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

C++: #include <bits/stdc++.h>
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 s = x+y+h;
            if(160 < s || 25 < w);
            else if(140 < s || 20 < w) ans += 1600;
            else if(120 < s || 15 < w) ans += 1400;
            else if(100 < s || 10 < w) ans += 1200;
            else if(80 < s || 5 < w) ans += 1000;
            else if(60 < s || 2 < w) ans += 800;
            else ans += 600;
        }
        cout << ans << endl;
    }
}

C++: #include <iostream>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(n==0) break;
		const int SIZ[]={60,80,100,120,140,160};
		const int W[]={2,5,10,15,20,25};
		const int FEE[]={600,800,1000,1200,1400,1600,0};
		int x,y,h,w,sum=0;
		for(int i=0;i<n;++i){
			cin>>x>>y>>h>>w;
			int j,size=x+y+h;
			for(j=0;j<6;++j)if(size<=SIZ[j]&&w<=W[j]) break;
			sum+=FEE[j];
		}
		cout<<sum<<"\n";
	}
	return 0;
}

C++: #define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int ms[]={3,6,11,16,21,26};
int main(){
	int n,x,y,z,m,s;
	while(cin>>n,n){
		s=0;
		rep(i,n){
			cin>>x>>y>>z>>m;
			rep(j,6)if(x+y+z<61+j*20&&m<ms[j]){
				s+=600+200*j; break;
			}
		}
		cout<<s<<endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>

using namespace std;

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

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

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

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int t[] = {60, 80, 100, 120, 140, 160};
int v[] = {2, 5, 10, 15, 20, 25};
int c[] = {600, 800, 1000, 1200, 1400, 1600};

int main()
{
    for(int n, m; cin >> n && n && !(m = 0); cout << m << endl) while(n--)
	{
		int x, y, h, w;
		cin >> x >> y >> h >> w;
		
		rep(j, 6) if(x + y + h <= t[j] && w <= v[j])
		{
			m += c[j];
			break;
		}
	}
}

C++: #include <iostream>

using namespace std;

int main(void){

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