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>
#include <sstream>
#include <fstream>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>

using namespace std;
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v){
    os << "{ ";
    for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
        os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", ");
    os << " }";
    return os;
}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
#define vv(type,w,h,init) vector<vector<type>>(h,vector<type>(w,init))
typedef vector<string> vs;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long ul;
typedef unsigned long long ull;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define mp make_pair

string const resstr[] = {"Impossible","Possible","No","Yes"};

int const rs[]={60,80,100,120,140,160}; 
int const rw[]={2,5,10,15,20,25}; 
int const p[]={600,800,1000,1200,1400,1600};

int main(){
    int n;
    while(cin>>n,n){
        int ans = 0;
        rep(i,n){
            int x,y,h,w; cin>>x>>y>>h>>w;
            int s=x+y+h;
            int t=0;
            if(s>rs[5]||w>rw[5]) continue;
            rep(j,6){
                if(rs[j]>s && rw[j]>w){
                    break;
                }
                t=j;
            }
            ans += p[t];
        }
        cout << ans << 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;
      x += y + h;
      if(x<=60 && w<=2) ans += 6;
      else if(x<=80 && w<=5) ans += 8;
      else if(x<=100 && w<=10) ans += 12;
      else if(x<=140 && w<=20) ans += 14;
      else if(x<=160 && w<=25) ans += 16;
    }
    cout << ans*100 << endl;
  }
  return 0;
}

C++: //32
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(int n;cin>>n,n;){
    int ans=0;
    while(n--){
      int s[]={60,80,100,120,140,160};
      int wt[]={2,5,10,15,20,25};
      int p[]={600,800,1000,1200,1400,1600,0};
      int x,y,h,w;
      cin>>x>>y>>h>>w;
      ans+=p[max(lower_bound(s,s+6,x+y+h)-s,lower_bound(wt,wt+6,w)-wt)];
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

//container util
//------------------------------------------
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)

//repetition
//------------------------------------------
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  loop(i,0,n)

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

// output vector
// ------------------------------------------
namespace std {
    template<typename T> ostream & operator<<(ostream& os, vector<T> const& v){
        for(auto it=v.begin(); it!=v.end(); ++it){
            os << *it << (it+1==v.end() ? "" : ",");
        }
        return os;
    }
}

//clear memory
#define clr(a) memset((a), 0 ,sizeof(a))

int lcm(int a,int b){
   return a*b/__gcd(a,b);
}
 
vb pn((int)1e4+10); 
void prime_number(int n){
   fill(all(pn),true);
   pn[0]=false;pn[1]=false;
   loop(i,2,n/2+1){
      if(!pn[i]) continue;
      for(int j=2;i*j<=n;j++){
         pn[i*j]=false;
      }
   }
}

int main(){
   int n,ans,x,y,h,w;
   
   while(cin>>n){
      if(n==0) break; ans=0;
      
      rep(i,n){
         cin >> x >> y >> h >> w;
         if(x+y+h<61&&w<3) ans+=600;
         else if(x+y+h<81&&w<6) ans+=800;
         else if(x+y+h<101&&w<11) ans+=1000;
         else if(x+y+h<121&&w<16) ans+=1200;
         else if(x+y+h<141&&w<21) ans+=1400;
         else if(x+y+h<161&&w<26) ans+=1600;
         else continue;
      }
      
      cout<<ans<<endl;
   }
   
   return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	const int sizes[] = {60,80,100,120,140,160};
	const int weights[] = {2,5,10,15,20,25};
	const int fee[] = {600,800,1000,1200,1400,1600};
	while(true){
		long long int ans=0;
		int n;
		scanf("%d", &n);
		if( n == 0 )
			break;
		for(int i = 0; i < n; ++i){
			int x,y,h,w;
			int size;
			scanf("%d%d%d%d", &x, &y, &h, &w);
			size = x + y + h;
			for(int k = 0; k < sizeof(sizes)/sizeof(*sizes); ++k){
				if( size <= sizes[k] && w <= weights[k] ){
					ans += fee[k];
					break;
				}
			}
		}
		printf("%lld\n", ans);
	}
}

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

int main() {

  int n;
  int x,y,h,w;
  int r1[6] = {60,80,100,120,140,160};
  int r2[6] = {2,5,10,15,20,25};
  int r3[6] = {600,800,1000,1200,1400,1600};
  
  while(1){  
    cin >> n;
    if(n == 0) break;
    int sum = 0;
    
    for(int i=0;i<n;i++) {     

      cin >> x >> y >> h >> w;
      int size = x + y + h;
      
      for(int j=0;j<6;j++) {
	if(size <= r1[j] && w <= r2[j]){
	  sum += r3[j];
	  break;
	}
      }
     
    }

    cout << sum << endl;

  }

  return 0;

}

C++: #include <stdio.h>

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

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

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