#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const double PI = acos(-1.0);

int main()
{
    for(;;){
        vector<double> area(2, 0.0);
        for(int i=0; i<2; ++i){
            int n;
            cin >> n;
            if(n == 0)
                return 0;

            int rest = 360;
            while(--n > 0){
                int a;
                cin >> a;
                area[i] += sin(a/180.0*PI);
                rest -= a;
            }
            area[i] += sin(rest/180.0*PI);
        }

        if(area[0] > area[1])
            cout << '1' << endl;
        else if(area[0] < area[1])
            cout << '2' << endl;
        else
            cout << '0' << endl;
    }
}