#include <iostream>
#include <cmath>
using namespace std;
const int PI = 3.1415926535897932384;

int main(){
    double n;
    
    while(cin >> n,n){
        double angle,nn = (n-2)*180;
        double first = 0 , second = 0;
        for(int i = 0 ; i < n-1 ; i++){
            cin >> angle;
            first += cos((angle*PI)/180.0);
            nn -= angle;
        }

        first += cos((nn*PI)/180.0);
   
        cin >> n;
        nn = (n-2)*180;
        for(int i = 0 ; i < n-1 ; i++){
            cin >> angle;
            second += cos((angle*PI)/180.0);
            nn -= angle;
        }
        second += cos((nn*PI)/180.0);
  
        if((float)first == (float)second) cout << '0' << endl;
        else if((float)first > (float)second) cout << '1' << endl;
        else cout << '2' << endl;
    }
    
    return 0;
}