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 length[6] = {60,80,100,120,140,160};
int weight[6] = {2,5,10,15,20,25};
int fee[6] = {600,800,1000,1200,1400,1600};

int main(int argc, const char * argv[]) {
    
    while (true) {
        int n;
        cin >> n;
        if(n == 0){
            break;
        }
        
        int sum = 0;
        for(int i=0;i<n;i++){
            int x,y,h,w;
            cin >> x >> y >> h >> w;
            
            for(int j=0;j<6;j++){
                if(length[j] >= x+w+h && weight[j] >= w){
                    sum+= fee[j];
                    break;
                }
            }
            
        }
        
        cout << sum << endl;
    }
    
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<stack>
#include<queue>

using namespace std;

int main(){
	int x,y,h,w;
	int size;
	int fee[6]={600,800,1000,1200,1400,1600};
	int n;
	while(scanf("%d",&n)){
		if(n==0) break;
		int sum=0,fl=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) sum+=fee[0];
			else if(size<=80&&w<=5) sum+=fee[1];
			else if(size<=100&&w<=10) sum+=fee[2];
			else if(size<=120&&w<=15) sum+=fee[3];
			else if(size<=140&&w<=20) sum+=fee[4];
			else if(size<=160&&w<=25) sum+=fee[5];
		}
		printf("%d\n",sum);
	}
}

C++: #include <iostream>

using namespace std;

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

int main()
{
	solve();
	return(0);
}

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

long long calc_fee(int v, int w) {
//    cout << v << ' ' << w << endl;
    if (v <= 60 && w <= 2) {
        return 600;
    } else if (v <= 80 && w <= 5) {
        return 800;
    } else if (v <= 100 && w <= 10) {
        return 1000;
    } else if (v <= 120 && w <= 15) {
        return 1200;
    } else if (v <= 140 && w <= 20) {
        return 1400;
    } else if (v <= 160 && w <= 25) {
        return 1600;
    }
    return 0;
};

int main() {
    int n;
    while (cin >> n, n != 0) {
        long long total_fee = 0;
        for (int i = 0; i < n; i++) {
            int x, y, h, w;
            cin >> x >> y >> h >> w;
            total_fee += calc_fee(x+y+h, w);
        }
        cout << total_fee << endl;
    }
    return 0;
}

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

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	int n;
	while(cin >> n && n)
	{
		long long ans = 0;
		int x,y,h,w;

		rep(i,n)
		{
			cin >> x >> y >> h >> w;

			int a = x + y + h;
			
			if(25 < w || 160 < a) continue;

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

		cout << ans << endl;
	}
	return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  while(cin >> n && n){
    ll x,y,h,w,res = 0,size;
    rep(i,n){
      cin >> x >> y >> h >> w;
      size = x+y+h;
      if(size <= 60 && w <= 2){
        res += 600;
      }
      else if(size <= 80 && w <= 5){
        res += 800;
      }
      else if(size <= 100 && w <= 10){
        res += 1000;
      }
      else if(size <= 120 && w <= 15){
        res += 1200;
      }
      else if(size <= 140 && w <= 20){
        res += 1400;
      }
      else if(size <= 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 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 <stdio.h>

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