#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <stack>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;

int main()
{
    int n, s, t;
    while(cin >> n){
        s = 0;
        for (int i = 0; i < n/4; i++){
            cin >> t;
            s += t;
        }
      if (n != 0)
        cout << s << endl;
    
    }
    return 0;
}
