Harryxun/stf_run huggingface dataset:
n = int(input())
lst1 = list(map(int,input().split()))
mod = 10**9+7

import fractions as math
#リスト l の最大公約数
def lcmlist(l):
    a = l[0]
    for i in range(len(l)):
        a = int(a)
        a = a*l[i]/math.gcd(a,l[i])
    return int(a)

g = lcmlist(lst1)
ans = 0
for i in range(n):
    ans += g//lst1[i]%mod

print(ans%mod)




### FIXED CODE ###

n = int(input())
lst1 = list(map(int,input().split()))
mod = 10**9+7
 
def GCD(a,b):
    if b == 0:
        return a
    else:
        return GCD(b,a%b)
def LCM(a,b):
    return (a//GCD(a,b)*b)

l = 1
for i in lst1:
    l = LCM(l,i)

ans = 0
for i in range(n):
    ans += l//lst1[i]
 
print(ans%mod)
from operator import itemgetter
n = int(input())
rest = []
for i in range(n):
    s, p = map(str, input().split())
    rest.append([i+1, s, int(p)])

    rest.sort(key=itemgetter(2), reverse=True)
    rest.sort(key=itemgetter(1))
    for i in range(n):
      print(rest[i][0])

### FIXED CODE ###

def Guidebook():
    n = int(input())
    rest = []
    for i in range(n):
        s, p = map(str, input().split())
        rest.append([i+1, s, int(p)])

    rest.sort(key=lambda x:x[2], reverse=True)
    rest.sort(key=lambda x:x[1])
    for i in range(n):
        print(rest[i][0])
if __name__ == "__main__":
    Guidebook()
a, b, c = map(str, input().split())
if b == '+':
  print(int(a) + int(b))
elif b =='-':
  print(int(a) - int(b))
else:
  print("Error")

### FIXED CODE ###

a, b, c = map(str, input().split())
if b == '+':
  print(int(a) + int(c))
elif b =='-':
  print(int(a) - int(c))
else:
  print("Error")
N,P = map(int,input().split())
List=[]
for i in range(N):
    List+=list(map(int,input().split()))
count = 0
for i in range(P+1):
  if List.count(List[i])=N:
    count +=1
print(count)

### FIXED CODE ###

N,M = map(int,input().split())
foods = [0]*(M+1)
for i in range(N):
  line = list(map(int,input().split()))
  for j in range(1,line[0]+1):
    foods[line[j]]+=1
print(foods.count(N))
from sys import stdin, setrecursionlimit
setrecursionlimit(5000)
def readLine_int_list():return list(map(int, stdin.readline().split()))
def readAll_int(): return list(list(map(int,i.split())) for i in stdin.read().split("\n"))
 
 
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def ratio(a,b):
    return (a//gcd(a,b), b//gcd(a,b))
 
def add_ratio(a,b):
    if a != 0:
        sum_a = sum(a)
        sum_b = sum(b)
        _a = a[0]*sum_b + b[0]*sum_a
        _b = b[1]*sum_a + a[1]*sum_b
        return ratio(_a, _b)
    else:
        return(b)
 
def dfs(i, v, r,ans):
    if i == n:
        if r == (Ma,Mb):
            ans.append(v)
        return 0

    if dfs(i+1, v, r,ans):
        return 0
    
    if dfs(i+1, v+D[i][2], add_ratio(r,ratio(D[i][0],D[i][1])), ans):
        return 0
 
    return 0
ans = []
n, Ma, Mb = readLine_int_list()
D = readAll_int()
e=0
for i in D:
    e += i[2]

def main():
    dfs(0,0,0,ans)
    if ans:
        print(min(ans))
    else:
        print(-1)
 
if __name__ == "__main__":
    main()

### FIXED CODE ###

a,b = list(int(i) for i in input().split())
if a == 1:
    a = 14
if b == 1:
    b = 14
if a==b:
    print("Draw")
else:
    print("Alice" if a>b else "Bob")
# coding: utf-8
import pkg
from itertools import combinations as comb
import numpy as np


# 参考:
# エラトステネスの篩
# https://blog.mktia.com/how-to-output-prime-numbers-in-python/
# https://python.ms/eratosthenes/#_2-%E9%AB%98%E9%80%9F%E7%89%88

	# p:素数　a:任意の自然数
	# a**p≡a mod p
	# a**(p-1)≡1 (mod p) ※Pで割ったあまりが1
	
	
def main():
	x = int(input())
	while not IsPrime(x):
		x += 1
	print(x)

def IsPrime(n):
	if n < 2:
		return False
	elif n == 2:
		return True
	elif n % 2 == 0:
		return False
	
	sqrtN = int(n**0.5)
	for i in range(3, sqrtN, 2):
		if n%i == 0:
			return False
	return True


def primes(n):
	is_prime = [True] * (n + 1)
	is_prime[0] = False
	is_prime[1] = False
	for i in range(2, int(n**0.5) + 1):
		if not is_prime[i]:
			continue
		for j in range(i * 2, n + 1, i):
			is_prime[j] = False
	return [i for i in range(n + 1) if is_prime[i]]


if __name__ == '__main__':
	main()


### FIXED CODE ###

def main():
	x = int(input())
	while not IsPrime(x):
		x += 1
	print(x)

def IsPrime(n):
	if n < 2:
		return False
	elif n == 2:
		return True
	elif n % 2 == 0:
		return False
	
	sqrtN = int(n**0.5)
	for i in range(3, sqrtN, 2):
		if n%i == 0:
			return False
	return True

if __name__ == '__main__':
	main()
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N,M = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(N):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    G[x].append(y)
#G[i]は頂点iから辺でつながっている頂点のlist
def topological_sort(g):
    topological_list = []
    visited = list()

    def dfs(n):
        for e in g[n]:
            if e not in visited:
                dfs(e)
        topological_list.append(n)
        visited.append(n)
    
    for i in range(len(g)):
        if i not in visited:
            dfs(i)
        
    return topological_list[::-1]

T = topological_sort(G)
dist = [0]*N
for n in T:
    for v in G[n]:
        dist[v] = max(dist[v],dist[n]+1)       
        
print(max(dist),T)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N,M = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(M):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    G[x].append(y)
#G[i]は頂点iから辺でつながっている頂点のlist
def topological_sort(g):
    topological_list = []
    visited = set()

    def dfs(n):
        for e in g[n]:
            if e not in visited:
                dfs(e)
        topological_list.append(n)
        visited.add(n)
    
    for i in range(len(g)):
        if i not in visited:
            dfs(i)
        
    return topological_list[::-1]

T = topological_sort(G)
dist = [0]*N
for n in T:
    for v in G[n]:
        dist[v] = max(dist[v],dist[n]+1)       
        
print(max(dist))
1 N, M, K = map(int, input().split())
2 A = list(map(int, input().split()))
3 B = list(map(int, input().split()))
4
5 a, b = [0], [0]
6 for i in range(N):
7 	a.append(a[i] + A[i])
8 for i in range(M):
9 	b.append(b[i] + B[i])
10
11 ans, j = 0, M
12 for i in range(N + 1):
13 　　if a[i] > K:
14 		　break
15 　while b[j] > K - a[i]:
16 　　j -= 1
17 　ans = max(ans, i + j)
18 print(ans)


### FIXED CODE ###

import numpy as np


def main():
    N, M, K = map(int, input().split())
    A = np.array([0] + [int(i) for i in input().split()])
    B = np.array([0] + [int(i) for i in input().split()])

    A.cumsum(out=A)
    B.cumsum(out=B)

    ans = 0
    j = M
    for i in range(N + 1):
        if A[i] > K:
            break
        while B[j] + A[i] > K:
            j -= 1
        ans = max(ans, i + j)

    print(ans)


if __name__ == '__main__':
    main()
n = input()
if n[-1] == '3':
  print('bon')
if n[-1] in ['0', '1', '6', '8']:
  print('pon'):
else:
  print('hon')

### FIXED CODE ###

n = int(input())
if n%10 == 3:
  print('bon')
elif n%10 in [0, 1, 6, 8]:
  print('pon')
else:
  print('hon')
a=map(int, raw_input().split())
a=sorted(a)
for i in range(len(a)):
????????print a[i],

### FIXED CODE ###

a = map(int, raw_input().split())
a.sort()
for i in range(len(a)):
    print a[i],
import numpy as np
import math
n = int(input())
l = np.empty(n)
l = np.nan

k = 0
i = 1
while i <= n ** 0.5:
  if n % i == 0:
    l[k] = i + (n / i) - 2
   　k += 1
  i += 1
print(int(np.nanmin(l)))

### FIXED CODE ###

n = int(input())

for i in range(int(n ** 0.5)):
  if n % (int(n ** 0.5) - i) == 0:
    j = n // (int(n ** 0.5) - i)
    break
    
print(int(n ** 0.5) - i + j - 2)
N,K=map(int,input().split())
P=list(map(int,input().split()))

P.sort()
price=0
for i in range(K):
  price+=P[i]
  
print(price)


### FIXED CODE ###

s=input()
TF=s.isupper()
if TF == True:
  print('A')
else:
  print('a')
from sys import stdin
di = {}
n = int(stdin.readline())
a = map(int,stdin.readline().split())
for i in a:
 di[i] = di.get(i,0) + 1
 di[i-1] = di.get(i-1,0) + 1
 di[i+1] = di.get(i+1,0) + 1
ans = -5
print di
for i in di:
 if di[i] > di.get(ans,0):
  ans = 
print di[ans]

### FIXED CODE ###

from sys import stdin
di = {}
n = int(stdin.readline())
a = map(int,stdin.readline().split())
for i in a:
 di[i] = di.get(i,0) + 1
 di[i-1] = di.get(i-1,0) + 1
 di[i+1] = di.get(i+1,0) + 1
ans = -5
for i in di:
 if di[i] > di.get(ans,0):
  ans = i
print di[ans]
t = input()
t = list(t)

if t[0] == "?":
    if t[1] == "P":
        t[0] = "D"
    else:
        t[0] = "P"
        
for i in range(1, len(t)):
    if t[i] == "?":
        if t[i - 1] == "P":
            t[i] = "D"
        else:
            if t[i + 1] == "P":
                t[i] = "D"
            else:
                t[i] = "P"
                
ans = "".join(t)
print(ans)

### FIXED CODE ###

t = input()
 
ans = t.replace("?", "D")
print(ans)
a,b=[int(i) for i in input().split()]
print(math.gcd(a, b))

### FIXED CODE ###

A, B=[int(i) for i in input().split()]

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def lcm(a, b):
	return a * b // gcd (a, b)
  
print(lcm(A,B))
s = input()
x,y = map(int,input().split())
k = 0
data = [[],[]]
f = 0
p = 1
for s_ in s:
    if p==1 and s_=='F':
        x -= 1
        continue
    p = 0
    if s_ == 'T':
        if f:
            data[k].append(f)
        k = (k+1)%2
        f = 0
    else:
        f += 1
if f:
    data[k].append(f)

nx = sum(data[0])
ny = sum(data[1])

if nx<x or ny<y:
    print('No')
    exit()

dpx = [[0]*((nx+10)*2) for _ in range(len(data[0])+1)]
dpy = [[0]*((ny+10)*2) for _ in range(len(data[1])+1)]
x_zero = nx+5
y_zero = ny+5
dpx[0][x_zero] = 1
dpy[0][y_zero] = 1

for i in range(len(data[0])):
    for j in range(len(dpx[i])):
        if dpx[i][j]==1:
            dpx[i+1][j+data[0][i]] = 1
            dpx[i+1][j-data[0][i]] = 1

for i in range(len(data[1])):
    for j in range(len(dpy[i])):
        if dpy[i][j]==1:
            dpy[i+1][j+data[1][i]] = 1
            dpy[i+1][j-data[1][i]] = 1
if dpx[-1][x_zero+x]==1 and dpy[-1][y_zero+y]==1:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

now=0
idx=-1
data=[[],[]]
cnt=0
for s in input():
    if s=='F':
        cnt+=1
    elif s=='T':
        if idx==-1:
            now+=cnt
            cnt=0
            idx=1
        elif idx==0:
            data[0].append(cnt)
            cnt=0
            idx=1
        elif idx==1:
            data[1].append(cnt)
            cnt=0
            idx=0
if idx==-1:
    now+=cnt
else:
    data[idx].append(cnt)
def solve(target,move):
    dp={0,}
    for m in move:
        dpc=dp.copy()
        dp=set()
        for k in dpc:
            dp|={k-m,k+m}
    if target in dp:
        return True
    return False
x,y=map(int,input().split())
x-=now
if solve(x,data[0]) and solve(y,data[1]):
    print('Yes')
else:
    print('No')
N, X, M = [int(x) for x in input().split()]
copy = M

k = 0
while M % 2 == 0:
    k += 1
    M = M // 2
L = M

order = 1
if L != 1:
    e = 2 % L
    while e != 1:
        order += 1
        e = (2 * e) % L

A = [None] * (k + order)
A[1] = X
for i in range(2, k + order + 1):
    A[i] = (A[i - 1] * A[i - 1]) % copy

S = sum(A[k:])
ans = 0
if N < k:
    ans = sum(A[1:N + 1])
else:
    q, r = (N - k - 1) // order, (N - k - 1) % order
    ans = sum(A[1:k]) + S * q + sum(A[k:k + r])

print(ans)

### FIXED CODE ###

N, X, M = [int(x) for x in input().split()]

A = [0] * (M + 1)
firstApearAt = {i:0 for i in range(M)}
A[1] =  X
firstApearAt[X] = 1
l, r = 1, 2
for i in range(2, M + 1):
    A[i] = (A[i - 1] * A[i - 1]) % M
    if firstApearAt[A[i]] > 0:
        r = i
        l = firstApearAt[A[i]]
        break
    firstApearAt[A[i]] = i

ans = 0
if N <= l - 1:
    ans = sum(A[1:N + 1])
else:
    q, p = (N - l + 1) // (r - l), (N - l + 1) % (r - l)
    ans = sum(A[1:l]) + q * sum(A[l:r]) + sum(A[l:l + p])

print(ans)
s=input()
n=len(s)//2

for x in range(1,n):
  if s[:n-i]==s[n-i:2*n-2*i]:
    print(2*n-2*i)
    break

### FIXED CODE ###

s=input()
n=len(s)//2
 
for i in range(1,n):
  if s[:n-i]==s[n-i:2*n-2*i]:
    print(2*n-2*i)
    break
p,q,r = map(int,input().split())
print(min[p+q,q+r,r+p])

### FIXED CODE ###

p,q,r = map(int,input().split())
print(min([p+q,q+r,r+p]))
A, B, C, K = map(int,input().split())
print(max(A*1*K + B*0*(K-A) + C*-1*(K-A-B)))

### FIXED CODE ###

A, B, C, K = map(int,input().split())
if K <= A:
    print(K)
elif K <= A + B:
    print(A)
else:
    print(A + -1*(K-A-B))
N,K=(int(i) for i in input().split())
hlist=[int(input()) for l in range(N)]
hlist.sort()
for j in range(N-K+2):
    dif=[hlist[j+k]-hlist[j]]
print(min(dif))

### FIXED CODE ###

D=input()
if D=='25':
  print('Christmas')
elif D=='24':
  print('Christmas Eve')
elif D=='23':
  print( 'Christmas Eve Eve')
elif D=='22':
  print('Christmas Eve Eve Eve')
n,m=map(int,input().split())
print(2**m*(18m+n)*100)

### FIXED CODE ###

n,m=map(int,input().split())
print(2**m*(18*m+n)*100)
a11,a12,a13 = input().split()
a21,a22,a23 = input().split()
a31,a32,a33 = input().split()

n = int(input())
b = list()
i = 0

for i in range(n):
    b.append(int(input()))

if a11 in b:
    a11 = 'T'

if a12 in b:
    a12 = 'T'

if a13 in b:
    a13 = 'T'

if a21 in b:
    a21 = 'T'

if a22 in b:
    a22 = 'T'

if a23 in b:
    a23 = 'T'

if a31 in b:
    a31 = 'T'

if a32 in b:
    a32 = 'T'

if a33 in b:
    a33 = 'T'

if a11 == 'T':
    if a12 == 'T':
        if a13 == 'T':
            print('Yes')
            exit()
    
    if a22 == 'T':
        if a33 == 'T':
            print('Yes')
            exit()
    
    if a21 == 'T':
        if a31 == 'T':
            print('Yes')
            exit()

elif a12 == 'T':
    if a22 == 'T':
        if a32 == 'T':
            print('Yes')
            exit()

elif a13 == 'T':
    if a22 == 'T':
        if a31 == 'T':
            print('Yes')
            exit()

     if a23 == 'T':
        if a33 == 'T':
            print('Yes')
            exit()

elif a21 == 'T':
    if a22 == 'T':
        if a23 == 'T':
            print('Yes')
            exit()

elif a31 == 'T':
    if a32 == 'T':
        if a33 == 'T':
            print('Yes')
            exit()

else:
    print('No')

### FIXED CODE ###

x = list(map(int,input().split()))
y = list(map(int,input().split()))
z = list(map(int,input().split()))
n = int(input())
b = list(int(input()) for i in range(n))

for i in range(n):
    if b[i] in x:
        x[x.index(b[i])] = 'T'
    if b[i] in y:
        y[y.index(b[i])] = 'T'
    if b[i] in z:
        z[z.index(b[i])] = 'T'

if x[0] == 'T' and x[1] == 'T' and x[2] == 'T':
    print('Yes')
elif y[0] == 'T' and y[1] == 'T' and y[2] == 'T':
    print('Yes')
elif z[0] == 'T' and z[1] == 'T' and z[2] == 'T':
    print('Yes')
elif x[0] == 'T' and y[0] == 'T' and z[0] == 'T':
    print('Yes')
elif x[1] == 'T' and y[1] == 'T' and z[1] == 'T':
    print('Yes')
elif x[2] == 'T' and y[2] == 'T' and z[2] == 'T':
    print('Yes')
elif x[0] == 'T' and y[1] == 'T' and z[2] == 'T':
    print('Yes')
elif x[2] == 'T' and y[1] == 'T' and z[0] == 'T':
    print('Yes')
else:
    print('No')
N,M = map(int, input().split())
s = [0] * M
c = [0] * M

for i in range(M):
    s[i], c[i]= map(int, input().split())
    
n=[-1]*N
w=True
for i in range(M):
    if n[s[i]-1]==-1:
        n[s[i]-1]=c[i]
    if n[s[i]-1]!=-1 and n[s[i]-1]==c[i]:
        n[s[i]-1]=c[i]
    if n[s[i]-1]!=-1 and n[s[i]-1]!=c[i]:
        w=False
if  n[0]==0 and N!=1:
    w=False
if  n[0]==-1 and N!=1:
    n[0]=1
if N>1:
    if n[1]==-1:
        n[1]=0
    if n[2]==-1:
        n[2]=0
num=''
for i in n:
    num+=str(i)
if w:
    print(num)
else:
    print('-1')
    

### FIXED CODE ###

N,M = map(int, input().split())
s = [0] * M
c = [0] * M

for i in range(M):
    s[i], c[i]= map(int, input().split())
    
n=[-1]*N
w=True
for i in range(M):
    if n[s[i]-1]==-1:
        n[s[i]-1]=c[i]
    if n[s[i]-1]!=-1 and n[s[i]-1]==c[i]:
        n[s[i]-1]=c[i]
    if n[s[i]-1]!=-1 and n[s[i]-1]!=c[i]:
        w=False
if  n[0]==0 and N!=1:
    w=False
if  n[0]==-1 and N!=1:
    n[0]=1
if n[0]==-1 and N==1:
    n[0]=0
if N==3:
    if n[1]==-1:
        n[1]=0
    if n[2]==-1:
        n[2]=0
if N==2:
    if n[1]==-1:
        n[1]=0
num=''
for i in n:
    num+=str(i)
if w:
    print(num)
else:
    print('-1')
from bisect import *
n = int(input())
abc = [sorted(list(map(int, input().split()))) for i in range(3)]
print(sum([bisect.bisect_left(abc[0], b)*(n-bisect.bisect_right(abc[2], b)) for b in abc[1]]))

### FIXED CODE ###

import bisect
n = int(input())
abc = [sorted(list(map(int, input().split()))) for i in range(3)]
print(sum([bisect.bisect_left(abc[0], b)*(n-bisect.bisect_right(abc[2], b)) for b in abc[1]]))
N, M = map(int, input().split())
E = [[] for i in range(N)]
RE = [[] for i in range(N)]
for i in range(M):
  u, v = map(int, input().split())
  E[u - 1].append(v - 1)
  RE[v - 1].append(u - 1)
S, T = map(int, input().split())
RD = [-1] * N
RD[T - 1] = 0
Q = [T - 1]
while Q:
  q = Q.pop(0)
  for adj in RE[q]:
    if RD[adj] == -1:
      RD[adj] = RD[q] + 1
      Q.append(adj)
D = [[-1, -1, -1] for i in range(N)]
Q = [[-1, -1, -1] for i in range(M)]
Q[0] = [S - 1, 0, RD[S - 1] % 3]
o = 0
i = 1
while Q:
  q, d, m = Q[o]
  Q[o] = [-1, -1, -1]
  o = (o + 1) % N
  if q == -1:
    break
  if RD[q] == -1:
    continue
  D[q][m] = d + RD[q]
  if m != 0:
    for adj in E[q]:
      _m = (d + 1 + RD[adj]) % 3
      if D[adj][_m] == -1:
        Q[i] = [adj, d + 1, _m]
        i = (i + 1) % N
P = [d[0] for d in D if d[0] != -1]
if P:
  print(min(P) // 3)
else:
  print(-1)

### FIXED CODE ###

N, M = map(int, input().split())
E = [[] for i in range(N)]
RE = [[] for i in range(N)]
for i in range(M):
  u, v = map(int, input().split())
  E[u - 1].append(v - 1)
  RE[v - 1].append(u - 1)
S, T = map(int, input().split())
RD = [-1] * N
RD[T - 1] = 0
Q = [T - 1]
while Q:
  q = Q.pop(0)
  for adj in RE[q]:
    if RD[adj] == -1:
      RD[adj] = RD[q] + 1
      Q.append(adj)
D = [[-1, -1, -1] for i in range(N)]
Q = [[-1, -1, -1] for i in range(M)]
if M:
  Q[0] = [S - 1, 0, RD[S - 1] % 3]
o = 0
i = 1
while Q:
  q, d, m = Q[o]
  Q[o] = [-1, -1, -1]
  o = (o + 1) % M
  if q == -1:
    break
  if RD[q] == -1:
    continue
  D[q][m] = d + RD[q]
  if m != 0:
    for adj in E[q]:
      _m = (d + 1 + RD[adj]) % 3
      if D[adj][_m] == -1:
        Q[i] = [adj, d + 1, _m]
        i = (i + 1) % M
P = [d[0] for d in D if d[0] != -1]
if P:
  print(min(P) // 3)
else:
  print(-1)
m_h=[int(input(I) for i in range(10)]

m_h.sort(reverse=True)

print(m_h[0])
print(m_h[1])
print(m_h[2])

### FIXED CODE ###

m_h=[int(input()) for i in range(10)]

m_h.sort(reverse=True)

print(m_h[0])
print(m_h[1])
print(m_h[2])
A = list(int,input().split())
if (A.count(5)) == 2 and (A.count(7)) == 1:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

A = list(map(int,input().split()))
if (A.count(5)) == 2 and (A.count(7)) == 1:
  print("YES")
else:
  print("NO")
n = int(input())
if n == 1:
  orint("Hello World")
else:
  a = int(input())
  b = int(input())
  print(a+b)

### FIXED CODE ###

n = int(input())
if n == 1:
  print("Hello World")
else:
  a = int(input())
  b = int(input())
  print(a+b)
( a, b) = input().sprit()
a = int(a)
b = int(b)
print(a*b a*2+b*2)

### FIXED CODE ###

( a, b) = input().split()
a = int(a)
b = int(b)
print(a*b, a*2+b*2)
from sys import stdin
import math

a = int(stdin.readline().rstrip())
b = int(stdin.readline().rstrip())

print(a * b // math.gcd(a, b))


### FIXED CODE ###


import fractions

a, b = map(int, input().split())

print(a * b // fractions.gcd(a, b))
n = int(input())
a = str(input()).split()
b = str(input()).split()
c = [a,b]
d = [a,b]
def max(x,y):
    if x > y:
    return x
    else:
    return y 
for j in range(0,2):
    for k in range(0,n):
        if j == 0 and k == 0:
            d[j][k] = int(c[j][k])
        elif j  == 0:
            d[j][k] = d[j][k-1] + int(c[j][k])
        elif k == 0:
            d[j][k] = d[j-1][k] + int(c[j][k])
        else:
            d[j][k] = max(d[j][k-1],d[j-1][k]) + int(c[j][k])
print(d[1][n-1])

   

### FIXED CODE ###

n = int(input())
a = str(input()).split()
b = str(input()).split()
c = [a,b]
d = [a,b]
def max(x,y):
    if x > y:
        return x
    else:
        return y 
for j in range(0,2):
    for k in range(0,n):
        if j == 0 and k == 0:
            d[j][k] = int(c[j][k])
        elif j  == 0:
            d[j][k] = d[j][k-1] + int(c[j][k])
        elif k == 0:
            d[j][k] = d[j-1][k] + int(c[j][k])
        else:
            d[j][k] = max(d[j][k-1],d[j-1][k]) + int(c[j][k])
print(d[1][n-1])
N,X=(int(x) for x in input().split())
burger=[]
burger.append('P')
for i in range(N):
    burger.append('B'+burger[-1]+'P'+burger[-1]+'B')
print(burger[-1][0:X].count('P'))

### FIXED CODE ###

D=input()
intD=int(D)
if intD==25:
    print('Christmas')
elif intD==24:
     print('Christmas Eve')
elif intD==23:
    print('Christmas Eve Eve')
elif intD==22:
    print('Christmas Eve Eve Eve')
else:
    print('Error')
while True:
    x, y = map(int, input().split())
    if (x > y):
        print(y, x)
    else:
        print(x, y)

### FIXED CODE ###

while True:
    x, y = map(int, input().split())
    if (x == y == 0):
        break
    elif (x > y):
        print(y, x)
    else:
        print(x, y)
a, b, c = map(int, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')
n=int(input())
array=list(map(int,input().split()))
ans=1
if 0 in array:
  ans=0
else:
  for i in range(n):
  if ans>10**18:
    break
  else:
    ans=ans*array[i]
if ans>10**18:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

n=int(input())
array=list(map(int,input().split()))
ans=1
if 0 in array:
  ans=0
else:
  for i in range(n):
    if ans>10**18:
      break
    else:
      ans=ans*array[i]
if ans>10**18:
  print(-1)
else:
  print(ans)
mport sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numba import njit
 
MOD = 10**9 + 7
 
N = int(readline())
S = np.array(list(read().rstrip()), np.int8)
 
R = np.sum(S == ord('R'))
B = np.sum(S == ord('B'))
G = np.sum(S == ord('G'))
 
@njit
def f(S):
    N = len(S)
    ret = 0
    for i in range(N):
        for j in range(i + 1, N):
            k = j + j - i
            if k >= N:
                break
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                ret += 1
    return ret
 
answer = R * B * G - f(S)
print(answer)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numba import njit
 
MOD = 10**9 + 7
 
N = int(readline())
S = np.array(list(read().rstrip()), np.int8)
 
R = np.sum(S == ord('R'))
B = np.sum(S == ord('B'))
G = np.sum(S == ord('G'))
 
@njit
def f(S):
    N = len(S)
    ret = 0
    for i in range(N):
        for j in range(i + 1, N):
            k = j + j - i
            if k >= N:
                break
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                ret += 1
    return ret
 
answer = R * B * G - f(S)
print(answer)
N, P = map(int, input().split())

i = 2
ans = 1
while True:
    if i**N > P:
        break
    if P % i**N == 0:
        P /= i**N
        ans *= i
    else:
        i += 1

print(ans)

### FIXED CODE ###

import os
N, P = map(int, input().split())

def trial_division(n):
    if n < 2:
        return []
    prime_factors = []
    for p in range(2, int( n**0.5)):
        if p*p > n: break
        cnt = 0
        while n % p == 0:
            cnt += 1
            n //= p
        prime_factors.append([p, cnt])
    if n > 1:
        prime_factors.append([n, 1])
    return prime_factors

prime_factors = trial_division(P)
ans = 1
for p in prime_factors:
    if p[1] >= N:
        ans *= p[0]**(p[1] // N)
print(ans)