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 <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
//#include <utility>
#include <set>
#include <iostream>
//#include <memory>
#include <string>
#include <vector>
#include <algorithm>
//#include <functional>
#include <sstream>
//#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
//#include <cctype>
#include <cstring>
//#include <ctime>
#include <iterator>
#include <bitset>
//#include <numeric>
//#include <list>
//#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;

void mainmain(){
	int n;
	while(cin>>n,n){
		ll ans=0;
		rep(i,n){
			int a,b,c,d;
			cin>>a>>b>>c>>d;
			int M=a;
			M=max(M,max(b,c));
			if(160<M||d>25) continue;
			if(140<M||d>20) ans+=1600;
			else if(120<M||d>15) ans+=1400;
			else if(100<M||d>10) ans+=1200;
			else if(80<M||d>5) ans+=1000;
			else if(60<M||d>2) ans+=800;
			else ans+=600;
		}
		cout<<ans<<endl;
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

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;
		}
		cout << price << endl;
	}
	return 0;
}

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 += 10;
      else if(x<=120 && w<=15) 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++: #include <iostream>
using namespace std;
int main(void){
    // Your code here!
#define MAX 10100
    int n; //荷物の個数
    int x[MAX], y[MAX], h[MAX], w[MAX]; //荷物の縦の長さ、横の長さ、高さ、重量

    while(true){
        cin >> n;
        if(n == 0) break;
        
        int l[MAX]; //荷物の大きさ
        for(int i = 0; i < n; i++){
            cin >> x[i] >> y[i] >> h[i] >> w[i];
            l[i] = x[i] + y[i] + h[i];
        }
        
        int sum = 0; //荷物の料金の総計
        for(int i = 0; i < n; i++){
            if(l[i] <= 60){
                if(w[i] <= 2) sum += 600;
                else if(w[i] <= 5) sum += 800;
                else if(w[i] <= 10) sum += 1000;
                else if(w[i] <= 15) sum += 1200;
                else if(w[i] <= 20) sum += 1400;
                else if(w[i] <= 25) sum += 1600;
                else sum += 0;
            }
            else if(60 < l[i] && l[i] <= 80){
                if(w[i] <= 5) sum += 800;
                else if(w[i] <= 10) sum += 1000;
                else if(w[i] <= 15) sum += 1200;
                else if(w[i] <= 20) sum += 1400;
                else if(w[i] <= 25) sum += 1600;
                else sum += 0;
            }
            else if(80 < l[i] && l[i] <= 100){
                if(w[i] <= 10) sum += 1000;
                else if(w[i] <= 15) sum += 1200;
                else if(w[i] <= 20) sum += 1400;
                else if(w[i] <= 25) sum += 1600;
                else sum += 0;
            }
            else if(100 < l[i] && l[i] <= 120){
                if(w[i] <= 15) sum += 1200;
                else if(w[i] <= 20) sum += 1400;
                else if(w[i] <= 25) sum += 1600;
                else sum += 0;
            }
            else if(120 < l[i] && l[i] <= 140){
                if(w[i] <= 20) sum += 1400;
                else if(w[i] <= 25) sum += 1600;
                else sum += 0;
            }
            else if(140 < l[i] && l[i] <= 160){
                if(w[i] <= 25) sum += 1600;
                else sum += 0;
            }
            else sum += 0;
        }
        cout << sum << endl;
    }
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#define pb push_back
#define f first
#define s second

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