#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

const double eps = 1.0e-7;
const double pi = 4.0 * atan(1.0);

double getArea(vector<int> v) {
    int last = 360;
    for (int i=0; i<(int)v.size(); ++i) last -= v[i];
    v.push_back(last);
    double ret = 0;
    for (int i=0; i<(int)v.size(); ++i) {
        ret += sin((double)v[i] * pi / 180);
    }
    return ret;
}

int main() {
    int m, n;
    while (cin >> m, m) {
        vector<int> v1(m-1);
        for (int i=0; i<m-1; ++i) {
            cin >> v1[i];
        }
        cin >> n;
        vector<int> v2(n-1);
        for (int i=0; i<n-1; ++i) {
            cin >> v2[i];
        }
        double area1, area2;
        area1 = getArea(v1);
        area2 = getArea(v2);
        if (abs(area1 - area2) < eps) {
            cout << 0 << endl;
        } else if (area2 < area1) {
            cout << 1 << endl;
        } else {
            cout << 2 << endl;
        }
    }
    return 0;
}