#include <iostream>
#include <map>
#include <string>
#include <complex>
#include <vector>
#include <cmath>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

int main() {
    int n;
    while(cin >> n && n) {
        double s1 = 0, t1 = 0;
        double cur = 0;
        rep(i,n-1){
            double t; cin >> t;
            s1 += sin(t/180*acos(-1));
            cur += t;
        }
        s1 += sin((360-cur)/180*acos(-1));

        cin >> n;
        cur = 0;
        rep(i,n-1){
            double t; cin >> t;
            t1 += sin(t/180*acos(-1));
            cur += t;
        }
        t1 += sin((360-cur)/180*acos(-1));

        if(abs(s1-t1) < 1e-8) cout << 0 << endl;
        else if(s1 > t1) cout << 1 << endl;
        else if(s1 < t1) cout << 2 << endl;
    }
}