#include <stdio.h>

#define N (100)
#define N_RESULT (100)

int main(){
        int     shoot, set;
        int     hit, total;
        char    str[N];
        int     result[N_RESULT];
        int     i, j;

        for( i=0; i<N_RESULT; i++ ){
                // Scan number of shuut
                fgets( str, N-1, stdin );
                sscanf( str, "%d", &shoot );
                if( shoot == 0 ) break;
                else if( ( shoot % 4 ) != 0 ){
                        fprintf( stderr, "Invalid number\n" );
                        return 1;
                }
                set = shoot / 4;
                // Scan numberof hit
                total = 0;
                for( j=0; j<set; j++ ){
                        fgets( str, N-1, stdin );
                        sscanf( str, "%d", &hit );
                        total += hit;
                }
                result[i] = total;
        }

        // Show results
        for( j=0; j<i; j++ ){
                printf( "%d\n", result[j] );
        }

        return 0;
}

