Harryxun/stf_run huggingface dataset:
import sys
readline = sys.stdin.buffer.readline
import numpy as np
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = int(readline())
    t = [0]*N
    for i in range(N):
        t[i] = int(readline())
    T = np.array(t)
    ans = np.lcm.reduce(T)
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
readline = sys.stdin.buffer.readline
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def main():
    N = int(readline())
    T = [0]*N
    for i in range(N):
        T[i] = int(readline())
    ans = lcm_list(T)
    print(ans)


if __name__ == '__main__':
    main()
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    h, w, n = LIR(3)
    print(min(n // h + (n % h > 0), n // w + (n % w > 0))
    return


#main
if __name__ == '__main__':
    solve()


### FIXED CODE ###

#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    h, w, n = IR(3)
    print(min(n // h + (n % h > 0), n // w + (n % w > 0)))
    return
#main
if __name__ == '__main__':
    solve()
n, k = map(int, input().split())
s = list(input())

cnt = 0

i = 1
while i < len(s):
    print(i, s, cnt)
    if cnt == k:
        break

    if s[i] != s[i-1]:
        cnt += 1
        start = i
        target = s[i]

        while  i < len(s) and target == s[i]:
            if s[i] == 'R': s[i] = 'L'
            else: s[i] = 'R'

            i += 1   

        continue    

    i += 1

ans = 0
for i in range(1, len(s)):
    if s[i] == s[i-1]:
        ans += 1

print(ans)



### FIXED CODE ###

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

cnt = 0

i = 1
while i < len(s):
    if cnt == k:
        break

    if s[i] != s[i-1]:
        cnt += 1
        start = i
        target = s[i]

        while  i < len(s) and target == s[i]:
            if s[i] == 'R': s[i] = 'L'
            else: s[i] = 'R'

            i += 1   

        continue    

    i += 1

ans = 0
for i in range(1, len(s)):
    if s[i] == s[i-1]:
        ans += 1

print(ans)
i = len(s)
ans = 'YES'
while True:
    if s[-5:] == a[0] or s[-5:] == a[2]:
        i -= 5
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    elif i>=6 and s[-6:] == a[3]:
        i -= 6
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    elif i>=7 and s[-7:] == a[1]:
        i -= 7
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    else:
        ans = 'NO'
        break
    #print(s)
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Wed Aug 15 12:43:21 2018
ABC049C
@author: maezawa
"""

s = input()
a = ('dream', 'dreamer', 'erase', 'eraser')

i = len(s)
ans = 'YES'
while True:
    if s[-5:] == a[0] or s[-5:] == a[2]:
        i -= 5
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    elif i>=6 and s[-6:] == a[3]:
        i -= 6
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    elif i>=7 and s[-7:] == a[1]:
        i -= 7
        if i == 0:
            ans = 'YES'
            break
        elif i<5:
            ans = 'NO'
            break
        s = s[:i]
    else:
        ans = 'NO'
        break
    #print(s)
print(ans)
N, K = map(int, input().split())
D = list(map(int, input().split()))
D = list(set(D))
nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
for d in D:
    nums.remove(d)
l = [int(x) for x in str(N)]
ans = []
for i, e in enumerate(l):
    if e in D:
        for num in nums:
            if e < num:
                ans.append(str(num))
        else:
            for _ in range(i + 1, len(l)):
                ans.append(str(min(nums)))
            break
    else:
        ans.append(str(e))
print(int(''.join(ans)))

### FIXED CODE ###

N, K = map(int, input().split())
D = list(map(int, input().split()))
while True:
    l = [int(x) for x in str(N)]
    for e in l:
        if e in D:
            N += 1
            break
    else:
        break
print(N)
N = int(input())
C = input()

flag_left = 0
flag_right = N-1
counter = 0


while flag_left<flag_right:
    while C[flag_left]=="R":
        flag_left += 1
        if flag_left>=N-1:
            break
    while C[flag_right]=="W":
        flag_right -= 1
        if flag_left<=0:
            break
        
    if flag_left<flag_right:
        counter += 1
    flag_left += 1
    flag_right -= 1
print(counter)

### FIXED CODE ###

N = int(input())
C = input()

flag_left = 0
flag_right = N-1
counter = 0

ok = max(C.count("W"),C.count("R"))
if ok ==N:
    print(0)
    exit()

while flag_left<flag_right:
    while C[flag_left]=="R":
        flag_left += 1
        if flag_left>N-1:
            break
    while C[flag_right]=="W":
        flag_right -= 1
        if flag_left<0:
            break
        
    if flag_left<flag_right:
        counter += 1
    flag_left += 1
    flag_right -= 1
print(counter)
a,b = map(int,input().split())
if 1<=a<=9 and 1<=b<=9:
  print(a*b)
else:
  prit(-1)

### FIXED CODE ###

a,b = map(int,input().split())
if 1<=a<=9 and 1<=b<=9:
  print(a*b)
else:
  print(-1)
x,y,z=map(input().split())
print(z,y,x)

### FIXED CODE ###

x,y,z=input().split()
print(z,x,y)
no = input()
c = false
while no > 0:
  if no%10 == 7:
    c = true
if c == true:
  print("Yes")
else :
  print("No")

### FIXED CODE ###

def check(n):
	while n > 0:
		if n%10 == 7:
			return "Yes"
		n = int(n/10)
	return "No"

no = int(input())
print(check(no))
n = int(input())
h = []
for i in range(n):
    h.append(input())

# 単調非減少：x2がx1より小さくならない
flag = 'Yes'
for i in range(len(h)-1):
    if h[i] < h[i+1]:
        h[i+1] -= 1
        if h[i] < h[i+1]:

            if n == i+1:
                break
            flag = 'No'
            break
print(flag)

### FIXED CODE ###

import numpy as np
 
n = int(input())
h = list(map(int, input().split()))
 
h = np.array(h)
 
for i in range(len(h)-1):
   if h[i] < h[i+1]:
       h[i+1] -= 1
np.diff(h-1, n=1)
 
minus = [i for i in np.diff(h-1, n=1) if i < 0]
 
if len(minus) > 0:
    print('No')
else:
    print('Yes')
t,x=map(int,input().split(' ')
print(t/x)

### FIXED CODE ###

t,x=map(int,input().split(' '))
print(t/x)
def is_substring(s,t,start_index):
	ok=True
	j=0
	for i in range(start_index, start_index + max(len(s) - len(t) + 1,0)):
		if s[i] == t[j] or s[i] == '?':
			j+=1
		else:
			ok = False
			break
	return ok


def replace(s_list, index, changed_char):
	s_list[index] = changed_char
	t = "".join(s_list)
	return t

def main():
	s=str(input())
	t=str(input())
	s_list = list(s)

	ok=False

	if len(s) >= len(t):
		for i in range(max(len(s) - len(t) + 1,0)):
			j=0
			if s[i] == t[j] or s[i] == '?':
				if is_substring(s,t,i) == True:
					k=i
					for j in range(len(t)):
						s = replace(s_list, k, t[j])
						k+=1
					ok=True
					break

		if ok == True:
			s_list = list(s)
			for i in range(len(s)):
				if (s[i] == '?'):
					s = replace(s_list, i, 'a')

	print(s if ok == True else "UNRESTORABLE")

if __name__ == '__main__':
	main()

### FIXED CODE ###

S = input()
T = input()
ok = False
ans = []

for i in range(len(S)-len(T),-1,-1):
	tmpS = list(S)
	for j in range(len(T)):
		if tmpS[i+j] == "?":
			tmpS[i+j] = T[j]

	if "".join(tmpS[i:i+len(T)]) == T:
		ans = tmpS
		ok = True
		break

ans = "".join(ans)
if ok == False:
	print("UNRESTORABLE")
else:
	print(ans.replace("?","a"))
n, m = map(int, input().split())
cards = sorted(list(map(int, input().split())))
sum_cards = [cards[0]]
for i in range(1, n):
    sum_cards.append(cards[i-1] + cards[i])

changer = []
for i in range(m):
    p, c = map(int, input().split())
    gap = p*c - sum_cards[p-1]
    changer.append((p, c, gap))

changer.sort(key=lambda x: x[2])

cur = 0
while len(changer):
    p, c, _ = changer.pop()
    i = cur
    while i < cur + p:
        if cards[i] < c: cards[i] = c
        else: break
        i += 1
    cur = i
print(sum(cards))

### FIXED CODE ###

n, m = map(int, input().split())
cards = sorted(list(map(int, input().split())))

changer = []
for i in range(m):
    p, c = map(int, input().split())
    changer.append((p, c))

changer.sort(key=lambda x: x[1])

cur = 0
while len(changer) and cur < n:
    p, c = changer.pop()
    i = cur
    while i < n and i < cur + p:
        if cards[i] < c: cards[i] = c
        else: break
        i += 1
    cur = i
print(sum(cards))
a, b = int(input()),int(input())

ans = a * b

if ans % 2 == 1:
	print("Odd")
else:
	print("Even")

### FIXED CODE ###

a, b = map(int,input().split())
 
ans = a * b
 
if ans % 2 == 1:
  print("Odd")
else:
  print("Even")
N = int(input())
a = list(map(int, input().split()))
M = sum(a)
snk = 0
ans = float('inf')
for i in range(N-1):
    snk += a[i]
    ari = M - snk
    ans = min(ans,abs(snk-ari))
print(ans)


### FIXED CODE ###

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

if (a+b)%3==0 or a%3==0 or b%3==0:
    print('Possible')
else:
    print('Impossible')
import sys 
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10 ** 9 + 7    
N, K = map(int, readline().split())
d = [0] * (K+1)
for i in range(K,0,-1):
    t = K // i
    cnt = pow(t,N,MOD)
    for j in range(2,t+1):
        cnt -= d[i*j]
        cnt %= mod
    d[i] = cnt
ans = 0
for num,cnt in enumerate(d):
    ans += num * cnt
    ans %= MOD
print(ans) 

### FIXED CODE ###

import sys 
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10 ** 9 + 7    
N, K = map(int, readline().split())
d = [0] * (K+1)
for i in range(K,0,-1):
    t = K // i
    cnt = pow(t,N,MOD)
    for j in range(2,t+1):
        cnt -= d[i*j]
        cnt %= MOD
    d[i] = cnt
ans = 0
for num,cnt in enumerate(d):
    ans += num * cnt
    ans %= MOD
print(ans)
if X>=30:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

n = int(input())
if n >= 30:
  print('Yes')
else:
  print('No')
S = int(input())
h = S // 3600
m = S % 3600 // 60
s = S % 60
print(h,m,s. sep=':')

### FIXED CODE ###

x = int(input())
h = x // 3600
m = x % 3600 // 60
s = x % 60
  
print(h,m,s,sep=':')
while 1:
  n, m = map(int, raw_input())
  if n == 0 and m == 0:
    break
  places = dict(zip(range(m), [0]*m))
  for i in range(n):
    vote = map(int,raw_input().split()) 
    for j in range(m):
      places[j] += vote[j]
  for k, v sorted(a.items,key=lambda x:x[1],reverse=1):
    print k+1
  print

### FIXED CODE ###

while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print
s=input()
t=input()
o=0
for i in range(len(s)):
  if s[i]!=t[i]:
		o+=1
print(o)

### FIXED CODE ###

s=input()
t=input()
o=0
for i in range(len(s)):
  if s[i]!=t[i]:
    o+=1
print(o)
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())
 
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
 
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
 
INF = float('inf')
 
def solve():
    S = list(map(int, list(input())))
 
    S = S[::-1]
    # print(S)
    n = len(S)
    mod = 2019
 
    #
    A = [0] * (n)
    a = 1
    for i in range(n):
        A[i] = S[i] * a
        a = a * 10 % mod
    # print(A)
 
    # 累積和
    R = [0] * (n+1)
    for j in range(n):
        R[j+1] = (R[j] + A[j]) % mod
    # print(R)
 
    # 個数を数える
    cnt = {}
    ans = 0
    for l in range(0, n+1):
        r = R[l]
        ans = ans + cnt.get(r, 0)
        cnt[r] = cnt.setdefault(r, 0) + 1
    print(ans)
 
if __name__ == '__main__':
    solve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())
 
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
 
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
 
INF = float('inf')
 
def solve():
    S = list(map(int, list(input())))
 
    S = S[::-1]
    # print(S)
    n = len(S)
    mod = 2019
 
    #
    A = [0] * (n)
    a = 1
    for i in range(n):
        A[i] = S[i] * a
        a = a * 10 % mod
    # print(A)
 
    # 累積和
    R = [0] * (n+1)
    for j in range(n):
        R[j+1] = (R[j] + A[j]) % mod
    # print(R)
 
    # 個数を数える
    cnt = {}
    ans = 0
    for l in range(0, n+1):
        r = R[l]
        ans = ans + cnt.get(r, 0)
        cnt[r] = cnt.setdefault(r, 0) + 1
    print(ans)
 
if __name__ == '__main__':
    solve()
n, k = (int(i) for i in input().split())
balls = list(int(i) for i in input().split())
ball_set = set(balls)
freqs = list(balls.count(i) for i in ball_set)
freqs.sort()
print(sum(freqs[k:]))


### FIXED CODE ###

s = input()
print(s.count('1'))
N = int(input())
a = list(map(int, input().split()))
Alice = 0
Bob = 0
for i in range(N):
  if (i+1)%2 == 1:
    Alice += max(a)
    a.remove(max(a))
  else:
    bob += max(a)
    a.remove(ma(a))
print(Alice - Bob)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
Alice = 0
Bob = 0
for i in range(N):
  if (i+1)%2 == 1:
    Alice += max(a)
    a.remove(max(a))
  else:
    Bob += max(a)
    a.remove(max(a))
print(Alice - Bob)
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i) - bin(i).rfind("1") - 1)
print(round(ans))

### FIXED CODE ###

import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))
n = int(input())
list_HP = list(map(int, input().split()))

smallest = min(list_HP)
list_HP.remove(smallest)
second = min(list_HP)
list_HP.remove(second)

while (0<smallest) & (0<second):
	if smallest < second:
		second = second - smallest
	else:
		smallest = smallest - second

if (0<second):
	smallest = second

third = min(list_HP)

while (0<smallest) & (0<third):
	if smallest < third:
		third = third - smallest
	else:
		smallest = smallest - third

if (0<smallest):
	print(smallest)
else:
	print(third)

### FIXED CODE ###

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

while len(list_HP)!=1:
	new_list = []
	smallest = min(list_HP)

	for i in range(len(list_HP)):
		temp = int(list_HP[i]/smallest)
		list_HP[i] = list_HP[i] - (smallest*temp)
		if list_HP[i] != 0:
				new_list.append(list_HP[i])
	list_HP = new_list
	list_HP.append(smallest)

print(list_HP[0])
def mpow(a,n,mod):
  if n == 0:
    return 1
  elif n == 1:
    return a
  elif n%2==0:
    return (pow(a,n/2,mod))**2%mod
  else:
    return a*pow(a,n-1,mod)%mod
def mfac(l,r,mod):
  ans = l
  for i in reversed(range(r,l)):
    ans *= i
    ans %= mod
  return ans
def mcomb(n,k,mod):
  A = mfac(n,n-k+1)
  B = mfac(k,1)
  B = mpow(B,mod-2,mod)
  return A*B%mod

def main():
  mod = 10**9+7
  n,a,b = map(int,input().split(" "))
  ans = mpow(2,n,mod)-1+mcomb(n,a,mod)-mcomv(n,b,mod)
  ans %= mod
  print(ans)

if __name__ == "__main__":
  main()
  

### FIXED CODE ###

def mpow(a,n,mod):
  if n == 0:
    return 1
  elif n == 1:
    return a
  elif n%2==0:
    return (pow(a,n//2,mod))**2%mod
  else:
    return a*pow(a,n-1,mod)%mod
def mfac(l,r,mod):
  ans = l
  for i in reversed(range(r,l)):
    ans *= i
    ans %= mod
  return ans
def mcomb(n,k,mod):
  A = mfac(n,n-k+1,mod)
  B = mfac(k,1,mod)
  B = mpow(B,mod-2,mod)
  return A*B%mod

def main():
  mod = 10**9+7
  n,a,b = map(int,input().split(" "))
  ans = mpow(2,n,mod)-1-mcomb(n,a,mod)-mcomb(n,b,mod)
  ans %= mod
  print(ans)

if __name__ == "__main__":
  main()
src = [int(input()) for _ in range(6)]
t = min(src[1:])
    if src[0]%t:
        print(4 + src[0]//t + 1)
    else:
        print(4 + src[0]//t)

### FIXED CODE ###

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
min = min(A, B, C, D, E)
 
ans = 4 + int(N/min)
if N % min != 0:
    ans = ans + 1
print(ans)
input = sys.stdin.readline

N = int(input())

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

l = collections.Counter(A)

l24 =list([int(l1[0]) for l1 in l.items() if l1[1]>=2])

l24.sort(reverse=True)

if l24==[]:print(0)
elif l[l24[0]]>=4:print(l24[0]**2)
elif len(l24)>=2:print(l24[0]*l24[1])
else:print(0)

### FIXED CODE ###

import collections
import sys
input = sys.stdin.readline

N = int(input())

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

l = collections.Counter(A)

l24 =list([int(l1[0]) for l1 in l.items() if l1[1]>=2])

l24.sort(reverse=True)

if l24==[]:print(0)
elif l[l24[0]]>=4:print(l24[0]**2)
elif len(l24)>=2:print(l24[0]*l24[1])
else:print(0)
N = int(input())
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))

outNum = 0
outNum += sum(B_list)
a_prev = 0

for index, a in enumerate(A_list):
    if a_prev == 0:
        a_prev = 0
    elif a - a_prev == 1:
        outNum += C_list[index]
    a_prev = a
    
print(out)

### FIXED CODE ###

N = int(input())
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))

out = 0
out += sum(B_list)
a_prev = 0

for index, a in enumerate(A_list):
    if a_prev == 0:
        a_prev = 0
    elif a - a_prev == 1:
        out += C_list[a-2]
    a_prev = a
    
print(out)
import math

nab = [int(x) for x in input().split()]
n = nab[0]
a = nab[1]
b = nab[2]
counts = []
nums = [int(x) for x in input().split()]
means = []
nums.sort(reverse = True)
for i in range(a, b+1):
  #means.append(sum(nums[:i])/i)
    
  
  j = i
  while j<n:
    if nums[j-1]==nums[j]:
      j+=1
    else:
      break
  
  for k in range(int(math.factorial(j)/(math.factorial(i)*math.factorial(j-i)))):
    means.append(sum(nums[:i])/i)
  #counts.append(math.comb(j, i))
  print(math.factorial(j)/(math.factorial(i)*math.factorial(j-i)))
  print(math.factorial(4)/(math.factorial(2)*math.factorial(2)))
  print(math.factorial(4))
  print(j, i)
print(max(means))
#print(counts[
print(means.count(max(means)))

'''
def C(n, k):
  return C(n-1, k-1) + C(n-1, k)
  
for n in range(MAX_N):
  for k in range(MAX_K):
    C[n][k] = C[n-1][k-1] + C[n-1][k]

### FIXED CODE ###

import math

nab = [int(x) for x in input().split()]
n = nab[0]
a = nab[1]
b = nab[2]
counts = []
nums = [int(x) for x in input().split()]
means = []
nums.sort(reverse = True)
for i in range(a, b+1):
  means.append(sum(nums[:i])/i)
  counts.append(int(math.factorial(nums.count(nums[i-1]))/(math.factorial(nums[:i].count(nums[i-1]))*math.factorial(nums.count(nums[i-1])-nums[:i].count(nums[i-1])))))

maxim = max(means)
print(maxim)
k = 0
count = 0
while k<len(means):
  if means[k]==maxim:
    count+=counts[k]
  k+=1
print(count)

#print(means.count(max(means)))

'''
def C(n, k):
  return C(n-1, k-1) + C(n-1, k)
  
for n in range(MAX_N):
  for k in range(MAX_K):
    C[n][k] = C[n-1][k-1] + C[n-1][k]
'''
import sys
import numpy as np

def can_reach_the_goal(u, x):
    return min(u) >= x

n, m, x = map(int, input().split())

c = []
a = []
u = [0]*m
u_sum = [0]*n
for i in range(n):
    ca = [int(row) for row in input().split()]
    c.append(ca[0])
    a.append(ca[1:])
    u_sum[i] += sum(a[i])
    for j in range(m):
        u[j] += a[i][j]

if not can_reach_the_goal(u, x):
    print(-1)
    sys.exit(-1)

idx_c = list(np.argsort(-1 * np.array(c)))
c_sum = sum(c)
for i in idx_c:
    print(c[i])
    u_tmp = [u[j] - a[i][j] for j in range(m)]
    if can_reach_the_goal(u_tmp, x):
        c_sum -= c[i]
        u = u_tmp

print(c_sum)

### FIXED CODE ###

def can_reach_the_goal(u, x):
    return min(u) >= x

n, m, x = map(int, input().split())

c = []
a = []
for i in range(n):
    ca = [int(row) for row in input().split()]
    c.append(ca[0])
    a.append(ca[1:])

INF = 10**7
min_cost = INF
for k in range(2**n):
    purchase = [True if c == '1' else False for c in list(format(k, '0{}b'.format(n)))]
    cost = 0
    u = [0]*m
    for i in range(n):
        cost += c[i] if purchase[i] else 0
        for j in range(m):
            u[j] += a[i][j] if purchase[i] else 0

    if can_reach_the_goal(u, x) and cost < min_cost:
        min_cost = cost

if min_cost == INF:
    print(-1)
else:
    print(min_cost)
S = input()
N = int(input())
count = 0
d = ''
for j in S:
    d += j
    if len(d) == N:break
a = d.split('ABC')
for i in a:
    if i == '':
        count += 1
    else: continue
print (count)


### FIXED CODE ###

N = int(input())
S = input()
print(S.count("ABC"))
a = int(input())
b = int(input())

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


### FIXED CODE ###

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

print( a*b, 2*(a+b) )