Harryxun/stf_run huggingface dataset:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    # input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]
    II = lambda : int(input())

    N = II()
    info = []
    MAXL = 101
    b = [[0] * MAXL for _ in range(MAXL)]

    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0

    # get info
    info = []
    for _ in range(N):
        x,y,h = LMIIS()
        info.append((x,y,h))

    # info = XLMIIS(N)
    if len(info) < N:
        raise Exception()
    elif len(info) > N:
        while True:
            pass

    # init candidates
    for x,y,h in info:
        if h != 0:
            for i in range(MAXL):
                for j in range(MAXL):
                    b[i][j] = vtop(x,j,y,i,h)
        break

    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if h == 0:
                    if b[i][j] > vtop(x,j,y,i,h):
                        b[i][j] = 0

                else:
                    if b[i][j] != vtop(x,j,y,i,h):
                        b[i][j] = 0

    # answer
    ansl = []
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                ansl.append((j,i,b[i][j]))
    
    ansl2 = []
    for x0,y0,h0 in ansl:
        f = True
        for x1,y1,h1 in info:
            
            if max(h0-abs(x0-x1)-abs(y0-y1),0) != h1:
                f = False
                break
        if f:
            ansl2.append((x0,y0,h0))
    x,y,h= ansl2[-1]
    print(x,y,h)


if __name__ == '__main__':
    main()

### FIXED CODE ###

#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())

    N = II()
    info = []
    for _ in range(N):
        xi, yi, hi = LMIIS()
        if hi != 0:
            xt, yt, ht = xi, yi, hi
        info.append((xi, yi, hi))

    for Cy in range(101):
        for Cx in range(101):
            H = ht + abs(xt - Cx) + abs(yt - Cy)
            found = True
            for xi, yi, hi in info:
                tmp_h = max(H - abs(Cy-yi) - abs(Cx-xi), 0)
                if tmp_h != hi:
                    found = False
                    break
            if found:
                print('{} {} {}'.format(Cx,Cy,H))
                return



if __name__ == '__main__':
    main()
N, M = map(int, input().split())
oks = [True] * (N+1)
a = [int(input()) for _ in range(M)]
for i in a:
    oks[i] = False
dp = [0] * (N+1)
if oks[1]:
    dp[1] = 1
if oks[2]:
    dp[2] = 1
for i in range(3, N+1):
    if oks[i]:
        dp[i] = int((dp[i-1] + dp[i-2]) % (1e9+7))


print(dp[N])

### FIXED CODE ###

N, M = map(int, input().split())
oks = [True] * (N+1)
a = [int(input()) for _ in range(M)]
for i in a:
    oks[i] = False

dp = [0] * (N+1)
dp[0] = 1
for i in range(N+1):
    for j in range(i+1, min(i+2, N)+1):
        if oks[j]:
            dp[j] += dp[i]
            dp[j] %= int(1e9+7)


print(dp[N])
while True:
	player_nun = int(input())
	player_nun = 4
	if player_nun == 0:
		break
	
	#?????????????????????
	whole_data = []
	for i in (0, player_nun):
		dat = input().split()
		p_data = []
		p_data.append(dat[0])
		for x in dat[1:]:
			p_data.append(int(x))
			whole_data.append(p_data)
			
	#???????????????????????????????????????
	xel = {}
	for i in whole_data:
		for x in i[2:]:
			if x in xel:
				xel[x] += 1
			else:
				xel[x] = 1
	
	#??????????????????????????¢?????????
	score = {}
	for y in xel.keys():
		score[y] = 5 - xel[y]	
	#????????¢??¨????????????????????????????????????
	result = []
	for i in whole_data:
		player_score = []
		player_score.append(i[0])
		player_score.append(0)
		for x in i[2:]:
			player_score[1] += score[x]
		result.append(player_score)
	
	#?????????????????????????¬?????????????????±???????	
	min_score = min(x[1] for x in result)
	winners = []
	for x in result:
		if x[1] == min_score:
			winners.append(x[0])
	print(str(min_score) + " " + sorted(winners)[0])

### FIXED CODE ###

while True:
	player_nun = int(input())
	if player_nun == 0:
		break
	
	#?????????????????????
	whole_data = []
	for i in range(0, player_nun):
		dat = input().split()
		p_data = []
		p_data.append(dat[0])
		for x in dat[1:]:
			p_data.append(int(x))
		whole_data.append(p_data)
	
	#???????????????????????????????????????
	xel = {}
	for i in whole_data:
		for x in i[2:]:
			if x in xel:
				xel[x] += 1
			else:
				xel[x] = 1
	
	#??????????????????????????¢?????????
	score = {}
	for y in xel.keys():
		score[y] = player_nun + 1 - xel[y]	
	#????????¢??¨????????????????????????????????????
	result = []
	for i in whole_data:
		player_score = []
		player_score.append(i[0])
		player_score.append(0)
		for x in i[2:]:
			player_score[1] += score[x]
		result.append(player_score)
	
	#?????????????????????????¬?????????????????±???????	
	min_score = min(x[1] for x in result)
	winners = []
	for x in result:
		if x[1] == min_score:
			winners.append(x[0])
	print(str(min_score) + " " + sorted(winners)[0])
	
	#??£??????????????????????????????
from collections import deque
d = deque()
n = int(input())
for i in range(n):
    s = input().split()
    if str(s[0][6]) =='F': d.popleft()
    elif: str(s[0][6]) =='L':d.pop()
    elif str(s[0][0]) == 'i': d.appendleft(int(s[1]))
    else : 
        if int(s[1]) in d:
            d.remove(int(s[1]))
        else: pass
print(*d)



### FIXED CODE ###

import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)
INF=1000000000+7

s=int(input())
dp=[0]*(s+1);
dp[0]=dp[1]=dp[2]=0
dp[3]=1
for i in range(4,s+1):
	temp=1
	for j in range(3,i-2):
		temp+=dp[j]%INF;
	temp%=INF;
	dp[i]=temp
print(dp[s])


### FIXED CODE ###

INF=1000000000+7

s=int(input())
dp=[0]*(2000+1);
	
dp[0]=dp[1]=dp[2]=0
dp[3]=1


for i in range(4,s+1):
	temp=1
	for j in range(3,i-2):
		temp+=dp[j]%INF;
	temp%=INF;
	dp[i]=temp
print(dp[s])
for i in range(5)
	a[i]= int(input())

d = a[4] - a[0]
k = int(input())

ans = 'Yay!' if k >= d else ':('
print(ans)

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

d = e - a
k = int(input())

ans = "Yay!" if k >= d else ":("
print(ans)
Sum=0
for i in range(N):
  Sum+=i+1
print(Sum)

### FIXED CODE ###

Sum=0
N=int(input())
for i in range(N):
  Sum+=i+1
print(Sum)
i = input()
a = i//2
b = i%2
print(a+b)

### FIXED CODE ###

i = input()
a = int(i)//2
b = int(i)%2
print(a+b)
N , M =map(int,input().split())
A_n =list(map(int,input().split()))

B_n=sorted(A_n)
i =0
count =len(B_n)
while B_n[i] < sum(B_n)/(4*M) and i<=len(B_n):
    i +=1
    count -=1
if count >= M:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N , M =map(int,input().split())
A_n =list(map(int,input().split()))

B_n=sorted(A_n,reverse=True)

if B_n[M-1] >= sum(B_n)/(4*M) :
    print('Yes')
else:
    print('No')
N = int(input())
aa = map(int, input().split())

f = False
for a in aa:
  if a % 2 == 0:
    if a % 3 != 0:
      print('DENIED')
      f = True
      break
    elif a % 5 != 0:
      print('DENIED')
      f = True
      break
if not f:
  print('APPROVED')


### FIXED CODE ###

abc = map(int, input().split())
 
abc_set = set(abc)

if len(abc_set) == 2:
  print('Yes')
else:
  print('No')
s=list(map(int,input().split()))
def ncr(n, r):
    r = min(r, n - r)
    if r == 0: return 1;
    if r == 1: return n;
    numerator = [n - r + i + 1 for i in range(r)]
    denominator  = [i + 1 for i in range(r)]
    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1: 
            result *= numerator[k]
    return result
if s[0]%3==0 and s[1]%3==0:
  a=max(s)-min(s)
  b=(min(s)-a)//3
  c=ncr(b*2+a,b)%1000000009
  print(int(c))
elif s[0]%3==1 and s[1]%3==2:
  a=s[0]-1
  b=s[1]-2
  c=max(a,b)-min(a,b)
  d=(min(a,b)-c)//3
  e=ncr(d*2+c+1,d)%1000000009
  print(int(e))
elif s[0]%3==2 and s[1]%3==1:
  a=s[0]-2
  b=s[1]-1
  c=max(a,b)-min(a,b)
  d=(min(a,b)-c)//3
  e=ncr(d*2+c+1,d)%1000000009
  print(int(e))

### FIXED CODE ###

X,Y=map(int,input().split())
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7
N = 10**6
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
if (X+Y)%3!=0:
  print(0)
else:
  n=2*Y-X
  m=2*X-Y
  if n<0 or m<0:
    print(0)
  else:
    n=int(n/3)
    m=int(m/3)
    print(cmb(n+m,m,mod))
import heapq as hp
n,m = map(int,input().split())
a = []
for i in range(n):
    a.append(list(map(int,input().split())))
a.sort(reverse = True)
d = {}
cd = {}
dp = 0
x = 0

for i in range(m):
    z,c = a[i]
    dp += z
    if c in d:
        hp.heappush(cd,z)
    else:
        d[c] = z
        x += 1
ans = dp + x**2
c = ans

for i in range(m,n):
    if len(cd) == 0:
        break
    z,v = a[i]
    if v in d:
        continue
    d[v] = z
    x += 1
    c = c - hp.heappop(cd)+d+2*x-1
    if c > ans:
        ans = c
print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
a = []
for i in range(n):
    r,t = map(int,input().split())
    a.append((t,r))
a.sort(reverse = True)
d = {}
cd = []
dp = 0
x = 0

for i in range(m):
    z,c = a[i]
    dp += z
    if c in d:
        cd.append(z)
    else:
        d[c] = z
        x += 1
cd.sort(reverse = True)
ans = dp + x**2
c = ans

for i in range(m,n):
    if len(cd) == 0:
        break
    z,v = a[i]
    if v in d:
        continue
    d[v] = z
    x += 1
    c = c - cd.pop()+z+2*x-1
    if c > ans:
        ans = c
print(ans)
n = int(input())
a = [1]
for _ in range(n):
    a.append(int(input()))
for i in range(1, n+1):
    a[i] = lcm(a[i-1], a[i])
print(a[-1])

### FIXED CODE ###

def gcd(a,b):
    while b:
        a, b = b, a%b
    return a

def lcm(a,b):
    return a * b // (gcd(a,b))
n = int(input())
a = [1]
for _ in range(n):
    a.append(int(input()))
for i in range(1, n+1):
    a[i] = lcm(a[i-1], a[i])
print(a[-1])
a, b, c = map(input().split())
a = int(a)
c = int(c)
if b == '+':
  print(a + c)
else:
  print(a - c)


### FIXED CODE ###

a, b, c = input().split()
a = int(a)
c = int(c)
if b == '+':
  print(a + c)
else:
  print(a - c)
import math

N = int(input())
T = [int(input()) for _ in range(N)]
LCM = 1

for i in T:
    LCM = LCM*i//math.gcd(LCM, i)

print(LCM)

### FIXED CODE ###

import sys
input = sys.stdin.readline


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a*b // gcd(a, b)


N = int(input())
T = [int(input()) for _ in range(N)]

if N == 1:
    print(T[0])

else:
    LCM = lcm(T[0], T[1])
    
    for i in range(1, N-1):
        LCM = lcm(LCM, T[i+1])
    
    print(LCM)
MOD = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
lst = [-1] * n
for i in range(n + 1):
    if lst[a[i] - 1] != -1:
        first = lst[a[i] - 1]
        second = i
        break
    lst[a[i] - 1] = i

# print (first, second)    
left = first
right = n - second
# print (left, right)

left_lst = [1] * (left + 1) 
for i in range(1, left + 1):
    left_lst[i] = (left_lst[i - 1] * (left + 1 - i)) // i
# print (left_lst)

right_lst = [1] * (right + 1)
for i in range(1, right + 1):
    right_lst[i] = (right_lst[i - 1] * (right + 1 - i)) // i
# print (right_lst)


def calc(i): #1を含めてトータルi個選ぶ
    if i == 1:
        return 1
    count = 0
    #左側からl個、右側からr個選ぶ
    start = max((i - 1) - right, 0) #左側から最低限選ばないといけない個数
    for l in range(start, i):
        count += left_lst[l] * right_lst[i - 1 - l]
    return count

N = n + 1
tmp = 1
for i in range(1, n + 2):
    tmp = (tmp * (N + 1 - i))//i
    if left + right < i - 1:
        print (tmp % MOD)
        continue
    print ((tmp - calc(i)) % MOD)

### FIXED CODE ###

MOD = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
lst = [-1] * n

# O(N)
for i in range(n + 1):
    if lst[a[i] - 1] != -1:
        first = lst[a[i] - 1]
        second = i
        break
    lst[a[i] - 1] = i

# print (first, second)    
left = first
right = n - second

U = 10 ** 5 + 1
def power_mod(a, n):
    if n == 0:
        return 1
    x = power_mod(a//2)

def make_fact(fact, fact_inv):
    for i in range(1, U + 1):
        fact[i] = (fact[i - 1] * i) % MOD
    fact_inv[U] = pow(fact[U], MOD - 2, MOD)
    for i in range(U, 0, -1):
        fact_inv[i - 1] = (fact_inv[i] * i) % MOD

def comb(n, k):
    if k < 0 or n < k:
        return 0
    x = fact[n]
    x *= fact_inv[k]
    x %= MOD
    x *= fact_inv[n - k]
    x %= MOD
    return x

fact = [1] * (U + 1)
fact_inv = [1] * (U + 1)
make_fact(fact, fact_inv)

for i in range(1, n + 2):
    ans = comb(n + 1, i) - comb(left + right, i - 1)
    print (ans % MOD)
n=int(input())
sum=0
for j in range(n):
  i,c=input().split()
  if c=="BTC":
    sum+=float(i)*380000
  else:
    sum+=int(i)
print(sum)

### FIXED CODE ###

s=input()
if s<="2019/04/30":
  print("Heisei")
else:
  print("TBD")
import math
n=int(input())
z=[list(map(input().split())) for i in range(n)]
a=math.factorial(n)
for i in range(n-1):
  for j in range(i,n):
    b=(z[i][0]-z[j][0])**2+(z[i][1]-z[j][1])**2
print(b**0.5/a)

### FIXED CODE ###

import math
n=int(input())
z=[list(map(int,input().split())) for i in range(n)]
a=math.factorial(n)
b=0
for i in range(n):
  for j in range(n):
    b=b+((z[i][0]-z[j][0])**2+(z[i][1]-z[j][1])**2)**0.5
print((math.factorial(n)/n)*b/a)
from sys import stdin
from itertools import accumulate

a,b = [int(x) for x in stdin.readline().rstrip().split()]
li = [int(stdin.readline().rstrip()) for _ in range(b)]

if a == 1:
    print(1)
    exit()

elif a == 2:
    if b == 0:
        print(2)
        exit()
    else:
        print(1) 
        exit()

for k in range(len(li)-1):
    if li[k] +1 == li[k+1]:
        print(0)
        exit()

def stair_cal(x):
    if x == 1:
        return(x)
    elif x == 2:
        return(x)
    elif x == 0:
        return(1)
    lin = [1,2]
    for i in range(2,x):
        lin.append(lin[i-2]+lin[i-1])
    return(lin[-1])

li2 = []

li2.append(li[0]-1)

for i in range(1,b):
    li2.append(li[i]-li[i-1]-1)

li2.append(a-li[-1])

point = 1

for e in range(len(li2)):
    point = point*stair_cal(li2[e])%(10**9+7)

print(point)


### FIXED CODE ###

from sys import stdin

n,m = [int(x) for x in stdin.readline().rstrip().split()]

lin = [0]*(n+1)

if m != 0:
    for i in range(m):
        lin[int(stdin.readline().rstrip())] = -1

dp = [-1]*(n+1)

dp[0] = 1

if lin[1] == -1:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2,n+1):
    if lin[i] == -1:
        dp[i] = 0
    else:
        dp[i] = dp[i-1] + dp[i-2]

print(dp[n]%(10**9+7))
n = int(input())
fukuro = list(map(str,input().split()))
types = 'Three'
for i in range(len(fukuro)):
  if fukuro[i] == 'Y':
    types = 'Four'
    break
print(types)

### FIXED CODE ###

n = int(input())
print(int(n/3))
import collections
s = input()
K = int(input())

res = [s[i: j] for i in range(len(s)) for j in range(i + 1, len(s) + 1)] 
  
s = list(set(res))
s.sort()
print(s[K-1])



### FIXED CODE ###

s = input()
N = len(s)
K = int(input())

subs = set()
for i in range(N):
  for j in range(K):
    subs.add(s[i:i+1+j])
  
print(sorted(subs)[K-1])
a,b,h=map(int,input().split())
print((a+b)*h//2)

### FIXED CODE ###

a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2))
def main():
    import math
    import collections
    N = int(input())

    mod = 10**9+7
    AB = [tuple(map(int, input().split())) for i in range(N)]

    d = collections.defaultdict(set)
    i = 0
    ab = []
    for a, b in AB:
        g = math.gcd(a, b)
        a = a // g
        b = b // g
        # d[(a, b)] += 1
        if a > 0 and b < 0:
            a = -a
            b = -b
        d[(a, b)].add(i)
        ab.append((a, b))
        i += 1

    ans = 0
    r = set()

    dd = [1]
    for i in range(1, N+1):
        dd.append(dd[i-1]*2 % mod)

    r = set()
    ans = 1
    for (a, b) in d:
        if (a, b) in r:
            continue
        l1 = len(d[(a, b)])

        tmp = dd[l1]
        s = set()
        if (-b, a) in d:
            s |= d[(-b, a)]
        if (b, -a) in d:
            s |= d[(b, -a)]
        l2 = len(s)
        if l2:
            ans *= tmp + dd[l2] - 1
            N -= l1 + l2
            ans %= mod

            r.add((-b, a))
            r.add((b, -a))
        else:
            continue
    if N:
        ans *= dd[N]*2
    ans -= 1

    print(ans % mod)


main()


### FIXED CODE ###

def main():
    import math
    import collections
    N = int(input())

    mod = 10**9+7
    AB = [tuple(map(int, input().split())) for i in range(N)]

    d = collections.defaultdict(set)
    i = 0
    ans2 = 0
    for a, b in AB:
        if a == 0 and b == 0:
            N -= 1
            ans2 += 1
            continue
        g = math.gcd(a, b)
        if g != 0:
            a = a // g
            b = b // g

        d[(a, b)].add(i)
        i += 1

    ans = 0
    r = set()

    dd = [1]
    for i in range(1, N+1):
        dd.append(dd[i-1]*2 % mod)

    r = set()
    ans = 1
    for a, b in d:
        if (a, b) in r:
            continue
        s1 = d[(a, b)]
        if (-a, -b) in d:
            s1 |= d[(-a, -b)]
        l1 = len(s1)
        r.add((-a, -b))
        if l1:
            s2 = set()
            if (-b, a) in d:
                s2 |= d[(-b, a)]
            if (b, -a) in d:
                s2 |= d[(b, -a)]
            s2 -= s1
            l2 = len(s2)
            if l2:
                ans *= dd[l1] + dd[l2] - 1
                N -= l1 + l2
                ans %= mod
                r.add((-b, a))
                r.add((b, -a))
            else:
                continue
    if N:
        ans *= dd[N]
    ans += ans2
    ans -= 1
    print(ans % mod)


main()
N, A = (int(x) for x in input().split())
ans = N**2 - A
print(ans)

### FIXED CODE ###

N = int(input())
A = int(input())
ans = N**2 - A
print(ans)
N = int(input())
S = int(input())

ans = 0

for i in range(1000):
    t = str(i).zfill(3)
    t_index = 0
    for s_index in range(N):
        if S[s_index] == t[t_index]:
            t_index += 1
            if t_index == 3:
                break
        if t_index == 3:
            ans += 1
print(ans)


### FIXED CODE ###

N = int(input())
S = tuple(map(int, input()))

ans = 0

for i in range(10):
    if i in S[:N - 2]:
        i_index = S.index(i)
        for j in range(10):
            if j in S[i_index + 1: N - 1]:
                j_index = i_index + S[i_index + 1: N - 1].index(j) + 1
                for k in range(10):
                    if k in S[j_index + 1:]:
                        ans += 1
print(ans)
from collections import defaultdict


def factorize(n: int) -> dict:
    f = defaultdict(int)
    while n % 2 == 0:
        f[2] += 1
        n //= 2
    p = 3
    while p * p <= n:
        while n % p == 0:
            f[p] += 1
            n //= p
        p += 2
    if n != 1:
        f[n] += 1
    return f


def _pow(b, p, mod):
    ret = 1
    while p:
        if p % 2 == 1:
            ret *= b
            ret %= mod
        b **= 2
        p //= 2
    return ret


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

a_fac = []
lcm_fac = defaultdict(int)
for a_i in a:
    a_fac_i = factorize(a[i])
    a_fac.append(a_fac_i)
    for k, v in a_fac_i.items():
        lcm_fac[k] = max(lcm_fac[k], v)

# print(lcm_fac)
ans = 0
for a_fac_i in a_fac:
    b_i = 1
    for k, v in lcm_fac.items():
        b_i *= _pow(k, v - a_fac_i[k], MOD)
        b_i %= MOD
    # print(i, a[i], b_i)
    ans += b_i
    ans %= MOD

print(ans)


### FIXED CODE ###

def GCD(a: int, b: int) -> int:
    return a if b == 0 else GCD(b, a % b)


def LCM(a: int, b: int) -> int:
    return a * b // GCD(a, b)


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

MAX_a = max(a)
iinv = [1] * (MAX_a + 1)
for i in range(2, MAX_a + 1):
    iinv[i] = MOD - iinv[MOD % i] * (MOD // i) % MOD

lcm = 1
for i in range(n):
    lcm = LCM(lcm, a[i])

lcm %= MOD

ans = 0
for i in range(n):
    ans += lcm * iinv[a[i]]
    ans %= MOD

print(ans)
def Comb(n,k):
    comb_ans=1
    for i in range(1,k+1):
        comb_ans*=(n-i+1)/i
    comb_ans=int(comb_ans)
    return comb_ans

N=int(input())
A=list(map(int,input().split()))
ans=0
B=set(A)
L=[0]*N
for i in range(N):
    L[A[i]-1]+=1
for i in B:
    ans+=Comb(L[i-1],2)
for i in range(N):
    pri=ans
    pri=ans-L[A[i]-1]+1
    print(pri)

### FIXED CODE ###

n,m=map(int,input().split())
def Comb(n,k):
    comb_ans=1
    for i in range(1,k+1):
        comb_ans*=(n-i+1)/i
    comb_ans=int(comb_ans)
    return comb_ans
ans=Comb(n,2)+Comb(m,2)
print(ans)
n=int(input())
N=list(map(int,input().split()))
emptylists=[]
number=0
for i in range(n):
	number+=N[i]
    emptylists.append(number)
ans1=0
use=0
for i in range(n):
    #偶数番が正、奇数番が負の時
    if i%2==0:
        #奇数番め
        if emptylists[i]+use<0:
            continue
        if emptylists[i]+use>=0:
            ans1+=emptylists[i]+1  
            use=use-emptylists[i]-1
        
    if i%2!=0:
        #偶数番め
        if emptylists[i]+use>0:
            continue
        if emptylists[i]+use<=0:
            ans1+=1-emptylists[i]-use
            use=use+1-emptylists[i]
ans2=0
uses=0
for i in range(n):
    #偶数番が負、奇数番が正の時
    if i%2!=0:
        #ぐう数番め
        if emptylists[i]<0:
            continue
        if emptylists[i]>=0:
            ans2+=emptylists[i]+1  
            uses=uses-emptylists[i]-1       
    if i%2==0:
        #き数番め
        if emptylists[i]>0:
            continue
        if emptylists[i]<=0:
            ans2+=1-emptylists[i]-uses
            uses=uses+1-emptylists[i]
print(min(ans1,ans2)) 

### FIXED CODE ###

#sequence
n=int(input())
lists=list(map(int,input().split()))
a=0
sum1=0
#奇数番目の項が-,偶数番目の項が＋の場合の最小値
for i in range(n):
    sum1+=lists[i]
    if i%2==0:
        if sum1>=0:
            a+=(sum1+1)
            sum1=-1
        elif sum1<0:
            pass
    elif  i%2!=0:
        if sum1<=0:
            a+=(1-sum1)
            sum1=1
        elif sum1>0:
            pass

b=0
#奇数番目の項が＋、偶数番目の項が−の場合の最小値
sum2=0
for i in range(n):
    sum2+=lists[i]
    if i%2!=0:
        if sum2>=0:
            b+=(sum2+1)
            sum2=-1
        elif sum2<0:
            pass
    elif  i%2==0:
        if sum2<=0:
            b+=(1-sum2)
            sum2=1
        elif sum2>0:
            pass
print(min(a,b))
str=input()
x,y=map(double,str.split(" "))
print(x*y)

### FIXED CODE ###

x,y=map(int,input().split(" "))
print(x*y,x*2+y*2)
#11
n = int(input())
a = list(map(int, input().split()))

flag = [a.count(a[i])-1 for i in range(n+1) ]
p = flag.index(1) + list(reversed(flag)).index(1)

g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
mod = 10**9 + 7
for i in range( 2, n + 2 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def combination(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


for i in range(n+1):
    if ( p>=i ):
        c = combination(n+1, i+1) - combination(p, i)
    else:
        c = combination(n+1, i+1)
    print( int(c) )

### FIXED CODE ###

# ringing
a = list(map(int, input().split()))
a = sorted(a)
print( a[0]+a[1] )