#include<bits/stdc++.h>

using namespace std;

int main()
{
  while(1){
    int n;
    cin>>n;

    if(n == 0){
      break;
    }

    int times = n / 4;
    int ans = 0;

    for(int i = 0;i < times;++i){
      int a;
      cin>>a;
      ans += a;
    }

    cout<<ans<<endl;
  }

  return 0;
}
