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<cstdio>
using namespace std;

int main(){
  int i,j,k,l,m,n,x,y,h,w,sum;
  int ans;
 

  
  while(1){
    ans=0;
    sum=0;
    cin >> n;
    if(n == 0)break;

    for(i=0;i<n;i++){
      cin >> x >> y >> h >> w;
      sum = x + y + h;
      if(w<=2){
	if(sum<=60)ans+=600;
	else if(sum<=80)ans+=800;
	else if(sum<=100)ans+=1000;
	else if(sum<=120)ans+=1200;
	else if(sum<=140)ans+=1400;
	else if(sum<=160)ans+=1600;
	else ans+=0;
      }
      else if(w<=5){
        if(sum<=80)ans+=800;
	else if(sum<=100)ans+=1000;
	else if(sum<=120)ans+=1200;
	else if(sum<=140)ans+=1400;
	else if(sum<=160)ans+=1600;
	else ans+=0;
      }
      else if(w<=10){
	 if(sum<=100)ans+=1000;
	else if(sum<=120)ans+=1200;
	else if(sum<=140)ans+=1400;
	else if(sum<=160)ans+=1600;
	else ans+=0;
      }
 else if(w<=15){
	
	 if(sum<=120)ans+=1200;
	else if(sum<=140)ans+=1400;
	else if(sum<=160)ans+=1600;
	else ans+=0;
      }
 else if(w<=20){

	
	 if(sum<=140)ans+=1400;
	else if(sum<=160)ans+=1600;
	else ans+=0;
      }
 else if(w<=25){



	if(sum<=160)ans+=1600;
	else ans+=0;
      }




    }
    cout << ans << endl;



  }






}

C++: #include <cstdio>
int main() {
    int n, x, y, h, w;
    while (scanf("%d",&n)) {
        if (!n) break;
        int res=0;
        for (int i=0; i<n; i++) {
            scanf("%d%d%d%d",&x,&y,&h,&w);
            int sum=x+y+h;
            if (sum<=60&&w<=2) res+=600;
            else if (sum<=80&&w<=5) res+=800;
            else if (sum<=100&&w<=10) res+=1000;
            else if (sum<=120&&w<=15) res+=1200;
            else if (sum<=140&&w<=20) res+=1400;
            else if (sum<=160&&w<=25) res+=1600;
        }
        printf("%d\n",res);
    }
}

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

int getValue( int l, int w ){
    int L[6] = {60, 80, 100, 120, 140, 160};
    int W[6] = {2, 5, 10, 15, 20, 25};
    int V[6] = {600, 800, 1000, 1200, 1400, 1600};
    for ( int i = 0; i < 6; i++ ){
	if ( l <= L[i] && w <= W[i] ) return V[i];
    }
    return 0;
}

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

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

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

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

int main(){
	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 <iostream>
using namespace std;

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

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
//#define int long long
using namespace std;

signed main()
{
	int n;
	int x, y, h, w;

	while (true)
	{
		cin >> n;
		if (n == 0) break;
		int ans = 0;
		rep(i,n)
		{
			cin >> x >> y >> h >> w;
			int len = x + y + h;

			if (len <= 60 && w <= 2)
			{
				ans += 600;
			}
			else if (len <= 80 && w <= 5)
			{
				ans += 800;
			}
			else if (len <= 100 && w <= 10)
			{
				ans += 1000;
			}
			else if (len <= 120 && w <= 15)
			{
				ans += 1200;
			}
			else if (len <= 140 && w <= 20)
			{
				ans += 1400;
			}
			else if (len <= 160 && w <= 25)
			{
				ans += 1600;
			}
		}

		printf("%d\n", ans);
	}
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

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

int main(){
	while (cin >> n&&n){
		int ans = 0;
		REP(i, n){
			cin >> x >> y >> h >> w;
			int 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;
		}
		cout << ans << endl;
	}
}

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(){
	int n,a,b,c,s,w;
	while(cin>>n,n){
		int p=0;
		while(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<iostream>
using namespace std;

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

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

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

using namespace std;

int main(){
	int x[3],w;
	int n;
	while(cin>>n,n){
		int sum=0;
		rep(i,n){
			rep(j,3)cin>>x[j];
			cin>>w;
			sort(x,x+3);
			int size=x[0]+x[1]+x[2];
			if(size<=60&&w<=2)sum+=600;
			else if(size<=80&&w<=5)sum+=800;
			else if(size<=100&&w<=10)sum+=1000;
			else if(size<=120&&w<=15)sum+=1200;
			else if(size<=140&&w<=20)sum+=1400;
			else if(size<=160&&w<=25)sum+=1600;
//			cout<<size<<" "<<w<<" "<<sum<<endl;
		}
		cout<<sum<<endl;
	}
	
}