#include<iostream>
#define MAX_ARRAY 100

using namespace std;

int main(void){
    int tekichu[MAX_ARRAY],sum,n;

    while(cin>>n,n){
        sum=0;
        for(int i=0;i<MAX_ARRAY;i++){
            tekichu[i]=0;
        }   
        n=n/4;
        for(int i=0;i<n;i++){
            cin>>tekichu[i];
            sum=sum+tekichu[i];
        }   
        cout<<sum<<endl;
    }   
    return 0;
}