#include <stdio.h>

int main(void){
    int i, n, m, sum, hit;

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

        sum = 0;
        m = n / 4;

        for (i = 0; i < m; i++) {
            scanf(" %d", &hit);
            sum += hit;
        }
        printf("%d\n", sum);
    }

    return 0;
}