#include<iostream>
#include<cmath>

using namespace std;

int main(void){
  int n,m;
  double v;
  
  while(cin >> n,n){
    double sum1=0,sum2=0;
    while(--n){
      cin >> v;
      sum1+=abs(sin(v));
    }

    cin >> m;
    while(--m){
      cin >> v;
      sum2+=abs(sin(v));
    }

    int res= (sum1==sum2)?0:(sum1>sum2)?1:2;
    cout << res << endl;
  }

  return 0;
}