include Math
def calc(l)
  l.map!{ |i| sin(i*PI/180) }
  l.reduce(:+)
end
while n = gets.to_i
  break if n == 0
  l1 = []
  (n-1).times{ l1 << gets.to_i }
  l1 << 360 - l1.reduce(:+)
  l2 = []
  (gets.to_i-1).times{ l2 << gets.to_i }
  l2 << 360 - l2.reduce(:+)
  if (a = calc(l1) - calc(l2)) > 0 then p 1
  elsif a < 0 then p 2
  else p 0
  end  
end