#include<stdio.h>

int main(){
        int x;
        int n,h=0;
        int i,j;
        
        for(;;){
                scanf("%d",&n);
                i = n / 4;
                for(j = 0; j < i; j++){
                        scanf("%d",&x);
                        h += x;
                }
                printf("%d\n",h);
                h = 0;
        if(n == 0)
                break;
        }

        return 0;
}