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
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstring;
typedef pair<int, int> pint;
typedef pair<pint, int> ppint;
typedef pair<int, pint> pintp;
typedef unsigned int uint;
typedef long long llint;
typedef unsigned long long int ullint;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const int INF = 100000000;

//clear memory
#define clear(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;



int main() {
	static int n;
	while(true) {
		cin >> n;
		if(n == 0)
			break;
		int ans = 0;
		for(int i = 0; i < n / 4; i++) {
			static int t;
			cin >> t;
			ans += t;
		}
		cout << ans << endl;
	}
	return 0;
}

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

    int n;
    while(cin>>n,n){
        int b=0;
        for(int i=0;i<n/4;i++){
            int a;
            cin>>a;
            b+=a;
        }
        cout<<b<<endl;
    }

    return 0;
}

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


int main()
{
	int n;
	while (true)
	{
		cin >> n;
		if (n == 0)
			break;
		n /= 4;
		int c = 0;
		for (int m; n > 0; n--)
		{
			cin >> m;
			c += m;
		}
		cout << c << endl;
	}
}

C++: #include <iostream>

using namespace std;

int main()
{
	int n;
	int sum;

	while(cin >> n, n)
	{
		n /= 4; sum = 0;
		int tmp;
		for(int i=0; i < n; i++) {
			cin >> tmp;
			sum += tmp;
		}
		printf("%d\n", sum);
	}
	return 0;
}

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



int main(){
	int n;
	while(cin>>n&&n){
		int s=0;
		for(int i=0;i<n/4;i++){
			int a;
			cin>>a;
			s+=a;
		}
		cout<<s<<endl;
	}
	return 0;
}

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

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

int main() {
	int n;
	while (cin >> n, n /= 4) {
		int sum = 0;
		rep(i, n) {
			int a; cin >> a;
			sum += a;
		}
		cout << sum << endl;
	}
}

C++: #include <iostream>

using namespace std;

int main(){
    int n;
    while(cin >> n && n!=0){
        int sum=0;
        for(int i=0;i<n/4;++i){
            int a;
            cin >> a;
            sum+=a;
        }
        cout << sum <<endl;
    }
    
    return 0;
}

C++: #include <iostream>

using namespace std;

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

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

C++: //https://onlinejudge.u-aizu.ac.jp/challenges/sources/UOA/PCKWU/1041

#include <bits/stdc++.h>

using namespace std;

bool solve() {
    int n;
    cin >> n;

    if (n == 0) return false;

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

    cout << res << endl;
    return true;
}

int main() {
    while (solve());
}

/*
 *
 */

C++: #include<stdio.h>
int main()
{
	int n,a,i,r;
	while(1){
		r=0;
		scanf("%d",&n);
		if(n==0){
			break;
		}
		for(i=0;i<n;i+=4){
			scanf("%d",&a);
			r+=a;
		}
		printf("%d\n",r);
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
int main(){
	int n;
	std::vector<int> shot(0);
	int a=1;
	std::vector<int> yeah(0);
	while(true){
		yeah.resize(a);
		std::cin>>n;
		if(n==0){
			break;
		}
		for(int i=1;i<=n/4;i++){
			shot.resize(i);
			std::cin>>shot[i-1];
			yeah[a-1]+=shot[i-1];
		}
		a++;
	}
	for(int i=0;i<a-1;i++){
		std::cout<<yeah[i]<<std::endl;
	}
}

C++: #include <cstdio>
int main(){for(int n,t,s=0;scanf("%d",&n),n/=4;printf("%d\n",s),s=0)while(n--){scanf("%d",&t);s+=t;}}

C++: #include <iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    double n=0,a=0,b=0,c=0,d=0,i=0,j=0;
    while(1){
        cin >> n;
        if(n==0)break;
        b=0;
        for(i=0;i<n;i+=4){
            cin >> a;
            b+=a;
        }
        cout << b << endl;
    }

}