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 <iostream>

using namespace std;

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

int main()
{
	solve();
	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;
	}
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  while (cin >> n, n) {
    n /= 4;
    int c = 0;
    while (n--) {
      int x;
      cin >> x;
      c += x;
    }
    cout << c << endl;
  }
}

C++: #include <iostream>

int main() {
	int n;
	
	while (std::cin >> n, n) {
		int ans = 0;

		for (int i = 0; i < n / 4; ++i) {
			int x;
			std::cin >> x;

			ans += x;
		}

		std::cout << ans << std::endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
  while(1){
  int n,k[100005],ans=0;
cin>>n;
if(n==0){break;}
for(int i=0;i<n/4;++i){
cin>>k[i];
ans+=k[i];
}
cout<<ans<<endl;
}
}

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

C++: #include <iostream>

using namespace std;

int main(){

  int n;
  int p;
  int sum=0;
  

  while(cin >> n,n){

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

    cout << sum << endl;
    sum=0;

  }
      
  return 0;

}

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

C++: #include<iostream>
#include<vector>
int main() {
	int n;
	std::vector<int>v;
	while (1) {
		std::cin >> n;
		if (n == 0) {
			break;
		}
		int a = 0;
		for (int i = 0; i < n / 4; ++i) {
			int b;
			std::cin >> b;
			if (b == 0) {
				break;
			}
			a += b;
		}
		v.push_back(a);
}
	for (int i = 0; i < v.size(); ++i) {
		std::cout << v[i]<< std::endl;
	}
	return 0;
}

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

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

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

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

C++: #include <iostream>
using namespace std;
int main(){
  int n;
  while(cin >> n,n){
    int a,sum = 0;
    for(int i = 0 ; i < n/4 ; i++){
      cin >> a;
      sum+=a;
    }
    cout << sum << endl;
  }
}

C++: #include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<string.h>

using namespace std;

const int mod = 1000000007;

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

C++: #include <stdio.h>
int main(){
    int n,ans,temp;
    while(true){
        scanf("%d",&n);
        if(n==0)return 0;
        ans=0;
        n/=4;
        while(n--){
            scanf("%d",&temp);
            ans+=temp;
        }
        printf("%d\n",ans);
    }
}

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>
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 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};
const int dx[] = {0,-1,0,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 sum = 0,a;
    rep(i,n/4){
      cin >> a;
      sum += a;
    }
    cout << sum << endl;
  }
  return 0;
}