#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;
	}
}
