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>

using namespace std;

int cost[6] = {600, 800, 1000, 1200, 1400, 1600};

int main(int argc, char **argv)
{
	int w, x, y, z, n, sum;
	
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		sum = 0;
		for(int i = 0; i < n; i++){
			cin >> x >> y >> z >> w;
			
			x = (x > y && x > z)? x : ((y > x && y > z)? y : z);
			if(w > 25 || x > 160){
				continue;
			}
			
			if(x <= 60){
				y = 0;
			} else {
				if(x%20 == 0){
					x--;
				}
				y = (int)(x/20) - 2;
			}
			
			if(w <= 2){
				z = 0;
			} else {
				if(w%5 == 0){
					w--;
				}
				z = (int)(w/5)+1;
			}
			sum += cost[((y < z)? z : y)];
		}
		cout << sum << endl;
	}
	
	return 0;
}

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

int main() {
	int n;
	while(cin >> n, n) {
		long long ans = 0;
		for(int i = 0; i < n; i++) {
			int x, y, h, w;
			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<stdio.h>
int main()
{
	int n,x,y,h,w,s,l;
	while(scanf("%d",&n),n)
	{
		s=0;
		while(n--)
		{
			scanf("%d%d%d%d",&x,&y,&h,&w);
			l=x+y+h;
			if(l<=60 && w<=2) s+=600;
			else if(l<=80 && w<=5) s+=800;
			else if(l<=100 && w<=10) s+=1000;
			else if(l<=120 && w<=15) s+=1200;
			else if(l<=140 && w<=20) s+=1400;
			else if(l<=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,s;
  for(;;){
    cin >> n;
    if(n==0)break;
    s = 0;
    while(n--){
      cin >> x >> y >> h >> w;
      x = x + y + h;
      if(x <= 60 && w <= 2) s += 600;
      else if(x <= 80 && w <= 5) s += 800;
      else if(x <= 100 && w <= 10) s += 1000;
      else if(x <= 120 && w <= 15) s += 1200;
      else if(x <= 140 && w <= 20) s += 1400;
      else if(x <= 160 && w <= 25) s += 1600;
    }
    cout << s << endl;
  }
  return 0;
}

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

int price(int s,int w) {
  int sizeprice,wprice;
  if(s <=60) {
    sizeprice = 0;
  }
  else if(s <= 80) {
    sizeprice = 1;
  }
  else if(s <= 100) {
    sizeprice = 2;
  }
  else if(s <= 120) {
    sizeprice = 3;
  }
  else if(s <= 140) {
    sizeprice = 4;
  }
  else if(s <= 160) {
    sizeprice = 5;
  }
  else {
    sizeprice = 6;
  }
  if(w <=2) {
    wprice = 0;
  }
  else if(w <= 5) {
    wprice = 1;
  }
  else if(w <= 10) {
    wprice = 2;
  }
  else if(w <= 15) {
    wprice = 3;
  }
  else if(w <= 20) {
    wprice = 4;
  }
  else if(w <= 25) {
    wprice = 5;
  }
  else {
    wprice = 6;
  }
  if(max(sizeprice,wprice)<6) {
    return max(sizeprice,wprice) * 200 +600;
    }
  else {
    return 0;
  }
}

int main() {
  int n,x,y,h,w,size,sum=0;
  while(cin >> n) {
    if(n==0) break;
    for(int i=0;i<n;i++) {
      cin >> x >> y >> h >> w;
      size = x+y+h;
      sum += price(size,w);
    }
    cout << sum << endl;
    sum=0;
  }
}

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

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

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

int weight(int b){
  if(b<=2)
    return 600;
  else if(b<=5)
    return 800;
  else if(b<=10)
    return 1000;
  else if(b<=15)
    return 1200;
  else if(b<=20)
    return 1400;
  else if(b<=25)
    return 1600;
  else
    return 0;
}

int fee(int sz, int wt){
  if(size(sz)==0 || weight(wt)==0)
    return 0;
  else
    return max(size(sz), weight(wt));
}

void solve(){
  int f=0;
  for(int i=1; i<=n; ++i){
    scanf("%d %d %d %d", &x, &y, &h, &w);
    int s=x+y+h;
    f+=fee(s, w);
  }
  printf("%d\n", f);
}

int main(){
  while(scanf("%d", &n) && n!=0){
    solve();
  }
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){

    int n;
    int d[7]={600,800,1000,1200,1400,1600,0};
    while(cin>>n,n){
        int ans = 0;
        while(n--){
            int x,y,h,w;
            cin>>x>>y>>h>>w;
            x+=y+h;
            int a,b;
            for(a=0;a<6&&x>60+a*20;a++);

            if(w<=2)b=0;
            else for(b=1;b<6&&w>b*5;b++);
            ans+=d[max(a,b)];
        }
        cout<<ans<<endl;

    }
    return 0;
}

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

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#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 INF 1<<30

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

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;
}