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++: /*
	0160:Delivery Fee
*/

#include	<iostream>

using namespace std;

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

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

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

C++: #include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)

int main(){
    int n;
	int size[] = {0, 60, 80, 100, 120, 140, 160};
	int weight[] = {0, 2, 5, 10, 15, 20, 25};
	int cost[] = {600, 800, 1000, 1200,	1400, 1600, 0};
	while(cin >> n, n) {
		int ret = 0;
		rep(i,n) {
			int x, w, a = 0;
			rep(j,3) {
				cin >> x;
				a += x;
			}
			cin >> w;
			for(int j = 6; j > 0; --j) { 
				if(size[j] < a) {
					ret += cost[j];
					break;
				}
				if(weight[j] < w) {
					ret += cost[j];
					break;
				}
			}
		}
		cout << ret << endl;
	}
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
    int n,a,b,c,w;
	while(cin>>n,n){
		long int p=0;
		while(n--){
		cin>>a>>b>>c>>w;
		int 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;else;
	    }
	    cout<<p<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=(int)(n)-1; i>=0; i--)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int size(int n) {
  if(n<=60) return 0;
  if(n<=80) return 1;
  if(n<=100) return 2;
  if(n<=120) return 3;
  if(n<=140) return 4;
  if(n<=160) return 5;
  return 6;
}

int weight(int n) {
  if(n<=2) return 0;
  if(n<=5) return 1;
  if(n<=10) return 2;
  if(n<=15) return 3;
  if(n<=20) return 4;
  if(n<=25) return 5;
  return 6;
}

int main() {
  int a[7]={600,800,1000,1200,1400,1600,0};
  int n;
  while(cin >> n && n) {
    int ans=0;
    rep(i,n) {
      int x,y,h,w;
      cin >> x >> y >> h >> w;
      ans+=a[max(size(x+y+h),weight(w))];
    }
    pr(ans);
  }
  return 0;
}

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