#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

const double PI = acos(-1);
const double EPS = 1e-10;
int sgn(double d) { return d > EPS ? 1 : d < -EPS ? -1 : 0; }
 
struct Point {
  double x, y;
  Point() {}
  Point (const double& x, const double& y) : x(x), y(y) {}
  Point& operator += (const Point& other) { x += other.x; y += other.y; return *this; }
  Point& operator -= (const Point& other) { x -= other.x; y -= other.y; return *this; }
  Point& operator *= (const double& factor) { x *= factor; y *= factor; return *this; }
  Point& operator /= (const double& factor) { x /= factor; y /= factor; return *this; }
};
using Vector = Point;
using Polygon = vector<Point>;
 
Point operator + (const Point&lhs, const Point& rhs) { return Point(lhs.x + rhs.x, lhs.y + rhs.y); }
Point operator - (const Point& lhs, const Point& rhs) { return Point(lhs.x - rhs.x, lhs.y - rhs.y); }
Point operator * (const Point& lhs, const double& factor) { return Point(lhs.x * factor, lhs.y * factor); }
Point operator * (const double& factor, const Point& rhs) { return Point(factor * rhs.x, factor * rhs.y); }
Point operator / (const Point& lhs, const double& factor) { return Point(lhs.x / factor, lhs.y / factor); }
double operator * (const Point& lhs, const Point& rhs) { return lhs.x * rhs.x + lhs.y * rhs.y; }
double operator ^ (const Point& lhs, const Point& rhs) { return lhs.x * rhs.y - lhs.y * rhs.x; }
bool operator == (const Point& lhs, const Point& rhs) { return sgn(lhs.x - rhs.x) == 0 && sgn(lhs.y - rhs.y) == 0; }
bool operator != (const Point& lhs, const Point& rhs) { return !(lhs == rhs); }
bool operator < (const Point& lhs, const Point& rhs) { return sgn(lhs.x - rhs.x) ? lhs.x < rhs.x : lhs.y < rhs.y; }
bool operator > (const Point& lhs, const Point& rhs) { return rhs < lhs; }
bool operator <= (const Point& lhs, const Point& rhs) { return !(lhs > rhs); }
bool operator >= (const Point& lhs, const Point& rhs) { return !(lhs < rhs); }
istream& operator >> (istream& is, Point& point) { return is >> point.x >> point.y; }
ostream& operator << (ostream& os, Point& point) { return os << "(" << point.x << "," << point.y << ")"; }
double norm(const Point& point) { return point.x * point.x + point.y * point.y; }
double abs(const Point& point) { return sqrt(norm(point)); }
double arg(const Point& point) { return atan2(point.y, point.x); }
Point polar(const double& a, const double& r) { return Point(cos(r) * a, sin(r) * a); }
bool sort_x(const Point& lhs, const Point& rhs) { return sgn(lhs.x - rhs.x) ? lhs.x < rhs.x : lhs.y < rhs.y; }
bool sort_y(const Point& lhs, const Point& rhs) { return sgn(lhs.y - rhs.y) ? lhs.y < rhs.y : lhs.x < rhs.x; }
 
double area(const Polygon& p) {
  int pz = p.size();
  if (pz < 3) return 0;
  double res = 0;
  for (int i = 0; i < pz; i++) {
    int prev = i == 0 ? pz - 1 : i - 1;
    int next = i + 1 == pz ? 0 : i + 1;
    res += p[i].x * (p[next].y - p[prev].y) / 2.;
  }
  return abs(res);
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int m, n;
  while (cin >> m, m) {
    Point p(1, 0);
    Polygon ps(1, p);
    for (int i = 0; i < m - 1; i++) {
      double v;
      cin >> v;
      double t = v / 180 * PI;
      p = Point(p.x * cos(t) - p.y * sin(t), p.y * cos(t) + p.x * sin(t));
      ps.emplace_back(p);
    }
    cin >> n;
    Point q(1, 0);
    Polygon qs(1, q);
    for (int i = 0; i < n - 1; i++) {
      double v;
      cin >> v;
      double t = v / 180 * PI;
      q = Point(q.x * cos(t) - q.y * sin(t), q.y * cos(t) + q.x * sin(t));
      qs.emplace_back(q);
    }
    double pa = area(ps), qa = area(qs);
    cout << (sgn(pa - qa) > 0 ? 1 : sgn(pa - qa) < 0 ? 2 : 0) << endl;
  }

  return 0;
}


Measured memory_bytes: 3420