#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define PI atan(1.0)*4

int main() {
	int a,b;
cout<<PI<<endl;
	while(a=in()){
		int i;
		double d;
		int r=360;
		double aa=0;
		for(i=0;i<a-1;i++){
			cin>>d;
			r-=d;
//cout<<sin(d/180*PI);
			aa+=sin(d/180*PI);
		}
		aa+=sin(r/180*PI);
		cin>>b;
		r=360;
		double bb=0;
		for(i=0;i<b-1;i++){
			cin>>d;
			r-=d;
			bb+=sin(d/180*PI);
		}
		bb+=sin(r/180*PI);
cout<<aa<<" "<<bb<<endl;
		if(fabs(aa-bb)<=1e-9){
			cout<<0<<endl;
		}else if(aa>bb){
			cout<<1<<endl;
		}else{
			cout<<2<<endl;
		}
	}
	return 0;
}