#include <stdio.h>
int main(void){
    int num=0,i,score=0,ans=0,n;
    while(1){
        scanf("%d",&num);
        if(num==0) break;
        n = num/4;
        for(i=0;i<n;i++){
            scanf("%d",&ans);
            score += ans;
        }
        printf("%d\n",score);
        score =0;
    }
    
}

