#include<iostream>
using namespace std;
int main(){
    int n;
    while(cin>>n,n){
        int sum=0;
        n/=4;
        while(n--){
            int m;
            cin>>m;
            sum+=m;
        }
        cout<<sum<<endl;
    }
}