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

#define IPS 1e-10

double area(int deg) {
    return sin((double)deg / 180 * M_PI);
}

int main() {
    int m, n;
    while (cin >> m, m) {
        int deg, remain = 360;
        double a1 = 0, a2 = 0;
        while (--m) {
            cin >> deg;
            remain -= deg;
            a1 += area(deg);
        }
        a1 += area(remain);

        remain = 360;
        cin >> n;
        while (--n) {
            cin >> deg;
            remain -= deg;
            a2 += area(deg);
        }
        a2 += area(remain);

        if (abs(a1-a2) < IPS) {
            cout << "0" << endl;
        }
        else if (a1 > a2) {
            cout << "1" << endl;
        }
        else {
            cout << "2" << endl;
        }

    }
    return 0;
}