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<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  int S[]={60,80,100,120,140,160};
  int W[]={2,5,10,15,20,25};
  int M[]={600,800,1000,1200,1400,1600};
  while(cin >> n , n){
    int sum = 0;
    for(int i=0;i<n;i++){
      int x,y,h,w;
      cin >> x >> y >> h >> w;
      int size = x + y + h;
      if(size > 160 || w > 25) continue;
      for(int i=0;i<6;i++){
	if(size <= S[i] && w <= W[i]){
	  sum += M[i];
	  break;
	}
      }
    }
    cout << sum << endl;
  }
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int O[6]={60,80,100,120,140,160};
int W[6]={2,5,10,15,20,25};
int R[6]={600,800,1000,1200,1400,1600};
int main(){
	int n;
	while(cin>>n,n){
		int sum=0;
		rep(i,n){
			int a,b,c,w;
			cin>>a>>b>>c>>w;
			int o=a+b+c;
			rep(i,6)if(o<=O[i]&&w<=W[i]){sum+=R[i];break;}
		}
		cout<<sum<<endl;
	}
}

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

int main(){
    int n,x,y,h,w;
    
    while(cin >> n,n){
        int tc = 0;
        while(n--){
            cin >> x >> y >> h >> w;
            
            int tc1 = 0,tc2 = 0,size = x+y+h;
            bool tf1 = false,tf2 = false;
            
            if(size <= 60) tc1 = 600;
            else if(size <= 80) tc1 = 800;
            else if(size <= 100) tc1 = 1000;
            else if(size <= 120) tc1 = 1200;
            else if(size <= 140) tc1 = 1400;
            else if(size <= 160) tc1 = 1600;
            else tf1 = true;
            
            if(w <= 2) tc2 = 600;
            else if(w <= 5) tc2 = 800;
            else if(w <= 10) tc2 = 1000;
            else if(w <= 15) tc2 = 1200;
            else if(w <= 20) tc2 = 1400;
            else if(w <= 25) tc2 = 1600;
            else tf2 = true;
            
            if(tf1||tf2) continue;
            else tc += max(tc1,tc2);
        }
        cout << tc << endl;
    }
    
    return 0;
}

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

using namespace std;
 
int main()
{
    int n, x, y, h, w;
    while (cin >> n, n) {
        int tc = 0;
        while (n--) {
            cin >> x >> y >> h >> w;
             
            int tc1 = 0, tc2 = 0, size = x+y+h;
            bool tf1 = false, tf2 = false;
             
            if (size <= 60) tc1 = 600;
            else if (size <= 80) tc1 = 800;
            else if (size <= 100) tc1 = 1000;
            else if (size <= 120) tc1 = 1200;
            else if (size <= 140) tc1 = 1400;
            else if (size <= 160) tc1 = 1600;
            else tf1 = true;
             
            if (w <= 2) tc2 = 600;
            else if (w <= 5) tc2 = 800;
            else if (w <= 10) tc2 = 1000;
            else if (w <= 15) tc2 = 1200;
            else if (w <= 20) tc2 = 1400;
            else if (w <= 25) tc2 = 1600;
            else tf2 = true;
             
            if (tf1||tf2) continue;
            else tc += max(tc1, tc2);
        }
        cout << tc << endl;
    }
    return 0;
}

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

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

int f(int size){
	if( size <= 60 )
		return 600;
	else if( size <= 80 )
		return 800;
	else if( size <= 100 )
		return 1000;
	else if( size <= 120 )
		return 1200;
	else if( size <= 140 )
		return 1400;
	else if( size <= 160 )
		return 1600;
	
	return 0;
}

int g(int w){
	if( w <= 2 )
		return 600;
	else if( w <= 5 )
		return 800;
	else if( w <= 10 )
		return 1000;
	else if( w <= 15 )
		return 1200;
	else if( w <= 20 )
		return 1400;
	else if( w <= 25 )
		return 1600;

	return 0;
}

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

		for(int i=0 ; i < n ; i++ ){
			cin >> x >> y >> h >> w;
			int size = x+y+h;
			if( f(size) && g(w) ){
				sum += max( f(size) , g(w) );
			}
		}
		cout << sum << endl;
	}
}

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

using namespace std;

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

	return 0;
}

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

int main(){
  int i,j,n,a[3][6];
  a[0][0] = 60;
  a[1][0] = 0;
  a[2][0] = 600;
  for(i=1;i<6;i++){
    a[0][i] = a[0][i-1] + 20;
    a[1][i] = a[1][i-1] + 5;
    a[2][i] = a[2][i-1] + 200;
  }
  a[1][0] = 2;

  while(1){
    cin >> n;
    if(n == 0) break;
    int x,y,h,w,sum=0;
    for(int t=0;t<n;t++){
      cin >> x >> y >> h >> w;
      for(i=0;i<6;i++){
	if(x + y + h <= a[0][i] && w <= a[1][i]){
	  sum += a[2][i];
	  break;
	}
      }
    }
    cout << sum << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
	int n,x,y,h,w,a;
	while(cin>>n,n){
		int ans=0;
		for(int i=0;i<n;i++){
			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;
	}
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int n;
	cin >> n;
	if(n == 0) break;
	ll ans = 0;
	int m;
	REP(i,n){
	    int x,y,h,w;
	    cin >> x >> y >> h >> w;
	    int s = x + y + h;
	    m = 0;
	    if( s > 160) continue;
	    else if(s > 140)  m = 1400;
	    else if(s > 120) m = 1200;
	    else if(s > 100) m = 1000;
	    else if(s > 80) m = 800;
	    else m = 600;

	    if(w > 25) continue;
	    else if(w > 20) m = max(m,1600);
	    else if(w > 15) m = max(m,1400);
	    else if(w > 10) m = max(m,1200);
	    else if(w > 5)  m = max(m,1000);
	    else if(w > 2)  m = max(m,800);
	    else m = max(m,600);
	    ans += m;
	}
	cout << ans << endl;
    }
    return 0;
}