#include <iostream>
#include <cmath>

using namespace std;

const double EPS = 1e-10;
const double PI = 3.14159265358979323;

int main()
{
    int m,n;
    while(cin >> m && m) {
        
        double s1, s2, theta;
        s1 = 0.0;
        int a,sum = 0;
        for(int i = 0; i < m - 1; i++) {
            cin >> a;
            theta = (PI * a) / 180.0;
            s1 += cos(theta / 2.0) * sin(theta / 2.0);
            sum += a;
        }
        theta = (PI * (360 - sum)) / 180.0;
        s1 += cos(theta / 2.0) * sin(theta / 2.0);

        cin >> n;
        s2 = 0.0;
        sum = 0;
        for(int i = 0; i < n - 1; i++) {
            cin >> a;
            theta = (PI * a) / 180.0;
            s2 += cos(theta / 2.0) * sin(theta / 2.0);
            sum += a;
        }
        theta = (PI * (360 - sum)) / 180.0;
        s2 += cos(theta / 2.0) * sin(theta / 2.0);

        if(s1 - EPS > s2) {
            cout << "1" << endl;
        } else if(fabs(s1 - s2) < EPS) {
            cout << "0" << endl;
        } else {
            cout << "2" << endl;
        }
    }
}