using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            while (true)
            {
                int n = int.Parse(Console.ReadLine());

                if (n == 0) break;

                double r = 100.0;
                double rad = 0;

                Point[] ps = new Point[n];
                ps[0] = new Point(r, 0);

                for (int i = 1; i < n; i++)
                {
                    double deg = double.Parse(Console.ReadLine());
                    rad += Math.PI * deg / 180.0;
                    ps[i] = new Point(r * Math.Cos(rad), r * Math.Sin(rad));
                }
                double a1 = GetArea(ps);

                n = int.Parse(Console.ReadLine());
                rad = 0;

                ps = new Point[n];
                ps[0] = new Point(r, 0);

                for (int i = 1; i < n; i++)
                {
                    double deg = double.Parse(Console.ReadLine());
                    rad += Math.PI * deg / 180.0;
                    ps[i] = new Point(r * Math.Cos(rad), r * Math.Sin(rad));
                }
                double a2 = GetArea(ps);

                if (a1 > a2) sb.AppendLine("1");
                else if (a1 < a2) sb.AppendLine("2");
                else sb.AppendLine("0");
            }
            Console.Write(sb);
        }

        static double GetArea(Point[] ps)
        {
            double ret = 0.0;

            for (int i = 0; i < ps.Length; i++)
            {
                ret += ps[i].Cross(ps[(i + 1) % ps.Length]);
            }
            return ret / 2;
        }
    }

    struct Point : IComparable
    {
        static readonly double EPS = 1E-10;

        internal double x, y;

        public Point(double x, double y)
        {
            this.x = x;
            this.y = y;
        }

        public double Abs { get { return Math.Sqrt(Norm); } }
        public double Norm { get { return x * x + y * y; } }
        public double Dot(Point p) { return x * p.x + y * p.y; }
        public double Cross(Point p) { return x * p.y - y * p.x; }
        public double Distance(Point p) { return (this - p).Abs; }

        public static Point operator +(Point a, Point b) { return new Point(a.x + b.x, a.y + b.y); }
        public static Point operator -(Point a, Point b) { return new Point(a.x - b.x, a.y - b.y); }
        public static Point operator *(Point p, double d) { return new Point(p.x * d, p.y * d); }
        public static Point operator *(Point a, Point b) { return new Point(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x); }
        public static Point operator /(Point p, double d) { return new Point(p.x / d, p.y / d); }
        public static bool operator <(Point a, Point b) { return Math.Abs(a.x - b.x) > EPS ? a.x < b.x : a.y < b.y; }
        public static bool operator >(Point a, Point b) { return Math.Abs(a.x - b.x) > EPS ? a.x > b.x : a.y > b.y; }
        public static bool operator ==(Point a, Point b) { return Math.Abs(a.x - b.x) < EPS && Math.Abs(a.y - b.y) < EPS; }
        public static bool operator !=(Point a, Point b) { return Math.Abs(a.x - b.x) >= EPS || Math.Abs(a.y - b.y) >= EPS; }

        public int CompareTo(object obj)
        {
            var other = (Point)obj;
            if (obj == null) return -1;
            ComparerX compX = new ComparerX();
            return compX.Compare(this, other);
        }

        public override bool Equals(object obj)
        {
            var other = (Point)obj;
            return Math.Abs(x - other.x) < EPS && Math.Abs(y - other.y) < EPS;
        }

        public override int GetHashCode()
        {
            return x.GetHashCode() ^ y.GetHashCode();
        }

        public override string ToString()
        {
            return string.Format("{0:f10} {1:f10}", x, y);
        }
    }

    class ComparerX : IComparer<Point>
    {
        static readonly double EPS = 1E-10;

        public int Compare(Point a, Point b)
        {
            if (a.x - b.x < -EPS) return -1;
            if (a.x - b.x > EPS) return 1;
            if (a.y - b.y < -EPS) return -1;
            if (a.y - b.y > EPS) return 1;
            return 0;
        }
    }

    class ComparerY : IComparer<Point>
    {
        static readonly double EPS = 1E-10;

        public int Compare(Point a, Point b)
        {
            if (a.y - b.y < -EPS) return -1;
            if (a.y - b.y > EPS) return 1;
            if (a.x - b.x < -EPS) return -1;
            if (a.x - b.x > EPS) return 1;
            return 0;
        }
    }
}

Measured memory_bytes: 9196