#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
const double EPS = 1e-10;
#define eq(a,b) fabs(a - b) < EPS

int main()
{
  int m;
  for(;cin>>m,m;)
    {
      int a=0;
      int sum=360;
      for(int i=0;i<m-1;i++)
	{
	  int t;
	  cin>>t;
	  sum-=t;
	  a+=90-abs(t-90);
	}
      a+=90-abs(sum-90);
      sum=360;
      int n;
      cin>>n;
      int b=0;
      for(int i=0;i<n-1;i++)
	{
	  int t;
	  cin>>t;
	  sum-=t;
	  b+=90-abs(t-90);
	}
      b+=90-abs(sum-90);      
      if(a==b)
	cout<<"0"<<endl;
      else if(a>b)
	cout<<"1"<<endl;
      else
	cout<<"2"<<endl;
    }
}