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 n, x, y, z, t, w;
int main() {
	while(~scanf("%d", &n), n) {
		int ret = 0;
		for(int i = 0; i < n; i++) {
			scanf("%d%d%d%d", &x, &y, &z, &w); t = x + y + z;
			if(t <= 60 && w <= 2) ret += 600;
			else if(t <= 80 && w <= 5) ret += 800;
			else if(t <= 100 && w <= 10) ret += 1000;
			else if(t <= 120 && w <= 15) ret += 1200;
			else if(t <= 140 && w <= 20) ret += 1400;
			else if(t <= 160 && w <= 25) ret += 1600;
		}
		printf("%d\n", ret);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define r(i,a,n) for(i=a;i<n;i++)
#define R(i,a,n) for(int i=a;i>=n;i--)
using namespace std;
int main(){
	long int n,a,b,c,s,w;
	while(cin>>n,n){
		long int p=0;
		r(i,0,n){
		cin>>a>>b>>c>>w;
		s=a+b+c;
		if(s<=60&&w<=2)p+=600;
		else if(s<=80&&w<=5)p+=800;
		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;
	}
	return 0;
}

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

C++: #include<iostream>
using namespace std;
int main(){
  int x,y,h,w;
  int n;
  int ans;
  int s[6] = {60,80,100,120,140,160};
  int wh[6] = {2,5,10,15,20,25};
  while(cin >> n){
    if(n==0) break;
    ans = 0;
    for(int i=0;i<n;i++){
      cin >> x >> y >> h >> w;
      h = x + y + h;
      //cout << h << endl;
	for(int i=5;i>=0;i--){
	  if(i==0) h = 0;
	  else if(i==5&&s[i]<h){
	    h = 7;
	    break;
	  }
	  else if(s[i-1]<h&&h<=s[i]){
	    h = i;
	    break;
	  }
	}
	for(int i=5;i>=0;i--){
	  if(i==0) w = 0;
	  else if(i==5&&wh[i]<w){
	    w = 7;
	    break;
	  }
	  else if(wh[i-1]<w&&w<=wh[i]){
	    w = i;
	    break;
	  }
	}
	if(h<w) h = w;
	//cout << h << endl;
	switch(h){
	case 0:
	  ans += 600;
	  break;
	case 1:
	  ans += 800;
	  break;
	case 2:
	  ans+= 1000;
	  break;
	case 3:
	  ans += 1200;
	  break;
	case 4:
	  ans += 1400;
	  break;
	case 5:
	  ans += 1600;
	  break;
	}
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

int n;
int ans, x, y, h, w;
int _size;


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

	return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

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

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

int main()
{
  int n;
  while( cin >> n, n ) {
    int a, b, c, d;
    int sum = 0;

    while( n-- ) {
      int size = 0;
      cin >> a >> b >> c >> d;
      size += a + b + c;
      
      if( size <= 60 && d <= 2 ) {
	sum += 600;
      } 
      else if( size <= 80 && d <= 5 ) {
	sum += 800;
      }
      else if( size <= 100 && d <= 10 ) {
	sum += 1000;
      }
      else if( size <= 120 && d <= 15 ) {
	sum += 1200;
      }
      else if( size <= 140 && d <= 20 ) {
	sum += 1400;
      }
      else if( size <= 160 && d <= 25 ) {
	sum += 1600;
      }
    }

    cout << sum << endl;
  }

}

C++: #include<iostream>

using namespace std;

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