n=int(input()) t=list(map(int,input().split())) p=[] x=0 for i in range(n): x+=t[i] p+=[[x,(i+1)%2]] if p[0][0]==0: p=p[1:] p1=p[:] n=int(input()) t=list(map(int,input().split())) p=[] x=0 for i in range(n): x+=t[i] p+=[[x,(i+1)%2]] if p[0][0]==0: p=p[1:] p2=p[:] t=sorted(set(t for t,f in p1+p2)) p=[] l=0 for x,f in p1: while l