#include <iostream>
#include <cmath>
#define pi 3.14159265359

using namespace std;

int main(void){

  double s1,s2;
  int n,m;
  int angle,c;

  while( cin >> n , n ){

    s1 = s2 = 0;
    c = 360;

    for( int i = 0 ; i < n - 1 ; i++ ){
      cin >> angle;
      c -= 360;
      s1 += sin((double)angle*pi/180.0) / 2.0;
    }
    s1 += sin((double)c*pi/180.0) / 2.0;

    c = 360;
    cin >> m;
    for( int i = 0 ; i < m - 1 ; i++ ){
      cin >> angle;
      c -= angle;
      s2 += sin((double)angle*pi/180.0) / 2.0;
    }
    s2 += sin((double)c*pi/180.0) / 2.0;

    //  cout << s1 << "  "  << s2 << endl;

    if( fabs( s1 - s2 ) < 0.0000001 ) cout << 0 << endl;
    else if( s1 > s2 ) cout << 1 << endl;
    else cout << 2 << endl;


  }


  return 0;
}