Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    from collections import defaultdict
    #nの素因数分解，[[a1,b1],[a2,b2]...]   aがb個,
    def factorization(n):
        if n==1:
            return [0,1]
        arr = []
        temp = n
        for i in range(2, int(-(-n**0.5//1))+1):
            if temp%i==0:
                cnt=0
                while temp%i==0:
                    cnt+=1
                    temp //= i
                arr.append([i, cnt])

        if temp!=1:
            arr.append([temp, 1])

        if arr==[]:
            arr.append([n, 1])

        return arr
    
    lcm_dd = defaultdict(int)
    
    N=I()
    A=LI()
    L=[]
    for i in range(N):
        a=A[i]
        arr=factorization(a)
        for v in arr:
            p,cnt=v
            lcm_dd[p]=max(lcm_dd[p],cnt)
            
    lcm=1
    for k,v in lcm_dd.items():
        temp=pow(k,v,mod)
        lcm=(lcm*temp)%mod
        
    ans=0
    for i in range(N):
        temp=(lcm*pow(A[i],mod-2,mod))%mod
        ans=ans+temp
        
    print(ans%mod)
        
    


main()


### FIXED CODE ###

from collections import defaultdict
import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
lcm = defaultdict(int)


for i in range(N):
    a=A[i]
    for j in range(2,a):
        temp=0
        while a%j==0:
            a=a//j
            temp+=1
        lcm[j]=max(lcm[j],temp)
        if a==1 or j*j>A[i]:
            break
    if a!=1:
        lcm[a]=max(lcm[a],1)
                
        
l=1
for d in lcm.items():
    l*=pow(d[0],d[1])
    

ans=0
mod=10**9+7

for i in range(N):
    ans+=l//A[i]
    
print(ans%mod)
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
import re
 
s = input()
k = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
c = collections.Counter(s)

def nchars(s, n):
    """文字列 s に、同じ文字が n 個以上連続している部分文字列を見つける
    """
    assert n > 0
    reg = re.compile("(.)\\1{%d,}" % (n - 1))  # カンマを取ると n 個ちょうどになる
    while True:
        m = reg.search(s)
        if not m:
            break
        yield m.group(0)
        s = s[m.end():]

ans = 0

chains = list(nchars(s, 2))

if len(c) == 1:
    print(len(s) * k // 2)
else:
    #print(chains)
    #print(len(chains[0]), len(chains[-1]), k)
    for r in chains:
        ans += len(r) // 2

    print(ans * k + (k - 1 if chains[0] == chains[-1] else 0))


### FIXED CODE ###

#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
import re
 
s = input()
k = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
c = collections.Counter(s)

def nchars(s, n):
    """文字列 s に、同じ文字が n 個以上連続している部分文字列を見つける
    """
    assert n > 0
    reg = re.compile("(.)\\1{%d,}" % (n - 1))  # カンマを取ると n 個ちょうどになる
    while True:
        m = reg.search(s)
        if not m:
            break
        yield m.group(0)
        s = s[m.end():]

ans = 0

chains = list(nchars(s, 2))

if len(c) == 1:
    print(len(s) * k // 2)
else:
    #print(chains)
    #print(len(chains[0]), len(chains[-1]), k)
    for r in chains:
        ans += len(r) // 2

    if chains and chains[0] == chains[-1]:
        print(ans * k + (k - 1 if chains[0] == chains[-1] else 0))
    else:
        print(ans * k)
S=list(input())
A="AKIHABARA"
id=0
for i in range(len(A)):
  if A[i]==S[i]:
    continue
  else:
    if A[i]=="A":
      S.insert("A",i)
    else:
      print("NO")
      exit(0)
if "".join(S)==A:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

S=list(input())
A="AKIHABARA"
id=0
for i in range(len(A)):
  if len(S) > i and A[i]==S[i]:
    continue
  else:
    if A[i]=="A":
      S.insert(i,"A")
    else:
      print("NO")
      exit(0)
if "".join(S)==A:
  print("YES")
else:
  print("NO")
O = raw_input()
E = raw_input()
out = O+E
out =  list(out)
for count in range(0,len(out)/2):
	out[2*count] = O[count]
	out[2*count+1] = E[count]
if len(O) > len(E):
	out[2*count+2] = O[count+1]
out = ''.join(out)
print out

### FIXED CODE ###

a,b,c = map(int, raw_input().split())
if b-a == c-b:
	print "YES"
else:
	print "NO"
s = input()
mapping = {'SUN':, 'MON':1, 'TUE':2, 'WED':3, 'THU':4
           , 'FRI':5, 'SAT':6}
if s == 'SUN':
  print(7)
else:
  print(7-mapping[s])

### FIXED CODE ###

s = input()
mapping = {'SUN': 0, 'MON':1, 'TUE':2, 'WED':3, 'THU':4, 'FRI':5, 'SAT':6}
if s == 'SUN':
  print(7)
else:
  print(7-mapping[s])
import sys
A, B, K = map(int, input().split())

s = 0
def sp(R):
  if R==1:
    return {1:1}
  dic = {}
  I = int(R)
  s=0
  while s==0:
    for i in range(2, R+1):
      if I%i==0:
        I=I/i
        if I==1:
          s=1
        if i not in dic:
          dic[i] = 0
        dic[i] += 1
        break
  return dic

a = sp(A)
b = sp(B)
c = []

if A == 1 and B == 1:
  print(1)
  sys.exit()
elif A == 1:
  for i in range(0, max(b.keys())+1):
    if i in b:
      t = b[i]
      c.append([i**j for j in range(t+1)])
elif B == 1:
  for i in range(0, max(a.keys())+1):
    if (i in a):
      t = a[i]
      c.append([i**j for j in range(t+1)])
else:
  for i in range(0, max(max(a.keys()), max(b.keys()))+1):
    if (i in a) and (i in b):
      t = min(a[i], b[i])
      c.append([i**j for j in range(t+1)])

arr = []
import itertools
from functools import reduce
for i in itertools.product(*c):
  v = reduce(lambda x,y:x*y,i)
  if v not in arr:
    arr.append(v)

arr.sort(reverse=True)

print(arr[K-1])

### FIXED CODE ###

import sys
A,B,K = map(int, input().split())

for i in range(min(A,B), 0, -1):
  if (A % i == 0) and (B%i == 0):
    K-=1
  if K == 0:
    print(i)
    sys.exit()
N = int(input())

import math

if N % 2 == 1:
    print(0)
else:
    half = N // 2
    m = math.floor(math.log(half, 5))
    cnt = 0
    for i in range(m):
        cnt += half // (5 ** (i+1))
    print(cnt)

### FIXED CODE ###

N = int(input())

import math

if N % 2 == 1:
    print(0)
elif N == 0:
    print(0)
else:
    half = N // 2
    m = math.floor(math.log(half, 5))
    cnt = 0
    for i in range(m):
        cnt += half // (5 ** (i+1))
    print(cnt)
n = int(input())
a = list(map(int, input().split()))
result = 1
while result <= 10^(18):
  result *= a[i] for i in range(n)
else:
  print(-1)
    
print(result)

### FIXED CODE ###

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

if a.count(0) != 0:
  print(0)
else:
  result = 1
  for i in range(n):
    result *= a[i]
    if result > (10**18):
      print(-1)
      break
    else:
      continue
  else:
    print(result)
def main():
  N=int(input())
  for i in range(1:10)
    for j in range(1:10):
      if N==i*j:
        print("Yes")
      else:
        print("No")
main()

### FIXED CODE ###

N=int(input())
list=[]
for i in range(1,10):
  for j in range(1,10):
    list.append(i*j)
if N in list:
   print("Yes")
else:
   print("No")
H, W, m = map(int, input().split())
hw = [list(map(int, input().split())) for _ in range(m)]

mat = [[0] * W for _ in range(H)]
for h, w in hw:
    mat[h - 1][w - 1] = 1

rowcnt = [sum(row) for row in mat]
colcnt = []
for col in range(W):
    colcnt.append(sum(row[col] for row in mat))

rowmax, colmax = max(rowcnt), max(colcnt)
print(rowmax + colmax - 1)


### FIXED CODE ###

H, W, m = map(int, input().split())
hw = [list(map(int, input().split())) for _ in range(m)]

row, col = [0] * H, [0] * W
for h, w in hw:
    row[h - 1] += 1
    col[w - 1] += 1

rowmax, colmax = max(row), max(col)
cnt = row.count(rowmax) * col.count(colmax)
for h, w in hw:
    if row[h - 1] == rowmax and col[w - 1] == colmax:
        cnt -= 1
print(rowmax + colmax - (cnt == 0))
from collections import deque
import itertools
 
n, k = map(int, input().split())
p = list(map(int, input().split()))
 
kukan = 0
kukan_list = deque()
for i in range(k):
    kukan_list.append(p[i])
 
for i in range(n - k+1):
    if kukan < sum(kukan_list):
        kukan = sum(kukan_list)
    if i+k<n:
        kukan_list.popleft()
        kukan_list.append(p[i+k])
 
 
ans = kukan / 2 + 0.5 * k
print(ans)

### FIXED CODE ###

s, t = input().split()
a, b = map(int, input().split())
u = input()

if s == u:
    a -= 1
elif t == u:
    b -= 1
print(a, b)
a,b,h=map(int,input().split())

print((a+b)*h/2)

### FIXED CODE ###

a=int(input())
b=int(input())
h=int(input())

print(round((a+b)*h/2))
a,b = list(map(float, input().split()))
aint = int(a)
print('{}'.format(round(aint * number[1])))


### FIXED CODE ###

number = list(map(int, input().split()))
print(number[0] * number[1])
n, m = map(int,input().split())
a, b = map(int,input().split())
cnt = 0
for i in range(1, m):
  l, r = map(int,input().split())
  if (l > b and r > b) or (l < a and r < a):
    print(0)
    exit()
  if a<=l<=b:
    a = l
  if r <= b:
    b = r
print(b-a+1)

### FIXED CODE ###

a, b = map(int,input().split())
if a <= 5:
  print(0)
elif 5 < a <= 12:
  print(int(b/2))
elif 13 <= a:
  print(b)
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[0]*M
C=[0]*M
D=[]
for i in range(M):
    B[i],C[i]=map(int,input().split())
    D+=[C[i]]*B[i]
D=np.sort(D)[::-1]
A = np.sort(A)

for i in range(sum(B)):
    if A[i] < D[i]:
        A[i]=D[i]
    else:
        break
    if i==N-1:
        break
print(sum(A))      




### FIXED CODE ###

#!/usr/bin/env python3
import bisect
import numpy as np

N, M = list(map(int, input().split()))
a_list = list(map(int, input().split()))
bc_list = []

for i in range(M):
    b, c = list(map(int, input().split()))
    bc_list.append((b, c))

bc_list = sorted(bc_list, key=lambda x: x[1], reverse=True)
a_list = sorted(a_list)

fix_list = []
s = 0
b, c = bc_list[0]
bc_index = 0
count_b = 0

for a in a_list:
    if count_b >= b:
        bc_index += 1
        if bc_index >= len(bc_list):
            s += a
            continue
        count_b = 0
        b, c = bc_list[bc_index]

    if a < c:
        s += c
    else:
        s += a
    count_b += 1

ans = s
print(ans)
def main():
    N = int(input())
    H = [int(x) for x in input().split()]
    ans = []
    count = 0
    for i in range(1, N):
        if H[-i] <= H[-(i + 1)]:
            count += 1
        else:
            ans.append(count)
            count = 0
    print(max(ans))


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    N = int(input())
    H = [int(x) for x in input().split()]
    ans = 0
    count = 0

    if N == 2:
        if H[0] >= H[1]:
            ans = 1
    elif N > 2:
        for i in range(1, N):
            j = i + 1
            if H[-i] <= H[-j]:
                count += 1
                if j == N:
                    if ans <= count:
                        ans = count
            else:
                if ans <= count:
                    ans = count
                count = 0
    print(ans)


if __name__ == "__main__":
    main()
N=int(input(""))
K=int(input(""))
s=str(input(""))
print(s[0:K-1]+s[K-1].lower()+s[K:])

### FIXED CODE ###

N=input("")
N=N.split(" ")
K=int(N[1])
N=N[0]
s=str(input(""))
print(s[0:K-1]+s[K-1].lower()+s[K:])
import math

n = list(map(int, input().split()))
A = list(map(int, input().split()))
a_max = max(A)
result = []
for a in A:
    result.append(math.gcd(a_max,a))

result.sort(reverse=True)

print(result[1])

### FIXED CODE ###

import fractions


'''

最大公約数を求める
最大公約数を最大にするには何を変えれば良いか

最大値との最大公約数を求めて、最大になれば良い?

'''

n = list(map(int, input().split()))
A = list(map(int, input().split()))
right = []
left = []
for i,a in enumerate(A):
    if i ==0 :
        right.append(a)
    else:
        right.append(fractions.gcd(right[i-1],a))

for i,b in enumerate(reversed(A)):
    if i ==0 :
        left.append(b)
    else:
        left.append(fractions.gcd(left[i-1],b))

result = []

for i,r in enumerate(A):
    if i ==0:
        result.append(right[len(right)- 2])
    if i == len(A) -1:
        result.append(left[len(left) - 2])

    result.append(fractions.gcd(left[i -1], right[len(right) - i -2]))

print(max(result))
N=int(input())
r = 10**9+7
power=1
for i in range(n):
    power=power*(i+1)%r
print(power)

### FIXED CODE ###

N=int(input())
r = 10**9+7
power=1
for i in range(N):
    power=power*(i+1)%r
print(power)
def cube(x):
	if x >= 1 and x <=100
	return x ** 3


### FIXED CODE ###

number = int(input())
print(number**3)
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

AB.sort()
B = [[] for _ in range(100005)]
tmp = 0
for ab in AB:
  if ab[0] != tmp:
    B[ab[0]] = B[tmp].copy()
  B[ab[0]].append(ab[1])
  tmp = ab[0]

for i in range(1, M + 1):
  if len(B[i]) == 0:
    B[i] = B[i - 1].copy()

ans = 0
for i in range(1, M + 1):
  if len(B[i]) > 0:
    m = max(B[i])
    ans += m
    for j in range(i, M + 1):
      if len(B[j]) > 0:
        B[j].remove(m)

print(ans)

### FIXED CODE ###

from heapq import heappush, heappop

N, M = map(int, input().split())
jobs = [[] for _ in range(M)]

for i in range(N):
  ab = list(map(int, input().split()))
  #Ai > M の仕事はいらない
  if ab[0] <= M:
    jobs[ab[0] - 1].append(ab[1])

#最終日はAi=1の仕事のみ選べる。その前の日はAi<=2, ...
#終わりから考えればよさそう
hq = []
ans = 0
for i in range(M):
  for b in jobs[i]:
    heappush(hq, -1 * b)
  if len(hq) > 0:
    m = -1 * heappop(hq)
    ans += m

print(ans)
n=int(input())
a=list(map(int, input().split()))
d=[]
for c in range(n):
  b=0
  while a[c]%2==0:
    a[c]=a[c]/2
    b+=1
  d[c].append(b)
print(max(d))

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
d=[]
for c in range(n):
  b=0
  while a[c]%2==0:
    a[c]=int(a[c]//2)
    b+=1
  d.append(b)
print(min(d))
# -*- coding: utf-8 -*-
from sys import stdin
import math

in_strings = lambda: stdin.readline()[:-1] # s = in_strings()
in_int = lambda: int(stdin.readline()) # N = in_int()
in_intlist = lambda: list(map(int, stdin.readline().split())) # List = in_intlist()

N, A, B, K = in_intlist()
NUM = 998244353

# 逆元
Inv = [0 for _ in range(N)]
for i in range(N):
    Inv[i] = pow(i+1, NUM-2, NUM)

# Combination
Comb = [0 for _ in range(N+1)]
Comb[0] = 1
for i in range(1, N+1):
    Comb[i] = (Comb[i-1] * (N-i+1) * Inv[i-1]) % NUM


ans = 0
for i in range(max(0, (K-N*B)//A), min(N+1, K//A + 1)):
    if (K - i*A) % B == 0:
        ans = (ans + Comb[i]*Comb[(K - i*A) // B]) % NUM 

print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-
from sys import stdin
import math

in_strings = lambda: stdin.readline()[:-1] # s = in_strings()
in_int = lambda: int(stdin.readline()) # N = in_int()
in_intlist = lambda: list(map(int, stdin.readline().split())) # List = in_intlist()

N, A, B, K = in_intlist()
NUM = 998244353

# 逆元
Inv = [0 for _ in range(N)]
for i in range(N):
    Inv[i] = pow(i+1, NUM-2, NUM)

# Combination
Comb = [0 for _ in range(N+1)]
Comb[0] = 1
for i in range(1, N+1):
    Comb[i] = (Comb[i-1] * (N-i+1) * Inv[i-1]) % NUM


ans = 0
for i in range(N+1):
    if ((K - i*A) % B == 0) and (0 <= (K - i*A) // B <= N):
        ans = (ans + Comb[i]*Comb[(K - i*A) // B]) % NUM 

print(ans)
from operator import mul
from functools import reduce
n,k=map(int,input().split())

def comb(n,r):
  r = min(n-r,r)
  if r == 0: return 1
  over = reduce(mul, range(n, n - r, -1))
  under = reduce(mul, range(1,r + 1))
  return over // under

blue,red=k,n-k
mod=10**9+7
for i in range(1,k+1):
  print((comb(red+1,i)*comb(blue-1,i-1))%mod)

### FIXED CODE ###

n,k=map(int,input().split())

mod=10**9+7
ans=n-k+1
print(ans)
for i in range(2,k+1):
  ans=(ans*(n-k-i+2)*(k-i+1)*pow(i*(i-1),mod-2,mod))%mod
  print(ans)
from fractions import gcd
N, M = map(int, input().split())
a = [int(c) for c in input().split()]
b = [c//2 for c in a]
g = b[0]*b[1]//gcd(b[0], b[1])
for i in range(2,N):
  g = g*b[i]//gcd(g, b[i])

G = a[0]*a[1]//gcd(a[0], a[1])
for i in range(2,N):
  G = G*a[i]//gcd(G, a[i])

if M<g:
  print(0)
else:
  n = (M-g)//G
  print(n+1)


### FIXED CODE ###

from fractions import gcd
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

N, M = map(int, input().split())
a = [int(c) for c in input().split()]
b = [c//2 for c in a]
g = reduce(lcm_base, b, 1)
G = reduce(lcm_base, a, 1)
if M<g:
  print(0)
  import sys
  sys.exit()
m = a[0]&-a[0]
for i in range(N):
  if m != a[i]&(-a[i]):
    print(0)
    break
else:
  n = (M-g)//G
  print(n+1)
s = input()
acgt = ['A', 'C', 'G', 'T']
cnt = 0
ans = []

for i in range(len(s)):
  if s[i] in acgt:
    cnt += 1
  else:
    ans.append(cnt)
    cnt = 0

print(max(ans))

### FIXED CODE ###

s = input()
acgt = ['A', 'C', 'G', 'T']
cnt = 0
ans = []

for i in range(len(s)):
  if s[i] in acgt:
    cnt += 1
  else:
    cnt = 0
  ans.append(cnt)

print(max(ans))
print(input()[0] + str(len(input()) - 2) + input()[len(input()) -1])

### FIXED CODE ###

a = input()
print(a[0] + str(len(a) - 2) + a[len(a) -1])
X,N=map(int,input().split())
if N==0:
    print(X)
    exit()

P_ori=list(map(int,input().split()))
if P_ori.count(X)==0:
    print(X)
    exit()

P1=sorted(P_ori)
N=list(range(1,101))
PZ=[]
for i in range(len(N)):
    if P1.count(N[i])==0:
        PZ.append(N[i])

PZ.append(X)
P2=sorted(PZ)
t=P2.index(X)
if t==0:
    print(P2[1])
elif t==len(P2):
    print(P2[t-1])
else:
    dist1=abs(P2[t-1]-P2[t])
    dist2=abs(P2[t]-P2[t+1])
    if dist1<=dist2:
        print(P2[t-1])
    else:
        print(P2[t+1])

### FIXED CODE ###

X,N=map(int,input().split())
if N==0:
    print(X)
    exit()

P_ori=list(map(int,input().split()))
if P_ori.count(X)==0:
    print(X)
    exit()


P1=sorted(P_ori)
N=list(range(0,102))
PZ=[]
for i in range(len(N)):
    if P1.count(N[i])==0:
        PZ.append(N[i])

PZ.append(X)
P2=sorted(PZ)
t=P2.index(X)
if P2[t]==P2[0]:
    print(P2[1])
    exit()
elif P2[t]==P2[-1]:
    print(P2[-2])
    exit()
else:
    dist1=abs(P2[t-1]-P2[t])
    dist2=abs(P2[t]-P2[t+1])
    if dist1<=dist2:
        print(P2[t-1])
        exit()
    else:
        print(P2[t+1])
        exit()
print(0)
import sys
import math
import heapq
from collections import defaultdict, deque
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

'''C Tsundoku'''
n,m,k=rm()
a=rl()
b=rl()
c=[0]*(n+1)
d=[0]*(b+1)
for i in range(n):
    c[i+1]=c[i]+a[i]
for i in range(m):
    d[i+1]=d[i]+b[i]
ans=0;j=m
for i in range(n+1):
    if c[i]>k:
        break
    while c[i]+c[j]>k:
        j-=1
    ans=max(ans,i+j)
print(ans)

### FIXED CODE ###

import sys
import math
import heapq
from collections import defaultdict, deque
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

'''C Tsundoku'''
n,m,k=rm()
a=rl()
b=rl()
c=[0]*(n+1)
d=[0]*(m+1)
for i in range(n):
    c[i+1]=c[i]+a[i]
for i in range(m):
    d[i+1]=d[i]+b[i]
ans=0;j=m
for i in range(n+1):
    if c[i]>k:
        break
    while c[i]+d[j]>k:
        j-=1
    ans=max(ans,i+j)
print(ans)
import sys, math
from collections import deque

readline = sys.stdin.readline

S = int(readline())

M = 10 ** 9
rS = math.ceil(math.sqrt(S))

while True:
    rem = rS ** 2 - S


    if rem <= M:
        b = rem
        break
    else:
        b = 0
        a = rem // M + 1
        c = math.floor(rem ** 0.5)
        while a < c and a < M:
            if rem % a == 0:
                b = a
                break
            a += 1
        if b != 0:
            break
    
    if rS >= M:
        rS = M - 1000
    else:
        rS += 1

if rS > M or b > M:
    while True:
        a = 1

print('0 0 {} {} {} {}'.format(rS, b, rem // b, rS))

### FIXED CODE ###

import sys, math
from collections import deque

readline = sys.stdin.readline

S = int(readline())

M = 10 ** 9
rS = math.ceil(math.sqrt(S))

while True:
    rem = rS ** 2 - S

    if rem == 0:
        print('0 0 {} {} {} {}'.format(rS, 0, 0, rS))
        exit(0)

    if rem <= M:
        b = rem
        break
    else:
        b = 0
        a = rem // M + 1
        c = math.floor(rem ** 0.5)
        while a < c and a < M:
            if rem % a == 0:
                b = a
                break
            a += 1
        if b != 0:
            break
    
    if rS >= M:
        rS = M - 1000
    else:
        rS += 1


print('0 0 {} {} {} {}'.format(rS, b, rem // b, rS))
x = input()
a = x ** 3
print a

### FIXED CODE ###

x = int(input())
print (x ** 3)
input()

A = list(map(int, input().split()))
count = 0

while all(a %2 == 0 for a in A):
  A = [a/2 for a in A]
  count += 1
print(count)

### FIXED CODE ###

print(input().count("1"))
def main():
    from itertools import accumulate
    x = int(input())
    l = list(range(0, x + 1))
    r = accumulate(l)

    for i, p in enumerate(r):
        if p == x:
            print(i)
            break
        if p + (i + 2) == x:
            print(i + 2)
            break


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    x = int(input())
    k = int(x ** .5)

    i = 0
    while True:
        p = i * (i + 1) // 2
        if p >= x:
            print(i)
            break
        i += 1


if __name__ == '__main__':
    main()
, b, c = map(int, input().split())

if (a + b) <= c:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

if (a + b) >= c:
    print('Yes')
else:
    print('No')
import heapq

tmp = list(map(int, input().split()))
x = tmp[0]
y = tmp[1]
z = tmp[2]
k = tmp[3]
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)

#log = [[[False for _ in range(z)] for _ in range(y)] for _ in range(x)]
log = [False] * x * y * z
h = []
heapq.heappush(h, (-(a[0]+b[0]+c[0]), 0, 0, 0))
for i in range(k): 
  if len(h) == 0:
    break
  tmp = heapq.heappop(h)
  print(-tmp[0])
  if tmp[1]+1 < x and log[(tmp[1]+1) * y * z + tmp[2] * z + tmp[3]] == False:
    heapq.heappush(h, (-(a[tmp[1]+1]+b[tmp[2]]+c[tmp[3]]), tmp[1]+1, tmp[2], tmp[3]))
    log[(tmp[1]+1) * y * z + tmp[2] * z + tmp[3]] = True
  if tmp[2]+1 < y and log[tmp[1] * y * z + (tmp[2]+1) * z + tmp[3]] == False:
    heapq.heappush(h, (-(a[tmp[1]]+b[tmp[2]+1]+c[tmp[3]]), tmp[1], tmp[2]+1, tmp[3]))
    log[tmp[1] * y * z + (tmp[2]+1) * z + tmp[3]] = True
  if tmp[3]+1 < z and log[tmp[1] * y * z + tmp[2] * z + tmp[3]+1] == False:
    heapq.heappush(h, (-(a[tmp[1]]+b[tmp[2]]+c[tmp[3]+1]), tmp[1], tmp[2], tmp[3]+1))
    log[tmp[1] * y * z + tmp[2] * z + tmp[3]+1] = True


### FIXED CODE ###

tmp = list(map(int, input().split()))
x = tmp[0]
y = tmp[1]
z = tmp[2]
k = tmp[3]
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)

ansl = []
for p in range(x):
  if p > k:
    break
  for q in range(y):
    if p * q > k:
      break
    for r in range(z):
      if p * q * r > k:
        break
      ansl.append(a[p] + b[q] + c[r])

ansl.sort(reverse=True)

for i in range(k):
  print(ansl[i])