Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from fractions import gcd

n=int(input())
a=list(map(int,input().split()))

'''
lcm=1
for i in a:
 lcm=(lcm*i)//gcd(lcm,i)

ans=0
mod=10**9+7
for i in a:
 ans+=lcm//i
 ans%=mod
print(ans)
'''

from functools import reduce

lcm=reduce(lambda x,y :(x*y)//gcd(x,y),a)
ans=0
mod=10**9+7
for i in a:
 ans+=lcm//i
 ans%=mod
print(ans)

### FIXED CODE ###

from fractions import gcd

n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

'''
lcm=1
for i in a:
 lcm=(lcm*i)//gcd(lcm,i)

ans=0
mod=10**9+7
for i in a:
 ans+=lcm//i
 ans%=mod
print(ans)
'''

from functools import reduce

lcm=reduce(lambda x,y :(x*y)//gcd(x,y),a)

'''
ans=0
mod=10**9+7
for i in a:
 ans+=lcm//i
 ans%=mod
'''
ans=sum(lcm//i for i in a)
ans%=mod
print(ans)
### BUGGY CODE ###

N = int(input())
u = ["".join(sorted(list(input()))) for i in range(N)]
ans = 0
for i in range(N):
  ans += u[i:].count(u[i]) - 1
print(ans)

### FIXED CODE ###

N = int(input())
u = ["".join(sorted(list(input()))) for i in range(N)]
d = {}
for i in range(N):
  if u[i] in d:
    d[u[i]] += 1
  else:
    d[u[i]] = 1
ans = sum((i * (i - 1)) // 2 for i in d.values())
print(ans)
### BUGGY CODE ###

def main():
    N = int(input())
    A = [0 for x in range(N)]
    B = [0 for x  in  range(N)]
    for i in range(N):
        l = list(map(int,input().split(" ")))
        A[i] = l
    sortedA=sorted(A, key= lambda x: x[1])
    ans='No'
    for i,x in enumerate(sortedA):
        s=0
        for ind in range(i+1):
            s+=sortedA[ind][0]
        if  s>x[1]:
            return 'No'
    return 'Yes'
    
if __name__ == "__main__":
    print(main())


### FIXED CODE ###

def main():
    N = int(input())
    A = [0 for x in range(N)]
    for i in range(N):
        A[i] = list(map(int, input().split(" ")))
    sortedA = sorted(A, key=lambda x: x[1])
    s = [0 for _ in range(N)]
    for i, x in enumerate(sortedA):
        if i == 0:
            s[i] = x[0]
        else:
            s[i] = s[i-1]+x[0]

        if s[i] > x[1]:
            return 'No'
    return 'Yes'


if __name__ == "__main__":
    print(main())
### BUGGY CODE ###

N, Q = map(int, input().split())
S=input()
for i in range(Q):
  L,R=map(int, input().split())
  ACsum=S[L-1:R].split("AC")
  print(len(ACsum)-1)

### FIXED CODE ###

N, Q = map(int, input().split())
S=list(input())
Snum=list()
Snum.append(0)
Snum.append(0)
for i in range(1,N):
  if S[i]=="C" and S[i-1]=="A":
    Snum.append(Snum[i]+1)
  else:
    Snum.append(Snum[i])
for i in range(Q):
  L,R=map(int, input().split())
  print(Snum[R]-Snum[L])
### BUGGY CODE ###

MOD = 10 ** 9 + 7

c = [[0 for i in range(4005)] for j in range(4005)]
c[0][0] = 1
for i in range(4001):
    for j in range(i+1):
        c[i+1][j] += c[i][j]
        c[i+1][j+1] += c[i][j]

def comb(n, k):
    return c[n][k]

def f2(n, k):
    return comb(n+k-1, k-1)

def f(n, k):
    if n == k: return 1
    if n < k: return 0
    if k < 1: return 0
    return f2(n-k, k)

n, k = map(int, input().split())
for i in range(1, k+1):
    blue = f(k, i)
    # 赤が両端含まない
    red = f(n-k, i-1)
    # 赤が右側含む
    red += f(n-k,i)
    # 赤が左側含む
    red += f(n-k,i)
    # 赤が両端含む1
    red += f(n-k,i+1)
    print(blue*red%MOD)




### FIXED CODE ###

N, K = map(int, input().split())
MOD = 10 ** 9 + 7

MAX = 4000
fact = [0] * MAX
invfact = [0] * MAX
fact[0] = 1
for i in range(1, MAX):
    fact[i] = fact[i - 1] * i % MOD
invfact[MAX - 1] = pow(fact[MAX - 1], MOD-2, MOD)
for i in range(MAX - 2, -1, -1):
    invfact[i] = invfact[i+1] * (i+1) % MOD

def nCk(n, k):
    if k < 0 or n < k: return 0
    return (fact[n] * invfact[k] % MOD) * invfact[n-k] % MOD

ans = 0
red = N - K
for i in range(1,1+K):
    ans = nCk(red+1, i) * nCk(K-1, i-1)
    ans %= MOD
    print(ans)
### BUGGY CODE ###

import heapq
n,m = map(int,input().split())
a = [int(i) for i in input().split()]
b = [[int(i) for i in input().split()] for _ in range(m)]

heapq.heapify(a)
c = 0
for i in range(m) :
    B = b[i][0]
    C = b[i][1]
    for i in range(B) :
        if a[0] < C :
            heapq.heappop(a)
            c += 1
    for i in range(c) :
        heapq.heappush(a,C)
    c = 0

print(sum(a))

### FIXED CODE ###

n,m = map(int,input().split())
a = [int(i) for i in input().split()]
b = [[int(i) for i in input().split()] for _ in range(m)]
a.sort()
b = sorted(b,key = lambda  x: x[1],reverse=True)
d = []
j = 0
while (n<=len(a) or j<m) :
    C = b[j][1]
    B = b[j][0]
    for i in range(B) :
        d.append(C)
    j += 1
    if j>=m or len(d) > len(a) :
        break

for i in range(min(len(d),len(a))) :
    if a[i] < d[i] :
        a[i] = d[i]

print(sum(a))
### BUGGY CODE ###

# -*- coding: utf-8 -*-

import copy

def main():
    n = int(input())
    x = list(map(int, input().split()))

    for i in range(n):
        t = copy.deepcopy(x)
        del t[i]
        t.sort()
        print(t[int(n / 2 - 1)])

if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-

import copy

def main():
    n = int(input())
    x = list(map(int, input().split()))

    t = copy.deepcopy(x)
    t.remove(min(x))
    t.sort()
    m1 = t[int(n / 2 - 1)]
    t = copy.deepcopy(x)
    t.remove(max(x))
    t.sort()
    m2 = t[int(n / 2 - 1)]
    for i in range(n):
        print(m1 if x[i] < m1 else m2)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

n,x,y=map(int, input().split())
es=[[] for _ in range(n)]
for i in range(n):
    if i<n-1:
        es[i].append([1,i+1])
    if i>0:
        es[i].append([1,i-1])
    es[x-1].append([1,y-1])
    es[y-1].append([1,x-1])

import heapq

def dijkstra_heap(s):
    #始点sから各頂点への最短距離
    d = [float("inf")] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in es[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in es[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+d[v],e[1]])
    return d

from collections import defaultdict
ans=defaultdict(int)
dists=[]
for i in range(n-1):
    a=dijkstra_heap(i)[i+1:]
    for aa in a:
        ans[aa]+=1

for i in range(1,n):
    print(ans[i])

### FIXED CODE ###

n,x,y=map(int, input().split())
es=[[] for _ in range(n)]
for i in range(n):
    if i<n-1:
        es[i].append([1,i+1])
    if i>0:
        es[i].append([1,i-1])
    es[x-1].append([1,y-1])
    es[y-1].append([1,x-1])

import heapq

def dijkstra_heap(s):
    d = [float("inf")] * n
    used = [True] * n
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in es[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in es[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+d[v],e[1]])
    return d

from collections import defaultdict, Counter
from copy import deepcopy
dist=dijkstra_heap(0)
distx=dijkstra_heap(x-1)
disty=dijkstra_heap(y-1)
counts=[]
for i in range(n-1):
    if i<x-1:
        tmp=[d-i for d in dist[i:]]
        counts.append(Counter(tmp))
    elif x-1<=i<y-1:
        tmp=[min(distx[i]+distx[d], disty[i]+disty[d], abs(d-i)) for d in range(i,n)]
        counts.append(Counter(tmp))
    else:
        tmp=[disty[d]-disty[i] for d in range(i,n)]
        counts.append(Counter(tmp))
ans=defaultdict(int)

for i in range(n-1):
    keys=counts[i].keys()
    for kk in keys:
        ans[kk]+=counts[i][kk]

for i in range(1,n):
    print(ans[i])
### BUGGY CODE ###

n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = 0

def chr(a,l):
#    print(a,l)
    if a == n:
        x = 0
        y = 0
        for i in range(n):
            x += v[i]*l[i]
            y += c[i]*l[i]
        return(x-y)
    else:
        l[a] = 1
        ans1 = chr(a+1,l)
        l[a] = 0
        ans2 = chr(a+1,l)
    return(max(ans1,ans2))
    
l = [0 for i in range(n)]
print(chr(0,l))

### FIXED CODE ###

n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))

ans = []
def chr(a,l,r):
    global ans
    if a == n:
        ans.append(r-l)
    else:
        chr(a+1,l+c[a],r+v[a])
        chr(a+1,l,r)
chr(0,0,0)
print(max(ans))
### BUGGY CODE ###

n = int(input())
A = list(map(int, input().split()))
set_A = set(A)

ans = 1

if n%2==0:
  for a_i in set_A:
    if A.count(a_i)!=2:
      ans = 0
      break
else:
  if A.count(0)!=1:
    ans = 0
  
  set_A.remove(0)
  for a_i in set_A:
    if A.count(a_i)!=2:
      ans = 0
      break
      
if ans!=0:
  ans = 2**(len(set_A))

print(ans%(10**9+7))

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
set_A = set(A)

ans = 1

if n%2==0:
  if n//2 != len(set(A)):
    ans = 0
else:
  if A.count(0)!=1:
    ans = 0
  
  set_A.remove(0)
  if (n-1)//2 != len(set_A):
    ans = 0
      
if ans!=0:
  ans = 2**(len(set_A))

print(ans%(10**9+7))
### BUGGY CODE ###

import time
import math

def main():
    N, M = [int(n) for n in input().split()]
    A = [int(n) for n in input().split()]
    B = [0]*(N+1)
    B[0] = 0
    d = {}
    for i in range(N):
        B[i+1] = B[i] + A[i]
    for i, b in enumerate(B):
        x = b % M
        if x in d.keys():
            d[x] += 1
        else:
            d[x] = 1
    # print(B)
    print(sum([C(i, 2) for i in d.values()]))
        
    
def C(n, r):
    if n < 0 or r<0 or n<r:
        return 0
    f = math.factorial
    return f(n) // (f(n-r) * f(r))


# import os,sys, time

# current = os.path.abspath(__file__ + "/..")+"/"
# fdr = open(current + "d-case1.txt", "r")
# sys.stdin = fdr
# t = time.time()
# main()
# print(time.time() - t)

main()


### FIXED CODE ###


def main():
    N, M = [int(n) for n in input().split()]
    A = [int(n) for n in input().split()]
    B = [0]*(N+1)
    B[0] = 0
    d = {}
    accum = 0
    for i in range(N+1):
        B[i] = accum
        if i != N:
            accum += A[i]
    
    for i, b in enumerate(B):
        x = b % M
        if x in d.keys():
            d[x] += 1
        else:
            d[x] = 1
    # print(B)
    print(sum([i * (i - 1)//2 for i in d.values()]))
        
# import os,sys, time

# current = os.path.abspath(__file__ + "/..")+"/"
# fdr = open(current + "d-case1.txt", "r")
# sys.stdin = fdr
# t = time.time()
# main()
# print(time.time() - t)
if __name__ == "__main__":
    main()
### BUGGY CODE ###

import itertools

n,m,R=map(int,input().split())
r=list(map(int,input().split()))
INF = 10**10
d=[[INF for i in range(n)] for i in range(n)]

for i in range(m):
    a,b,c=map(int,input().split())
    d[a-1][b-1]=c
    d[b-1][a-1]=c

for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j] ,d[i][k] +d[k][j])

for i in range(R):
    r[i] -= 1

res = INF
for rp in itertools.permutations(r):
    tres = 0
    for i in range(R-1):
        tres += d[rp[i]][rp[i+1]]
    res = min(res,tres)

print(res)

### FIXED CODE ###

import itertools

n,m,R=map(int,input().split())
r=list(map(int,input().split()))
INF = 10**10
d=[[INF for i in range(n)] for i in range(n)]

for i in range(m):
    a,b,c=map(int,input().split())
    d[a-1][b-1]=c
    d[b-1][a-1]=c

for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j] ,d[i][k] +d[k][j])

for i in range(R):
    r[i] -= 1

res = INF
for rp in itertools.permutations(r):
    tres = 0
    for i in range(R-1):
        tres += d[rp[i]][rp[i+1]]
    res = min(res,tres)

print(res)
### BUGGY CODE ###

n=int(input())

x=0
while 1:
  if x**2>n:
    print((x-1)**2)
  x+=1

### FIXED CODE ###

import math
print(math.floor(math.sqrt(int(input())))**2)
### BUGGY CODE ###

import numpy as np
N,M = map(int , input().split())
A=[map(int , input().split()) for _ in range(M)]
data = np.zeros(N)
for L,R in A:
	data[L-1:R] +=1
print(np.sum(data == M)) 

### FIXED CODE ###

N,M = map(int , input().split())
A=[map(int , input().split()) for _ in range(M)]
L_min = 0
R_max = N
for L,R in A:
	L_min = max(L_min , L)
	R_max = min(R_max , R)

if R_max - L_min+1 >=0:
	print(R_max - L_min+1)
else:
	print(0)
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, W, K = MAP()
S = np.array([list(map(int, list(input()))) for _ in range(H)])

ans = INF
for x in product([0, 1], repeat=H-1):
	cut = sum(x)
	if cut >= ans:
			continue
	if any(x):
		lis = np.zeros((H, W+1))
		tmp_lis = np.zeros((W))
		idx = 0
		for i, n in enumerate(x):
			tmp_lis += S[i]
			if n:
				lis[idx][1:] += tmp_lis
				idx += 1
				tmp_lis = np.zeros((W))
				
		if H >= 2:
			tmp_lis += S[-1]
			lis[idx][1:] += tmp_lis
		if (lis>K).sum():
			continue
		lis = lis.cumsum(axis=1)
	else:
		lis = np.sum(S, axis=0)
		tmp = 0
		for n in lis:
			if n > K:
				cut = INF
				break
			tmp += n
			if tmp > K:
				cut += 1
				tmp = n
		ans = min(ans, cut)
		continue
	idxs = []
	idx = 0
	while idx != W:
		for i in range(len(lis)):
			for j in range(idx, W+1):
				if lis[i][j]-lis[i][idx] > K:  # 1番最初にKを超えるところを探す
					idxs.append(j)

		if not idxs:  # 超えない
			break

		idx = min(idxs)-1
		idxs = []
		cut += 1
		if cut >= ans:
			break
	ans = min(ans, cut)

print(ans)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	H, W, K = MAP()
	S = np.array([list(map(int, list(input()))) for _ in range(H)])

	ans = INF
	for x in product([0, 1], repeat=H-1):
		cut = np.sum(x)
		if cut >= ans:
				continue
		r = 0
		l = []
		for i in range(H-1):
			if x[i]:
				l.append(np.sum(S[r:i+1, :], axis=0))
				r = i + 1
		l.append(np.sum(S[r:, :], axis=0))
		l = np.array(l)
		if np.max(l) > K:
			continue
		tmp = np.zeros(len(l), dtype=int)
		for i in range(W):
			tmp += l[:, i]
			if np.max(tmp) > K:
				cut += 1
				tmp = l[:, i]
			if cut >= ans:
				break

		ans = ans if ans <= cut else cut

	print(ans)

if __name__ == '__main__':
	main()
### BUGGY CODE ###

# D - Friend Suggestions
N,M,K = map(int,input().split())
friend = [set() for _ in range(N+1)]
block = [set() for _ in range(N+1)]
friendly = [{i} for i in range(N+1)]
for _ in range(M):
    x,y = map(int,input().split())
    friend[x].add(y)
    friend[y].add(x)
    if y not in friendly[x]:
        friendly[x].add(y)
        friendly[y].add(x)
    friend_x = set(friendly[x])
    friend_y = set(friendly[y])
    for w in friend_x:
        friendly[w].add(y)
        for z in friend_y:
            friendly[w].add(z)
    for w in friend_y:
        friendly[w].add(x)
        for z in friend_x:
            friendly[w].add(z)
for _ in range(K):
    x,y = map(int,input().split())
    block[x].add(y)
    block[y].add(x)
ans = []
for i in range(1,N+1):
    tmp = []
    for x in friendly[i]:
        if x!=i and x not in friend[i] and x not in block[i]:
            tmp.append(x)
    ans.append(len(tmp))
print(*ans)

### FIXED CODE ###

# D - Friend Suggestions

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def root(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.root(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if x == y:
            return
        
        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def same(self, x, y):
        return self.root(x) == self.root(y)

    def size(self, x):
        return -self.parents[self.root(x)]

N,M,K = map(int,input().split())
friend = UnionFind(N+1)
block = [1]*(N+1)
for _ in range(M):
    x,y = map(int,input().split())
    block[x] += 1
    block[y] += 1
    friend.union(x,y)
for _ in range(K):
    x,y = map(int,input().split())
    if friend.same(x,y):
        block[x] += 1
        block[y] += 1
ans = [friend.size(i)-block[i] for i in range(1,N+1)]
print(*ans)
### BUGGY CODE ###

n = int(input())
a_list = list(map(int,input().split()))
ans = 1
for i in a_list:
    ans *= i
if ans <= 10**18:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

n = int(input())
a_list = list(map(int,input().split()))
if 0 in a_list:
    print(0)
    exit()
ans = 1
for i in a_list:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
### BUGGY CODE ###

N,M=map(int,input().split())
A=[0 for i in range(N)]
for i in range(M):
    L,R=map(int,input().split())
    for t in range(L-1,R):
        A[t]+=1
cnt=A.count(M)
print(cnt)

### FIXED CODE ###

N,M=map(int,input().split())
l=[]
r=[]
for i in range(M):
    L,R=map(int,input().split())
    l.append(L)
    r.append(R)
big=min(r)
small=max(l)
print(big-small+1 if big-small>=0 else 0)
### BUGGY CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N,M = map(int,input().split())
count = [[0]*N for _ in range(N)]
fr = [[] for _ in range(N)]
for _ in range(M):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    if count[a][b] == 1:
        continue
    count[a][b] = 1
    count[b][a] = 1
    fr[a].append(b)
    fr[b].append(a)
used = [-1]*N 
MAX = 0
def dfs(fr,cur,parent):
    global cnt
    children = fr[cur]
    for chi in children:
        if chi == parent or used[chi] != -1:
            continue
        used[chi] = 0
        cnt += 1
        dfs(fr,chi,cur)
    return

for i in range(N):
    cnt = 1
    if used[i] != -1:
        continue
    used[i] = 0
    dfs(fr,i,-1)
    MAX = max(MAX, cnt)
print(MAX)

            








### FIXED CODE ###

# Union Find
#0オリジン以下注意

#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
    
def unite(x, y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きい方がx
        if par[x] > par[y]:
            x, y = y, x
        par[x] += par[y] #ここで集合の個数を更新している
        par[y] = x
        return True
    
#xとyが同じ集合に含まれているかどうかを判定(同じ集合にあればTrue)
def same(x, y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]

#初期化
#根なら-size, 子なら親の頂点
n, m = map(int, input().split())
par = [-1]*n
for i in range(m):
    a, b = map(int, input().split())
    unite(a-1, b-1)
M = 0
for i in range(n):
    M = max(M, size(i))
print(M)

################以下にコードを書く
######2次元配列が与えられたら１次元に直す必要あり
### BUGGY CODE ###

import sys
from sys import stdin
input = sys.stdin.readline
X, Y, A, B, C = (int(i) for i in input().split())
p = [[int(x), "A"] for x in input().split()]
q = [[int(x), "B"] for x in input().split()]
r = [[int(x), "C"] for x in input().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]
apples = p+q+r


apples.sort(reverse=True)
#print(apples)
ans = 0
pend = 0

while (X > 0 or Y > 0) and X+Y > pend:
    #print(apples)
    if apples[0][1] == "C":
        pend += 1
        ans += apples[0][0]
        apples.pop(0)
    elif apples[0][1] == "A":
        if X > 0:
            ans += apples[0][0]
            apples.pop(0)
            X -= 1
        else:
            apples.pop(0)
    elif apples[0][1] == "B":
        if Y>0:
            ans += apples[0][0]
            apples.pop(0)
            Y -= 1
        else:
            apples.pop(0)
    #print(ans)
    #print("XY", X, Y, pend)
#print("XY", X, Y, pend)
print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline
X, Y, A, B, C = (int(i) for i in input().split())
p = [[int(x), "A"] for x in input().split()]
q = [[int(x), "B"] for x in input().split()]
r = [[int(x), "C"] for x in input().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]
apples = p+q+r


apples.sort(reverse=True)
#print(apples)
ans = 0
pend = 0


for hapi, col in apples:
    if col == "C":
        pend += 1
        ans += hapi
    elif col == "A":
        if X > 0:
            ans += hapi
            X -= 1

    elif col == "B":
        if Y>0:
            ans += hapi
            Y -= 1

    if (X < 1 and Y < 1) or X+Y == pend:
        break
    #print(ans)
    #print("XY", X, Y, pend)
#print("XY", X, Y, pend)
print(ans)
### BUGGY CODE ###

n = int(input())
C = [c for c in input()]

ans = 0
cnt = 0
w = 0
r = n-1
while True:
    cnt = w
    while cnt < n and C[cnt] != 'W': cnt += 1
    if cnt >= n:
        print(ans)
        exit()
    else:
        w = cnt
        while cnt+1 < n and C[cnt+1] != 'R': cnt += 1
        if cnt+1 >= n:
            print(ans)
            exit()
        else:
            while cnt != r and C[r] != 'R': r -= 1
            if cnt == r:
                print(ans)
                exit()
            else:
                ans += 1
                C[w], C[r] = C[r], C[w]

### FIXED CODE ###

n = int(input())
C = [c for c in input()]
Red = []
White = []
len_Red = 0
len_White = 0
for i in range(n):
    if C[i] == 'R':
        Red.append(i)
        len_Red += 1
    else:
        White.append(i)
        len_White += 1

ans = 0
cnt = 0
w = 0
r = len_Red - 1
while True:
    if w < len_White:
        cnt = White[w]
        w += 1
    else:
        print(ans)
        exit()
    if r >= 0 and cnt < Red[r]:
        C[cnt], C[r] = C[r], C[cnt]
        ans += 1
        r -= 1
    else:
        print(ans)
        exit()
### BUGGY CODE ###

n=int(input())
list=[int(i) for i in input().split()]
x=list[0]
k=1
while k<n:
  y=x*list[k]
  x=y
  k=k+1
if y>1000000000000000000:
  print(-1)
else:
  print(y)

### FIXED CODE ###

n=int(input())
list=[int(i) for i in input().split()]
k=1
list.sort()
x=list[0]
while k<n:
  y=x*list[k]
  x=y
  if y<=1000000000000000000:
    k=k+1
  else:
    k=n+1
    y=-1
print(y)