#golden week D=int(input()) C1=input() C2=input() C=C1+C2 i=0 Cn=[] while i=0: if i%2==0: g+=Cn[i] # print (g) elif V>=Cn[i]: g+=Cn[i] V-=Cn[i] elif V>0: g+=V V=0 else: V=-1 i+=1 # print (D) # print (g) if g>m: m=g j+=1 print(m)