Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	for n := getNextInt(scanner); n > 0; n = getNextInt(scanner) {
		sum := 0
		for j := 0; j < n/4; j++ {
			sum += getNextInt(scanner)
		}
		fmt.Fprintln(writer, sum)
	}
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = double;
const ld eps = 1e-9;
//
//using Graph = vector<vector<int>>;
//
//int dfs(const Graph&g, const int now, vector<int>&ch_cnts) {
//  ch_cnts[now]++;
//  for (auto&& e : g[now]) {
//      ch_cnts[now] += dfs(g, e, ch_cnts);
//  }
//  return ch_cnts[now];
//}
//
//struct HL_Edge {
//  int from;
//  int to;
//  bool heavy;
//};
//
//void dfs2(const Graph&g, vector<vector<HL_Edge>>&hl_tree, const int now, const vector<int>&ch_cnts) {
//
//  int max_ch_id = 1;
//  {
//      int max_ch_num = -1;
//      for (auto&&e : g[now]) {
//          if (max_ch_num < ch_cnts[e]) {
//              max_ch_num = ch_cnts[e];
//              max_ch_id = e;
//          }
//      }
//  }
//  for (auto e : g[now]) {
//      bool heavy = (e == max_ch_id);
//
//      hl_tree[now].push_back(HL_Edge{ now,e,heavy });
//  }
//  return;
//}
//
//void HL(const vector<vector<int>>&ro_tree) {
//  vector<int>ch_cnts(ro_tree.size());
//
//  dfs(ro_tree, 0, ch_cnts);
//
//  vector<vector<HL_Edge>>hl_tree(ro_tree.size());
//
//  dfs2(ro_tree, hl_tree, 0, ch_cnts);
//}
//
//namespace FastFourierTransform
//{
//  using C = complex< double >;
//
//  void DiscreteFourierTransform(vector< C > &F, bool rev)
//  {
//      const int N = (int)F.size();
//      const double PI = (rev ? -1 : 1) * acos(-1);
//      for (int i = 0, j = 1; j + 1 < N; j++) {
//          for (int k = N >> 1; k > (i ^= k); k >>= 1);
//          if (i > j) swap(F[i], F[j]);
//      }
//      C w, s, t;
//      for (int i = 1; i < N; i <<= 1) {
//          for (int k = 0; k < i; k++) {
//              w = polar(1.0, PI / i * k);
//              for (int j = 0; j < N; j += i * 2) {
//                  s = F[j + k];
//                  t = C(F[j + k + i].real() * w.real() - F[j + k + i].imag() * w.imag(),
//                      F[j + k + i].real() * w.imag() + F[j + k + i].imag() * w.real());
//                  F[j + k] = s + t, F[j + k + i] = s - t;
//              }
//          }
//      }
//      if (rev) for (int i = 0; i < N; i++) F[i] /= N;
//  }
//
//  vector< int> Multiply(const vector<int > &A, const vector<int > &B)
//  {
//      int sz = 1;
//      while (sz <= A.size() + B.size()) sz <<= 1;
//      vector< C > F(sz), G(sz);
//      for (int i = 0; i < A.size(); i++) F[i] = A[i];
//      for (int i = 0; i < B.size(); i++) G[i] = B[i];
//      DiscreteFourierTransform(F, false);
//      DiscreteFourierTransform(G, false);
//      for (int i = 0; i < sz; i++) F[i] *= G[i];
//      DiscreteFourierTransform(F, true);
//      vector< int > X(A.size() + B.size() - 1);
//      for (int i = 0; i < A.size() + B.size() - 1; i++) X[i] = F[i].real() + 0.5;
//      return (X);
//  }
//};

struct aa {
	string name;
	int l;
	int r;
	int u;
	int d;
	vector<shared_ptr<aa>>chs;
};

int get_num(string st, int&a) {
	int num=0;
	while (a != st.size() && isdigit(st[a])) {
		num*=10;
		num+=st[a]-'0';
		a++;
	}
	return num;
}

string get_name(string st, int &a) {
	string name="";
	while (a != st.size() && 'a' <= st[a] && st[a] <= 'z') {
		name+=st[a];
		a++;
	}
	return name;
}

string get_on_name(string st,bool flag, int &a) {
	assert(st[a]=='<');
	a++;
	if (flag) {
		assert(st[a]=='/');
		a++;
	}
	string name=get_name(st,a);
	assert(st[a]=='>');
	a++;
	return name;
}



pair<pair<int, int>, pair<int, int>>get_on_num(string st, int &a) {
	int l=get_num(st,a);
	assert(st[a]==',');
	a++;
	int u=get_num(st,a);
	assert(st[a]==',');
	a++;
	int r=get_num(st,a);
	assert(st[a]==',');
	a++;
	int d=get_num(st,a);

	return make_pair(make_pair(l,r),make_pair(u,d));
}

shared_ptr<aa>solve(string st, int &a) {

	aa now;
	string aname=get_on_name(st,false,a);
	now.name=aname;



	auto p=get_on_num(st,a);
	now.l=p.first.first;
	now.r=p.first.second;
	now.u=p.second.first;
	now.d=p.second.second;

	while (st[a + 1] != '/') {
		auto naa=solve(st,a);
		now.chs.push_back(naa);
	}
	get_on_name(st,true,a);
	return make_shared<aa>(now);
}

pair<string, int>get_ans(const aa&naa, int x, int y) {

	if (naa.l <= x&&x <= naa.r&&naa.u <= y&&y <= naa.d) {
		for (auto ch : naa.chs) {
			auto p = get_ans(*ch, x, y);
			if (p.first == "") {
			}
			else {
				return p;
			}
		}
		return make_pair(naa.name, naa.chs.size());
	}
	else {
		return make_pair("",0);
	}
}

int main() {
	while (true) {
		int N; cin >> N;
		if(!N)break;
		int ans=0;
		for (int k = 0; k < N / 4; ++k) {
			int a;cin>>a;
			ans+=a;
		}
		cout<<ans<<endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>

using namespace std;

#define ALL(c) c.begin(),c.end()
#define RALL(c) c.rbegin(),c.rend()
#define REP(type,i,n) for(type i=0;i<(n);++i)
#define MP(a,b) make_pair((a),(b))
#define F_ first
#define S_ second

typedef long long int lli;
typedef pair<int,int> Pi;

const int INF=100000000;
const long long int INF_=1000000000000000000;

int main(){
	int N;
	while(cin >> N&&N){
		int ans=0;
		REP(int,i,N/4){
			int tmp;
			cin >> tmp;
			ans+=tmp;
		}
		cout << ans << endl; 
	}
	return 0;
}

C++: #include <cstdio>

int main(){
	int n;
	while(scanf("%d", &n),n){
		int ans = 0;
		for(int i = 0; i < n/4; i++){
			int p; scanf("%d", &p);
			ans += p;
		}
		printf("%d\n", ans);
	}
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(void) {
  int n, sum, hit;
  while(scanf("%d", &n)) {
    if(n == 0) break;
    sum = 0;
    n /= 4;
    for(int i = 0 ; i < n ; i++) {
      cin >> hit;
      sum += hit;
    }
    cout << sum << endl;
  }
  return 0;
}

C++: #include<stdio.h>
int main(){int n,k,s;for(;scanf("%d",&n),s=0,n;){for(;n>0;n-=4)scanf("%d",&k),s+=k;printf("%d\n",s);}}

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

int main()
{
  int n;
  while (cin >> n) {
    if (n == 0)
      break;

    int ans = 0;
    for (int i = 0; i < n/4; ++i) {
      int t;
      cin >> t;
      ans += t;
    }

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

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

int main(){
	
	int i,n,utu,ans=0;
	
	while(cin >> n,n){
		for(i=0;i<n/4;i++){
			cin >> utu;
			
			ans += utu
		}
		
		cout << ans << endl;
	}
	
	return 0;
}

C++: # include <iostream>

int n;
int sum = 0;

int main() {
	while (1) {
		sum = 0;
		int a;
		std::cin >> n;
		if (n == 0)
			break;
		for (int i = 0; i < n / 4; ++i) {
			std::cin >> a;
			sum += a * 4;
		}
		std::cout << sum << std::endl;
	}
	return 0;
}