Harryxun/stf_run huggingface dataset:
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n, m = map(int, readline().split())
  A = list(int(readline()) for i in range(m))
  A.append(INF)
  dp = [0]*(n+1)
  dp[0] = 0
  j = 0
  if A[j] == 1:
    dp[1] = 0
    j += 1
  else:
    dp[1] = 1
  
  if A[j] == 2:
    dp[2] = 0
    j += 1
  else:
    dp[2] = dp[1] + 1
  
  for i in range(3, n+1):
    if A[j] == i:
      dp[i] = 0
      j += 1
    else:
      dp[i] = (dp[i-1]+dp[i-2])%MOD
  print(dp[n])
  
if __name__ == '__main__':
  main()

### FIXED CODE ###

from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n, m = map(int, readline().split())
  A = list(int(readline()) for i in range(m))
  A.append(INF)
  dp = [0]*(n+1)
  dp[0] = 0
  j = 0
  if A[j] == 1:
    dp[1] = 0
    j += 1
  else:
    dp[1] = 1
  
  if n>=2:
    if A[j] == 2:
      dp[2] = 0
      j += 1
    else:
      dp[2] = dp[1] + 1
  
  if n>=3:
    for i in range(3, n+1):
      if A[j] == i:
        dp[i] = 0
        j += 1
      else:
        dp[i] = (dp[i-1]+dp[i-2])%MOD
  print(dp[n])
  
if __name__ == '__main__':
  main()
import sys
sys.setrecursionlimit(1000000)
def input():
    return sys.stdin.readline()
n, q = [int(i) for i in input().split()]
e = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = [int(i) - 1 for i in input().split()]
    e[a].append(b)
    e[b].append(a)

p = [0] * n
for _ in range(q):
    pp, x = [int(i) for i in input().split()]
    p[pp - 1] += x


def dfs(i=0, r=-1):
  	if r!=-1:
    	p[i] += p[r]
    for j in e[i]:
        if j == r:
            continue
        dfs(j, i)
dfs()

print(" ".join(map(str,p)))


### FIXED CODE ###

import sys

sys.setrecursionlimit(1000000)


def input():
    return sys.stdin.readline()


n, q = [int(i) for i in input().split()]
ab = [[] for _ in range(n)]
for _ in range(n - 1):
    i, j = [int(i)-1 for i in input().split()]
    ab[i].append(j)
    ab[j].append(i)
p = [0]*n
for _ in range(q):
    i, j = [int(i) for i in input().split()]
    p[i-1] += j

al = [False]*n
pp = [0]*n


def a(i=0, j=0):
    al[i] = True
    j += p[i]
    pp[i] = str(j)
    for k in ab[i]:
        if not al[k]:
            a(k, j)


a()
print(" ".join(pp))
arr = input().split(" ")
a, b, n = int(arr[0]), int(arr[1]), int(arr[2])
if b<=n:
  k = a
else:
  k = (a*((n-1))//b
print(k)

### FIXED CODE ###

arr = input().split(" ")
a, b, n = int(arr[0]), int(arr[1]), int(arr[2])
if b<=n:
   k = int((a*(b-1))/b)
else:
   k = int((a*n)/b)
print(k)
N, M = map(int, input().split())

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

a = cmb(N,2) + cmb(M,2)

print(int(a))

### FIXED CODE ###

N, M = map(int, input().split())
 
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

if N < 2 and M < 2:
  a = 0
elif N < 2:
  a = cmb(M,2)
elif M < 2:
  a = cmb(N,2)
elif N > 1 and M > 1:
  a = cmb(N,2) + cmb(M,2)

print(int(a))
a,b=map(int,input.split())
if a<=5:
    print(0)
elif a>=6 and 12<=a:
    print(b/2)
else:
    print(b)

### FIXED CODE ###

a,b=map(int,input().split())
if a<=5:
    print(0)
elif a>=6 and a<=12:
    print(b//2)
else:
    print(b)
N = int(input())
con = []
conter = 0

for i in range(1, 105):
    if i % 2 == 1:
        for s in range(1, i/2):
            if i % s == 0:
                counter += 1
            
        con.append(counter)


print(con.count(8))

### FIXED CODE ###

N = int(input())
con = []
counter = 0

for i in range(1, N+1):
    if i % 2 == 1:
        for s in range(1, i+1):
            if i % s == 0:
                counter += 1
            
        con.append(counter)
        counter = 0


print(con.count(8))
s = input()
s = s.split(" ")
N = s[0]
K = int(s[1])

s = input()
s = s.split(" ")
ds = [int(digit) for digit in s]

minNum = min([digit for digit in range(0, 10) if digit not in ds])
maxNum = max([digit for digit in range(0, 10) if digit not in ds])

digits = [int(digit) for digit in N]

result = N
for index in range(0, len(digits)):
  digit = digits[index]
  if digit in ds:
    i = index
    if digit > maxNum:
      i = index - 1
      while i >= 0 and digits[i] == maxNum:
        i -= 1
    
    if i < 0:
      result = str(minNum) * (len(N) + 1)
    else:
      biggerDigit = min([d for d in range(0, 10) if d not in ds and d > digits[i]])
      digits[i] = biggerDigit
      for j in range(i+1, len(digits)):
        digits[j] = minNum
      result = "".join([str(digit) for digit in digits])

print(result)


### FIXED CODE ###

s = input()
s = s.split(" ")
N = s[0]
K = int(s[1])

s = input()
s = s.split(" ")
ds = [int(digit) for digit in s]

minNum = min([digit for digit in range(0, 10) if digit not in ds])
nonZerominNum = min([digit for digit in range(1, 10) if digit not in ds])
maxNum = max([digit for digit in range(0, 10) if digit not in ds])

digits = [int(digit) for digit in N]

result = N
for index in range(0, len(digits)):
  digit = digits[index]
  if digit in ds:
    i = index
    if digit > maxNum:
      i = index - 1
      while i >= 0 and digits[i] == maxNum:
        i -= 1
    
    if i < 0:
      result = str(nonZerominNum) + (str(minNum) * len(N))
    else:
      biggerDigit = min([d for d in range(0, 10) if d not in ds and d > digits[i]])
      digits[i] = biggerDigit
      for j in range(i+1, len(digits)):
        digits[j] = minNum
      result = "".join([str(digit) for digit in digits])
    break

print(result)
a, b = map(int, input().split)
print("{} {}".format(a*b, 2*(a+b))


### FIXED CODE ###

a, b = map(int, input().split())
print("{} {}".format(a*b, 2*(a+b)))
k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n):
  b.append(a[i]-a[i-1])
b.append(k-a[n-1]-a[0])

b.sorted(b)

print(sum(b[:-1]))

### FIXED CODE ###

k,n = map(int,input().split())
a = list(map(int,input().split()))
b = []

for i in range(1,n):
  b.append(a[i] - a[i - 1])
b.append(k - a[n-1] + a[0])

b = sorted(b)
print(sum(b[:n-1]))
#coding utf-8
N,K=map(int,input().split())
V =list(map(int,input().split())) 

Vl =V
Vr =V[::-1]

dpl=[]
dpr=[]
ansl=[0]
ansr=[0]

for i in range(K):
  if not dpl:
    dpl.append(Vl.pop(0))
  elif min(dpl)<0 and min(dpl)<Vl[i]:
    del dpl[dpl.index(min(dpl))]
  else:
    dpl.append(Vl.pop(0))
  ansl.append(max(sum(dpl),ansl[i]))

for i in range(K):
  if not dpr:
    dpr.append(Vr.pop(0))
  elif min(dpr)<0 and min(dpr)<Vr[i]:
    del dpr[dpr.index(min(dpr))]
  else:
    dpr.append(Vr.pop(0))
  ansr.append(max(sum(dpr),ansr[i]))
    
ans=0    
for i in range(1,K):
  tmp=ansr[i]+ansl[K-i]
  if ans<tmp:
    ans=tmp
  
print(ans)

### FIXED CODE ###

#coding utf-8
N,K=map(int,input().split())
V =list(map(int,input().split())) 

dpl=[]
temp=[]
T =min(N,K)+1
ans=0
for i in range(T):
  for j in range(T-i):
    dpl.clear()
    if i>0:
      dpl.extend(V[0:i])
    if j>0:
      dpl.extend(V[N-j:N])
    dpl.sort()            
    for k in range(K-i-j+1):
      if dpl != [] and k>0:
        if dpl[0]<=0:
          del dpl[0]       
      if ans<sum(dpl):
        ans=sum(dpl)
      if dpl == [] or dpl[0]>0:
        break

print(ans)
S = input()
list_s = list(reversed(list(S)))
small_s = int(S.replace('?', '0'))
L = 0
t = []
for i, s in enumerate(list_s):
    if s == '?':
        L += 1
        t.append(i)

count = 0
d = small_s % 13
for l in range(10**L):
    list_l = list(reversed(list(str(l))))
    temp = d
    for i, a in enumerate(list_l):
        temp += int(a)*(10**t[i])
    if temp % 13 == 5:
        count += 1
print(count)



### FIXED CODE ###

S = input()[::-1]
MOD = 10**9+7
dp = [1,0,0,0,0,0,0,0,0,0,0,0,0]
p = 1
for i, s in enumerate(S):
    nx = [0,]*13
    if s == '?':
        for k in range(10):
            q = (k*p)%13
            for j, d in enumerate(dp):
                nx[(j+q)%13] += d
    else:
        q = (int(s)*p)%13
        for j, d in enumerate(dp):
            nx[(j+q)%13] += d
    dp = [n % MOD for n in nx]
    p = (10*p)%13
print(dp[5])
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)

hantei = sum(a) / (4 * m)
if a[m-1] > hantei:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

x,y,z = map(int, input().split())
print(z,x,y)
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)


def main():
    N, M, X = map(int, input().split())
    CA_list = [list(map(int,list(input().split(" ")))) for i in range(M)]
    Ci_sum_list = []
    
    for i in range(2 ** N):
        sum_list = [0 for i in range(M + 1)]
        for j in range(N):
            if ((i >> j) & 1):
                sum_list = [x + y for (x, y) in  zip(sum_list, CA_list[j])]
                
        logging.info(sum_list)
        if [x for x in sum_list[1:] if x < X]:
            continue
        else:
            Ci_sum_list.append(sum_list[0])

    if Ci_sum_list:
        print(min(Ci_sum_list))
    else:
        print(-1)
        
if __name__ == "__main__":
    main()


### FIXED CODE ###

import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)


def main():
    N, M, X = map(int, input().split())
    CA_list = [list(map(int,list(input().split(" ")))) for i in range(N)]
    Ci_sum_list = []
    
    for i in range(2 ** N):
        sum_list = [0 for i in range(M + 1)]
        for j in range(N):
            if ((i >> j) & 1):
                sum_list = [x + y for (x, y) in  zip(sum_list, CA_list[j])]
                
        logging.info(sum_list)
        if [x for x in sum_list[1:] if x < X]:
            continue
        else:
            Ci_sum_list.append(sum_list[0])

    if Ci_sum_list:
        print(min(Ci_sum_list))
    else:
        print(-1)
        
if __name__ == "__main__":
    main()
l,s = [],[]
for i in range(5):
    num = int(input())
    l.append(num)
    s.append(num%10)

res = 0

s = list(set(s))
if 0 in s:
    s.remove(0)

for i in l:
    if i%10!=0:
        res += (i+10)//10*10
    else:
        res += i
else:
    tmp = min(s)
    print(res-(10-tmp)) if len(s)!=0 else print(res)

### FIXED CODE ###

l,s = [],[]
for i in range(5):
    num = int(input())
    l.append(num)
    if num%10!=0:
        s.append(num%10)

res = 0

for i in l:
    if i%10!=0:
        res += (i+10)//10*10
    else:
        res += i
else:
    if len(s) != 0:
        tmp = min(s)
    else:
        tmp = 10
    print(res-(10-tmp))
import math
  
r = float(input())
  
s = r * r * math.pi
  
l = r * 2 * math.pi
  
print('%.5f %.5f' % (s, l))

### FIXED CODE ###

a, b, c = map(int, input().split())
print('Yes' if a < b < c else 'No')
S_nk = input().split(" ") #標準入力（N, K）
S_h = input().split(" ") #標準入力（Hi）

N = int(S_nk[0]) #モンスターの種類
K = int(S_nk[1]) #必殺技の制限回数
H = [] #モンスターのヒットポイント
for i in range(N):
  H.append(int(S_h[i]))

#ヒットポイントの大きい順にソート
H.sort(reverse=True)

for i in range(K):
  H[i] = 0

print(sum(H))

### FIXED CODE ###

S_nk = input().split(" ") #標準入力（N, K）
S_h = input().split(" ") #標準入力（Hi）

N = int(S_nk[0]) #モンスターの種類
K = int(S_nk[1]) #必殺技の制限回数
H = [] #モンスターのヒットポイント
for i in range(N):
  H.append(int(S_h[i]))

#ヒットポイントの大きい順にソート
H.sort(reverse=True)

if K < len(H):
  for i in range(K):
  	H[i] = 0
  print(sum(H))
else:
  print(0)
n,l = map(int,input().split())
x = [str(input()) for _ range(n)]
x.sort()
a = ' '
for i in x:
  a += i
print(a)

### FIXED CODE ###

n,l = map(int,input().split())
x = [str(input()) for _ in range(n)]
x.sort()
a = ' '
for i in x:
  a += i
print(a)
n=int(input())
s=str(input())
r=s[:(n/2)]
t=s[(n/2):]
if(r==t):
  print("Yes")
else:
  print("No")


### FIXED CODE ###

n=int(input())
s=str(input())
r=s[:n//2]
t=s[n//2:]
if(r==t):
  print("Yes")
else:
  print("No")
N,X=map(int,input().split())
x=list(map(int,input().split()))+[X]

from fractions import gcd

x=[x[i+1]-x[i] for i in range(N)]

def gcd_many(_list):
    if len(_list)==2:
        return gcd(_list[0],_list[1])
    else:
        return gcd(_list[0],gcd_many(_list[1:]))
        
print(gcd_many(x))

### FIXED CODE ###

N,X=map(int,input().split())
x=list(map(int,input().split()))+[X]

from fractions import gcd

x=[x[i+1]-x[i] for i in range(N)]

ans=0
for i in range(N):
    ans=gcd(ans,x[i])
print(abs(ans))
n,m,k=list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))

a,b=[0],[0]
for i in range(n):
  a.apppend(a[i]+A[i])
 
for i in range(m):
  b.append(b[i] + B[i])
 
ans,j=0,m

for i in range(n+1):
  if a[i] >k:
    break
   while b[j] > k-a[i]:
    j -=1
   
   ans=max(ans,i+j)
    
print(ans)
 

           

### FIXED CODE ###

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

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

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

A,B=[0],[0]

for i in range(n):
    A.append(A[i] + a[i])

for i in range(m):
    B.append(B[i] + b[i])


ans,j =0,m

for i in range(n+1):
    if A[i] > k:
        break
    while B[j] > k-A[i]:
        j -=1

    ans =max(ans,i+j)

print(ans)
import sys
sys.setrecursionlimit(10000)

n, q = map(int, input().split())
Tree = {i:[] for i in range(1, n+1)}
Counter = {i:0 for i in range(1, n+1)}

for _ in range(n-1):
  a,b = map(int, input().split())
  Tree[a].append(b)
  
def dfs(i, c, t):
  if t[i]:
    for j in t[i]:
      c[j] += c[i]
      dfs(j, c, t)

for _ in range(q):
  p,x = map(int, input().split())
  Counter[p] += x

dfs(1, Counter, Tree)
print(*Counter.values())


### FIXED CODE ###

n, q = map(int, input().split())
Tree = [[] for _ in range(n+1)]
Counter = [0 for _ in range(n+1)]
AB = (tuple(map(int, input().split())) for _ in range(n-1))
PX = (tuple(map(int, input().split())) for _ in range(q))

for a,b in AB:
  Tree[a].append(b)
  Tree[b].append(a)
  
for p,x in PX:
  Counter[p] += x

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

nodes = [1]
while nodes:
  parent = nodes.pop()
  for node_i in Tree[parent]:
    if P[parent]==node_i:
      continue
    P[node_i] = parent
    nodes.append(node_i)
    Counter[node_i] += Counter[parent]

print(*Counter[1:])
from heapq import *
x, y, z, k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a = sorted(a, reverse = True)
b = sorted(b, reverse = True)
c = sorted(c, reverse = True)

ans = heapify([-(a[0] + b[0] + c[0]), 1, 1, 1])
log = [[[0] * len(c) for i in range(len(b))] for j in range(len(a))]
log[0][0][0] = 1

d = [(1, 0, 0), (0, 1, 0), (0, 0, 1)]
for i in range(k):
    temp, s, t, u = heappop(ans)
    temp = temp * (-1)
    print(temp)
    for ds, dt, du in d:
        ns = s + ds
        nt = t + dt
        nu = u + du
        if log[ns - 1][nt - 1][nu - 1]:continue
        heappush(ans, [-(a[ns - 1] + b[nt - 1] + c[nu - 1]), ns, nt, nu])
        log[ns - 1][nt - 1][nu - 1] = 1

### FIXED CODE ###

x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

c = sorted(c, reverse=True)
ab = []
for i in range(x):
    for j in range(y):
        temp = a[i] + b[j]
        ab.append(temp)

ab = sorted(ab, reverse=True)
ans = []
for i in range(z):
    for j in range(min(x * y, k)):
        temp = c[i] + ab[j]
        ans += [temp]
ans = sorted(ans, reverse=True)

for i in range(k):
    print(ans[i])
x, y, a, b, c = map(int, input().split())
red = list(map(int, input().split()))
green = list(map(int, input().split()))
no = list(map(int, input().split()))

red.sort()
green.sort()
no.sort()
a -= 1
b -= 1
c -= 1

ans = 0
for i in range(x):
    ans += red[a]
    a -= 1
for i in range(y):
    ans += green[b]
    b -= 1
a += 1
b += 1

for i in range(x+y):
    gr = no[c] - red[a]
    gg = no[c] - green[b]

    if gr > gg:
        if gr > 0:
            ans += no[c]
            ans -= red[a]
            c -= 1
            a += 1
    elif gg > gr:
        if gg > 0:
            ans += no[c]
            ans -= green[b]
            c -= 1
            b += 1

print(ans)


### FIXED CODE ###

x, y, a, b, c = map(int, input().split())
red = list(map(int, input().split()))
green = list(map(int, input().split()))
no = list(map(int, input().split()))

red.sort()
green.sort()
no.sort()
a -= 1
b -= 1
c -= 1
max_a = int(a)
max_b = int(b)

ans = 0
for i in range(x):
    ans += red[a]
    a -= 1
for i in range(y):
    ans += green[b]
    b -= 1
a += 1
b += 1

for i in range(x+y):
    if c >= 0 and a <= max_a and b <= max_b:
        gr = no[c] - red[a]
        gg = no[c] - green[b]
        if gr >= gg:
            if gr > 0:
                ans += no[c]
                ans -= red[a]
                c -= 1
                a += 1
        elif gg >= gr:
            if gg > 0:
                ans += no[c]
                ans -= green[b]
                c -= 1
                b += 1
    elif c >= 0 and a <= max_a:
        if no[c] - red[a] > 0:
            ans += no[c]
            ans -= red[a]
            c -= 1
            a += 1
    elif c >= 0 and b <= max_b:
        if no[c] - green[b] > 0:
            ans += no[c]
            ans -= green[b]
            c -= 1
            b += 1
    else:
        break

print(ans)
import sys

n,m = map(int,input().split())
sc = []

for _ in range(m):
  sc.append(list(map(int,input().split())))

sc.sort()

if sc[0][0] == 1 and sc[0][1] == 0:
  print('-1')
  sys.exit()

num = 0
while len(sc) > num+1:
  if sc[num][0] == sc[num+1][0]:
    if sc[num][1] == sc[num+1][1]:
      del sc[num]
      num = 0
      continue
    else:
      print('-1')
      sys.exit()
  num += 1

ans = [0 for _ in range(n)]
for i in range(len(sc)):
  ans[sc[i][0]-1] = sc[i][1]
if ans[0] == 0:
  ans[0] = 1

res = ''
for i in range(len(ans)):
  res = res + str(ans[i])

print(res)


### FIXED CODE ###

import sys

n,m = map(int,input().split())
sc = []

if m == 0 and n == 1:
  print(0)
  sys.exit()
elif m == 0 and n != 1:
  print(10**n // 10)
  sys.exit()


for _ in range(m):
  sc.append(list(map(int,input().split())))

sc.sort()

if n == 1:
  tmp = 0
  for i in range(m):
    if sc[i][0] == 1 and sc[i][1] == 0:
      tmp += 1
    if tmp == m:
      print(0)
      sys.exit()

if sc[0][0] == 1 and sc[0][1] == 0:
  print('-1')
  sys.exit()

ans = [-1 for _ in range(n)]
for i in range(m):
  if ans[sc[i][0]-1] == -1:
    ans[sc[i][0]-1] = sc[i][1]
  else:
    if ans[sc[i][0]-1] != sc[i][1]:
      print('-1')
      sys.exit()

res = ''
if ans[0] == -1:
  ans[0] = 1
for i in range(n):
  if ans[i] == -1:
    ans[i] = 0
  res = res + str(ans[i])

print(res)
#coding:utf-8
r,D,x = map(int,input().split())
x2001 = r * X - D
x2002 = r * X2001 -D
x2003 = r * X2002 - D
x2004 = r * X2003 - D
x2005 = r * X2004- D
x2006 = r * X2005- D
x2007 = r * X2006 - D
x2008 = r * X2007 - D
x2009 = r * X2008 - D
x2010 = r * X2009 - D
X = [x2001,x2002,x2003,x2004,x2005,x2006,x2007.x2008,x2009,x2010]
print(split(X))

### FIXED CODE ###

#coding:utf-8
r,D,x = map(int,input().split())
x2001 = r * x - D
x2002 = r * x2001 - D
x2003 = r * x2002 - D
x2004 = r * x2003 - D
x2005 = r * x2004 - D
x2006 = r * x2005 - D
x2007 = r * x2006 - D
x2008 = r * x2007 - D
x2009 = r * x2008 - D
x2010 = r * x2009 - D
print(x2001)
print(x2002)
print(x2003)
print(x2004)
print(x2005)
print(x2006)
print(x2007)
print(x2008)
print(x2009)
print(x2010)
n=int(input())

x=[[int(i) for i in input().split()] for i in range(n)]
      
#print(x)

def hight(a,b,x,y,z):
  h=z+abs(x-a)+abs(y-b)
  return h

ans=0

for k in range(101):
  for l in range(101):
    flag=0
    for i in range(1,n):
      if hight(k,l,x[0][0],x[0][1],x[0][2])==hight(k,l,x[i][0],x[i][1],x[i][2]):
        flag+=1 
    if flag==n-1:
      ans1=k
      ans2=l
      ans3=hight(k,l,x[0][0],x[0][1],x[0][2])

print(ans1,ans2,ans3)

### FIXED CODE ###

n=int(input())

x=[[int(i) for i in input().split()] for i in range(n)]
#print(x)
cnt=0
for m in range(n):
  if x[m][2]>0:
    cnt+=1
    ii=m
    
#print(ii,cnt)

def hight(a,b,x,y,z):
  h=z+abs(x-a)+abs(y-b)
  return h

for i in range(101):
  for j in range(101):
    flag=0
    for k in range(n):
      if x[k][2]>0:
        if hight(i,j,x[ii][0],x[ii][1],x[ii][2])==hight(i,j,x[k][0],x[k][1],x[k][2]):
          flag+=1
      else:
        if hight(i,j,x[ii][0],x[ii][1],x[ii][2]) > hight(i,j,x[k][0],x[k][1],x[k][2]):
          flag=0
     
    if flag==cnt:
      ans1=i
      ans2=j
      ans3=hight(i,j,x[ii][0],x[ii][1],x[ii][2])
      
print(ans1,ans2,ans3)
#print(flag)
print(int(input()-24)

### FIXED CODE ###

print(48-int(input()))
x, y = map(int, input().split())
if x > y:
  print(">")
elif x < y:
  print("<")
else:
  print("=")

### FIXED CODE ###

l = ["A", "B", "C", "D", "E", "F"]
x, y = map(str, input().split())
if l.index(x) > l.index(y):
  print(">")
elif l.index(x) < l.index(y):
  print("<")
else:
  print("=")
def factorization(n):
    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

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

soinsu = [0 for _ in range(1000)]
for i in range(n):
    lst = factorization(a[i])
    for ind, jousu in lst:
        soinsu[ind] = max(soinsu[ind], jousu)

ans = 0
for i in range(n):
    lst = factorization(a[i])
    copied_soinsu = soinsu.copy()
    for ind, jousu in lst:
        copied_soinsu[ind] -= jousu
    bi = 1
    for j in range(1000):
        bi = bi * (j**copied_soinsu[j]) % mod
    ans = (ans + bi) % mod

print(ans)

### FIXED CODE ###

import fractions
from functools import reduce

mod = 10**9 + 7

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
a = list(map(int, input().split()))
a_ = []
for i in range(n):
    a_.append(pow(a[i], mod - 2, mod))

num_lcm = lcm(*a) % mod
ans = 0
for i in range(n):
    ans = (ans + num_lcm * a_[i] % mod) % mod

print(ans)
#TLEする
#こんなことしなくても最小と最大を更新していけばおｋ
#m-1にしてた
n,m=map(int,input().split())
l,r=map(int,input().split())
l_max,r_min=l,r
for i in range(m):
    l,r=map(int,input().split())
    if l_max<l: l_max=l
    if r_min>r: r_min=r
print(r_min-l_max+1)

### FIXED CODE ###

#不十分だった
n, m = map(int, input().split())
l_max, r_min = 0, 10**5 + 1
for i in range(m):
    l, r = map(int, input().split())
    l_max = max(l_max, l)
    r_min = min(r_min, r)

print(max(r_min - l_max + 1, 0))