#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    double pi = acos(-1);
    while(cin >> n, n){
        vector<int> v(n-1);
        int s = 360;
        for (auto &&i : v) scanf("%d", &i), s -= i;
        v.emplace_back(s);
        int m;
        cin >> m;
        vector<int> u(m-1);
        s = 360;
        for (auto &&j : u) scanf("%d", &j), s -= j;
        u.emplace_back(s);
        double ans1 = 0, ans2 = 0;
        for (auto &&i : v) {
            ans1 += sin(pi*i/180);
        }
        for (auto &&k : u) {
            ans2 += sin(pi*k/180);
        }
        if(abs(ans1-ans2) < 1e-10) puts("0");
        else if(ans1 < ans2) puts("2");
        else puts("1");
    }

    return 0;
}
