#include <iostream>
#include<vector>
#include <algorithm>

using namespace std;

int main()
{
  int n,b,sum;
  vector<int> a;

  while(cin>>n,n){

    sum = 0;
    a = {0};

    for(int i = 0;i < n/4;++i){
      cin>>b;
      a.push_back(b);
    }

    for(int e : a){
      sum += e;
    }

    cout<<sum<<endl;
  }

  return 0;
}