#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=0,b=0;
        n/=4;
        while(n--){
            cin>>a;
            b+=a;
        }
        cout<<b<<endl;
        
    }
}