#include <iostream>
#include <vector>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(n==0) break;
		vector<int> v;
		for(int i=0,in;i<n/4;++i){
			cin>>in;
			v.push_back(in);
		}
		int sum=0;
		for(vector<int>::iterator it=v.begin();it<v.end();++it){
			sum+=*it;
		}
		cout<<sum<<"\n";
	}
}