#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#define EPS (1e-10)
#define PI 3.14159265358979323846264
using namespace std;

class Point
{
public:
  double x,y;

  Point(double x = -1,double y = -1): x(x),y(y){}

  Point operator + (Point p ){return Point(x+p.x,y+p.y);}
  Point operator - (Point p){return Point(x-p.x,y-p.y);}
  Point operator * (double a){return Point(a*x,a*y);}

  bool operator < (const Point& p) const
  {
    return x != p.x?x<p.x:y<p.y;
  }

  bool operator == (const Point& p)const
  {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

struct Segment
{
  Point p1,p2;
  Segment(Point p1 = Point(-1,-1),Point p2 = Point(-1,-1)):p1(p1),p2(p2){}
};
typedef Segment Line;
typedef vector<Point> Polygon;

double dot(Point a,Point b)
{
  return a.x*b.x + a.y*b.y;
}
double cross(Point a,Point b)
{
  return a.x*b.y - a.y*b.x;
}

double norm(Point a)
{
  return a.x*a.x+a.y*a.y;
}

double getArea(vector<Point>& vec)
{
  double sum = 0;
  for(int i=0;i<vec.size();i++)
    sum += cross(vec[i],vec[(i+1)%vec.size()]);
  return fabs(sum)/2.0;
}

double rad(double d)
{
  return d*(PI/180.0);
}

Point Rotate(Point p,double d)
{
  Point ret;
  double r = rad(d);
  ret.x = p.x*cos(r) - p.y*sin(r);
  ret.y = p.x*sin(r) + p.y*cos(r);
  return ret;
}


int main()
{
  int m;
  while(cin >> m,m)
    {
      vector<Point> A,B;
      Point p(1,0);
      A.push_back(p),B.push_back(p);
      double v;
      for(int i=0;i<m-1;i++)
	{
	  cin >> v;
	  p = Rotate(p,v);
	  A.push_back(Point(p.x+100,p.y+100));
	}

      cin >> m;
      p = Point(1,0);
      for(int i=0;i<m-1;i++)
	{
	  cin >> v;
	  p = Rotate(p,v);
	  B.push_back(Point(p.x+100,p.y+100));
	}

      //  cout << Rotate(Point(1,0),90).x << " " << Rotate(Point(1,0),90).y   << endl;

      double areaA,areaB;
      areaA = getArea(A);
      areaB = getArea(B);

      if(areaA == areaB)
	cout << 0 << endl;
      else if(areaA > areaB)
	cout << 1 << endl;
      else 
	cout << 2 << endl;

    }
  return 0;
}