#include<stdio.h>

int main(){
        int x;
        int n,h=0;
        int i,j;

        for(;;){

                scanf("%d",&n);
                if(n == 0){
                        break;
                }else{

                        i = n / 4;
                        for(j = 0; j < i; j++){
                                scanf("%d",&x);
                                h += x;

                        }
                        printf("%d\n",h);
                        h = 0;
                }
        }

        return 0;
}