Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline().strip()
from math import gcd

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

MOD = 1000000007  # type: int

def solve(N: int, A: "List[int]"):
    x = 1
    for ai in A:
        x = lcm(x, ai)
    ans = 0
    for ai in A:
        ans += x // ai
        ans %= MOD
    print(ans)

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline().strip()

MOD = 1000000007  # type: int

def modinv(x):
    return pow(x, MOD - 2, MOD)

def solve(N: int, A: "List[int]"):
    factors = [0 for i in range(10**6 + 1)]
    for x in A:
        i = 2
        while i * i <= x:
            curr = 0
            while x % i == 0:
                curr += 1
                x //= i
            factors[i] = max(factors[i], curr)
            i += 1
        if x > 1:
            factors[x] = max(factors[x], 1)
    lcm = 1
    for i in range(10**6 + 1):
        lcm *= pow(i, factors[i], MOD)
        lcm %= MOD
    ans = 0
    for ai in A:
        ans += lcm * modinv(ai) % MOD
        ans %= MOD
    print(ans)

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()
import random
import copy
n = input()
ori = map(int, raw_input().split())
num = copy.deepcopy(ori)
while not sorted(num) == num:
    l = list()
    for i in xrange(n*2):
        if sorted(num) == num:
            break
        a = random.randint(0, n-1)
        b = random.randint(0, n-1)
        num[b] += num[a]
        l.append("%d %d" % ((a+1), (b+1)))
    else:
        num = copy.deepcopy(ori)

print len(l)
for i in l:
    print i
print num


### FIXED CODE ###

n = input()
num = map(int, raw_input().split())
ma = max(num)
mi = min(num)
l = list()
if ma*mi < 0:
    if ma > abs(mi):
        index = num.index(ma)
    else:
        index = num.index(mi)
    for i in xrange(n):
        l.append("%d %d" % (index+1, i+1))
    b = num[index]
else:
    b = 0
    for i in num:
        if i:
            b = i
            break

if b == 0:
    pass
elif b < 0:
    for i in xrange(n-1, 0, -1):
        l.append("%d %d" % (i+1, i))
else:
    for i in xrange(0, n-1):
        l.append("%d %d" % (i+1, i+2))

print len(l)
for i in l:
    print i
n = int(input())
    print(n**3)

### FIXED CODE ###

n = int(input())
print(n**3)
s = input().split()
a=int(s[0])
s = input().split()
b = int(s[0])
print(6-a-b)s = input().split()
a=int(s[0])
s = input().split()
b = int(s[0])
print(6-a-b)

### FIXED CODE ###

s = input().split()
a=int(s[0])
s = input().split()
b = int(s[0])
print(6-a-b)
while 1:
	n = input()
	if n == 0: break
	xy = [map(int,raw_input().split()) for i in range(n)]
	S = set(map(tuple,xy))
	ans = 0
	for i in range(n):
		x1,y1 = xy[i]
		for j in range(n-1,i,-1):
			x2,y2 = xy[j]
			a = (x2-y2+y1,y2+x2-x1)
			b = (x1-y2+y1,y1+x2-x1)
			if a in S and b in S:
				ans = max((x1-x2)**2 + (y1-y2)**2)
	print ans

### FIXED CODE ###

while 1:
	n = input()
	if n == 0: break
	xy = [map(int,raw_input().split()) for i in range(n)]
	S = set(map(tuple,xy))
	ans = 0
	for i in range(n-1):
		x1,y1 = xy[i]
		for j in range(i+1,n):
			x2,y2 = xy[j]
			a = (x2-y2+y1,y2+x2-x1)
			b = (x1-y2+y1,y1+x2-x1)
			if a in S and b in S:
				ans = max(ans,(x1-x2)**2 + (y1-y2)**2)
	print ans
int(input())
d = dict()
 
for i in range(n):
    s = input()
    if s in d:
        d[s] += 1
    else:
        d[s] = 1
 
M = max(d.values())
 
ans_list = []
for k,v in d.items():
    if v == M:
        ans_list.append(k)
 
ans_list.sort()
for i in ans_list:
    print(i)

### FIXED CODE ###

n = int(input())
d = dict()

for i in range(n):
    s = input()
    if s in d:
        d[s] += 1
    else:
        d[s] = 1

M = max(d.values())

ans_list = []
for k,v in d.items():
    if v == M:
        ans_list.append(k)

ans_list.sort()
for i in ans_list:
    print(i)
N,L = map(int, input().split())
S = sorted(input() for _ in range(L))

print(''.join(S))

### FIXED CODE ###

N,L = map(int, input().split())
S = sorted(input() for _ in range(N))

print(''.join(S))
n=int(input())
for i in range(3):
  n[i] = 10-n[i]
print(n)

### FIXED CODE ###

n=input()
n=n.replace('1','x')
n=n.replace('9','1')
n=n.replace('x','9')
print(n)
class ReversingNumbers:
    def output(self, a):
        s = ""
        a.reverse()
        for i in range(len(a)-1):
            s += "%d " % (a[i])
        s += "%d" % (a.index(len(a)-1))
        print s

if __name__ == "__main__":
    rn = ReversingNumbers()
    raw_input()
    a = map(int, raw_input().split())
    rn.output(a)

### FIXED CODE ###

class ReversingNumbers:
    def output(self, a):
        s = ""
        a.reverse()
        for i in range(len(a)-1):
            s += "%d " % (a[i])
        s += "%d" % (a[len(a)-1])
        print s

if __name__ == "__main__":
    rn = ReversingNumbers()
    raw_input()
    a = map(int, raw_input().split())
    rn.output(a)
H,N = list(map(int,input().split()))

a = [0]*N
b = [0]*N

for i in range(N):
	a[i],b[i] = list(map(int,input().split()))

inf = float("inf")
dp = [inf]*(H+1)
dp[0] = 0
dp[1] = min(b)

for h in range(1,H+1):
	for n in range(N):
		h_temp = h-a[n]
		dp[h] = min(dp[h],dp[h_temp]+b[n])
print(dp[H])

### FIXED CODE ###

H,N = list(map(int,input().split()))

a = [0]*N
b = [0]*N

for i in range(N):
	a[i],b[i] = list(map(int,input().split()))

inf = float("inf")
dp = [inf]*(H+1)
dp[0] = 0
dp[1] = min(b)

for h in range(1,H+1):
	for n in range(N):
		h_temp = h-a[n]
		if h_temp <= 0:
			dp[h] = min(dp[h],b[n])
		else:
			dp[h] = min(dp[h],dp[h_temp]+b[n])
print(dp[H])
import math
a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

### FIXED CODE ###

import math
import fractions

a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print(lcm(a, b))
from collections import deque
from copy import deepcopy

def main():
 
    n, m = map(int, input().split())
    adj = [[] for _ in range(n)]
    for i in range(m):
        a, b = map(lambda x: int(x) - 1, input().split())
        adj[a].append(b)
        adj[b].append(a)
    dist = [-1] * n
    q = deque([0])
    dist[0] = 0
    dl = 0
    while q:
        v = q.popleft()
        d = dist[v]
        for w in adj[v]:
            if dist[w] > -1:
                continue
            dist[w] = d + 1
            q.append(w)
    dl = sum([1 for i in dist if i >= 0])
    def search_index(l, x, default=False):
        return l.index(x) if x in l else default

    dist_0 = deepcopy(dist)
    next = 1
    while next:
        next = search_index(dist_0, -1)
        if next == False:
            print(dl)
            exit()
        q = deque([next])
        dist = [-1] * n
        dist[next] = 0
        while q:
            v = q.popleft()
            d = dist[v]
            for w in adj[v]:
                if dist[w] > -1:
                    continue
                dist[w] = d + 1
                q.append(w)
                sum_d = sum([1 for i in dist if i >= 0])
        if dl < sum_d:
            dl = sum_d
        dist_0[next] = 0
    print(dl)
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
 
    def find(target):
        if parent[target] < 0:
            return target
        else:
            parent[target] = find(parent[target])
            return parent[target]
 
    def is_same(x, y):
        return find(x) == find(y)
 
    def union(x, y):
        root_x = find(x)
        root_y = find(y)
        if root_x == root_y:
            return
        if parent[root_x] > parent[root_y]:
            root_x, root_y = root_y, root_x
        parent[root_x] += parent[root_y]
        parent[root_y] = root_x

    def members(n, x):
        root = find(x)
        return [i for i in range(n) if find(i) == root]
 
    def get_size(x):
        return -parent[find(x)]
 
    def get_root():
        return [i for i, root in enumerate(parent) if root < 0]

    n, m = map(int, input().split())
    parent = [-1 for _ in range(n)]
    for _ in range(m):
        a, b = map(lambda x: int(x) - 1, input().split())
        union(a, b)
        # print(parent)
    ans = 0
    for i in range(n):
        ans = max(ans, get_size(i))
    print(ans)
    # 状況理解用
    # max_member = 0
    # for i in get_root():
    #     # print(i, members(n, i))
    #     max_member  = max(max_member, len(members(n, i)))
    # print(max_member)

if __name__ == '__main__':
    main()
n=int(input())
sum=0

for i in range(n):
    value,unit=map(int, input().split())
    if unit == 'BTC':
        sum += value * 380000
    else:
        sum+=value
print(sum)

### FIXED CODE ###

n=int(input())
sum=0

for i in range(n):
    value,unit=map(str, input().split())
    if unit == 'BTC':
        sum += float(value) * 380000
    else:
        sum+=float(value)
print(sum)
N=int(input())
ls_S=list(input())
i=0
I=0
cnt_1=0
cnt_2=0


while ls_S[i]==".":
    i+=1
    I+=1

for x in range(I,N):
    if ls_S[x]==".":
        ls_S[x]="#"
        cnt_1+=1
for x in range(I,N):
    if ls_S[x]=="#":
        ls_S[x]="."
        cnt_2+=1
if cnt_1>cnt_2:
    print(cnt_2)
else:
    print(cnt_1)
        





### FIXED CODE ###

A,B,C=map(int,input().split())

if A<B:
    if A<C<B:
        print("Yes")
    else:
        print("No")
else:
    if B<C<A:
        print("Yes")
    else:
        print("No")
import os, sys, re, math, queue

N = int(input())
colors = [-1 for _ in range(N+1)]
nodes = {}

for _ in range(N-1):
	u,v,w = list(map(int,input().split(' ')))
	if u in nodes:
		nodes[u].append((v,w % 2))
	else:
		nodes[u] = [(v,w % 2)]

	if v in nodes:		
		nodes[v].append((u,w % 2))
	else:
		nodes[v] = [(u,w % 2)]

q = queue.Queue()
fst = list(nodes.keys())[0]
q.put((fst,0))

while not q.empty():
	pos, color = q.get()
	colors[pos] = color
	for cand in nodes[pos]:
		if colors[cand[0]] == -1:
			q.put((cand[0], (color+cand[1]) % 2)

for i in range(N):
	print(colors[i+1])
		


### FIXED CODE ###

import os, sys, re, math, queue

N = int(input())

nodes = {}
colors = [-1 for _ in range(N+1)]
for _ in range(N-1):
    s = input().split(' ')
    u,v,w = int(s[0]), int(s[1]), int(s[2])
    if u not in nodes:
        nodes[u] = [(v,w)]
    else:
        nodes[u].append((v,w))

    if v not in nodes:
        nodes[v] = [(u,w)]
    else:
        nodes[v].append((u,w))

q = queue.Queue()
f = list(nodes.keys())[0]
q.put((f,0))

while not q.empty():
    cur = q.get()
    colors[cur[0]] = cur[1]
    next = nodes[cur[0]]
    for n in next:
        if colors[n[0]] == -1:
            if n[1] % 2 == 0:
                q.put((n[0], cur[1]))
            else:
                q.put((n[0], (cur[1]+1) % 2))

for i in range(N):
    print(colors[i+1])
N,A,B,C,D=map(int,input().split())
if A> B:
  A,B=B,A
if C>D:
  C,B=B,C
if B-A>D*(N-1):
  print("NO")
elif B-A>=C*(N-1):
  print("YES")
else:
  flag=False
  diff=B-A
  d=0
  for i in range(2,N,2):
    d+=D-C
    j= N-1 - i
    if j==0:
      if diff==d:
        flag=True
      break
    k=(diff - d) / j
    if k>=C and k<=D:
      flag=True
    
if flag:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

N, A, B, C, D = map(int, input().split())
if A > B:
    A, B = B, A

flag = False
diff = B-A
d = 0
for i in range(0, N, 2):
    if i > 0:
        d += D-C
    j = N-1 - i
    if diff == d and j % 2 == 0:
        flag == True
        break
    if j == 0:
        break

    k = abs(diff - d) / j
    if (k >= C and k <= D) or (abs(diff-d) >= C and abs(diff-d) <= D and j % 2 == 1):
        flag = True
        break
    k = abs(diff + d) / j
    if (k >= C and k <= D) or (diff+d >= C and diff+d <= D and j % 2 == 1):
        flag = True
        break

if flag:
    print("YES")
else:
    print("NO")
x, y = map(int, input().split())

answer = "No"

for i in range(x + 1):
  b = x - i
  if a * 2 + b * 4 == y:
    answer = "Yes"

print(answer)


### FIXED CODE ###

animals_num, legs_num = map(int, input().split())

answer = "No"

for i in range(animals_num + 1):
  j = animals_num - i
  if j * 4 + i * 2 == legs_num:
    answer = "Yes"
print(answer)
N, K = map(int, input().split())
S = str()
if(S[K] = 'A'):
  S[K] = 'a'
elif(S[K] = 'B'):
  S[K-1] = 'b'
elif(S[K] = 'C'):
  S[K] = 'c'

### FIXED CODE ###

N, K = map(int, input().split())
S = list(input())

           
if(S[K-1] == "A"):
  S[K-1] = "a"
elif(S[K-1] == "B"):
  S[K-1] = "b"
elif(S[K-1] == "C"):
  S[K-1] = "c"
           
"".join(S)

S_1 = S[0]
for i in range(1,N):
  S_1 = S_1 + S[i]
print(S_1)
K = int(input())
S = input()

if len(S) <=K:
  print(S)
else:a
  print(S[:K] + "...")

### FIXED CODE ###

N = int(input()) % 10

hon = {2, 4, 5, 7, 9}
pon = {0, 1, 6, 8}
bon = {3}

if N in hon:
  print("hon")
if N in pon:
  print("pon")
if N in bon:
  print("bon")
N=int(input())
a = [int(i) for i in input().split()] 
print(max(a)-min(a))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
print(max(a)-min(a))
from scipy.sparse.csgraph import floyd_warshall

# ダイクストラではなくワーシャルフロイドで解く
N, M, L = map(int, input().split())
# graph = [[] for _ in range(N)]
distant = [[float('inf')]*N for _ in range(N)]
for _ in range(M):
    a, b, c = map(int, input().split())
    a, b = a-1, b-1
    if c > L:
        continue
    distant[a][b] = c
    distant[b][a] = c

distant = floyd_warshall(distant)
another = [[float('inf')]*N for _ in range(N)]
for i in range(N):
    for j in range(N):
        if distant[i][j] <= L:  # 行けるところまでいくという印象
            another[i][j] = 1
another = floyd_warshall(another)
Q = int(input())
for _ in range(Q):
    s, t = map(lambda x: int(x)-1, input().split())
    if another[i][j] == float("inf"):
        print(-1)
        continue
    print(int(another[s][t])-1)
    # if distant[s][t] == float('inf'):
    #     print(-1)
    #     continue
    # print(int(distant[s][t])//L + min(1, int(distant[s][t]) % L) - 1)
# 燃料が4で
# 1 -> 4 -> 2
# のとき、距離は7だから一見すると補給回数は1で良さそうだけど、実は2回必要
# 今、２点間の最小距離を求めておいて、もう一つのグラフは「最短距離がL以下の2点に辺(重み1)を張る」


### FIXED CODE ###

from scipy.sparse.csgraph import floyd_warshall

# ダイクストラではなくワーシャルフロイドで解く
N, M, L = map(int, input().split())
# graph = [[] for _ in range(N)]
distant = [[float('inf')]*N for _ in range(N)]
for _ in range(M):
    a, b, c = map(int, input().split())
    a, b = a-1, b-1
    if c > L:
        continue
    distant[a][b] = c
    distant[b][a] = c

distant = floyd_warshall(distant)
another = [[float('inf')]*N for _ in range(N)]
for i in range(N):
    for j in range(N):
        if distant[i][j] <= L:  # 行けるところまでいくという印象
            another[i][j] = 1
another = floyd_warshall(another)
Q = int(input())
for _ in range(Q):
    s, t = map(lambda x: int(x)-1, input().split())
    if another[s][t] == float('inf'):
        print(-1)
        continue
    print(int(another[s][t])-1)
    # if distant[s][t] == float('inf'):
    #     print(-1)
    #     continue
    # print(int(distant[s][t])//L + min(1, int(distant[s][t]) % L) - 1)
# 燃料が4で
# 1 -> 4 -> 2
# のとき、距離は7だから一見すると補給回数は1で良さそうだけど、実は2回必要
# 今、２点間の最小距離を求めておいて、もう一つのグラフは「最短距離がL以下の2点に辺(重み1)を張る」
import math
N=int(input())
print(int(math.factorial(N)%(7+1e9)))

### FIXED CODE ###

import math
N=int(input())
print(math.factorial(N)%(7+10**9))
a,b,c = map(int,input().split())
print(min(a,b,c)*(sum([a,b,c]-min(a,b,c)-max(a,b,c)))//2)

### FIXED CODE ###

a,b,c = map(int,input().split())
print(min(a,b,c)*(sum([a,b,c])-min(a,b,c)-max(a,b,c))//2)
from bisect import *

N,M,K,*f = map(int, open(0).read().split())
A = f[:N]
B = f[N:]
a_read = 0
b_read = 0
passed = 0
csa = [0]
for i in range(N):
    csa.append(csa[i]+A[i])
csb = [0]
for i in range(M):
    csb.append(csb[i]+B[i])
for i in range(N+M):
    if a_read == N:
        bs = bisect_right(csb,K-csa[N])
        b_read = bs - 1
        break
    elif b_read == M:
        bs = bisect_right(csa,K-csb[M])
        b_read = bs - 1
        break
    else:
        if A[a_read] < B[b_read]:
            bs = bisect_right(csa,min(csa[a_read]+B[b_read],K-csb[b_read]))
            if bs <= a_read:
                break
            else:
                a_read = bs - 1
        elif A[a_read] > B[b_read]:
            bs = bisect_right(csb,min(csb[b_read]+A[a_read],K-csa[a_read]))
            if bs <= b_read:
                break
            else:
                b_read = bs - 1
        else:
            if K - csa[a_read] - csb[b_read] >= A[a_read]:
                for j in range(1,N+M):
                    if A[a_read+j] < B[a_read+j]:
                        if K - csa[a_read+j-1] - csb[b_read] >= A[a_read+j]:
                            a_read += j
                            break
                        else:
                            a_read += j - 1
                            break
                    elif A[a_read+j] > B[a_read+j]:
                        if K - csa[a_read] - csb[b_read+j-1] >= B[a_read+j]:
                            b_read += j
                            break
                        else:
                            b_read += j - 1
                            break
            else:
                break
print(a_read+b_read)

### FIXED CODE ###

from bisect import *

N,M,K,*f = map(int, open(0).read().split())
A = f[:N]
B = f[N:]
csa = [0]
ans = 0
for i in range(N):
    csa.append(csa[i]+A[i])
csb = [0]
for i in range(M):
    csb.append(csb[i]+B[i])
for i in range(N+1):
    if csa[i] <= K:
        bs = bisect_right(csb,K-csa[i])
        ans = max(ans,i+bs-1)
    else:
        break
print(ans)
s = input()

if s == 'a' or s == 'i' or s == 'u' or s == 'e' or s == 'o':
  ans = 'vowel'
else:
  ans = 'consonant"

print(ans)

### FIXED CODE ###

s = input()

if s == 'a' or s == 'i' or s == 'u' or s == 'e' or s == 'o':
  ans = 'vowel'
else:
  ans = 'consonant'

print(ans)
A, B, C = map(int, input().split())
K= int(input()) 
 
 
for i in range(K):
  B=B*2
  if (B>A)&(C>B):
    print("Yes")
  else :
    print("No")

### FIXED CODE ###

s = int(input()) 
 
if 400 <= s <= 599:
  print("8")
elif  600 <= s <=799:
        print("7")
elif  800 <= s <=999:
        print("6")
elif  1000 <= s <=1199:
        print("5")
elif  1200 <= s <=1399:
        print("4")
elif  1400 <= s <=1599:
        print("3")
elif  1600 <= s <=1799:
        print("2")
elif  1800 <= s <=1999:
        print("1")
from numpy import cumsum
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a=cumsum(a)
b=cumsum(b)

for i in range(n):
    if a[i]>k:
        read=i
        break
if a[n-1]<k:
    read=n
time=a[read-1]
ans=read
start=read-1
if read==n:
    for i in range(m):
        if time+b[i]>k:
            read+=i
            ans=max(ans,read)
            read-=i
        if i==m-1:
            print(n+m)
            exit()
            
for i in range(start+1):
    read-=1
    time-=a[start-i]
    for j in range(m):
        if time+b[j]>k:
            read+=j
            ans=max(ans,read)
            read-=j
            break
        if j==m-1:
            read+=m
            print(max(ans,read))
            exit()
print(ans)

### FIXED CODE ###

from bisect import bisect
from numpy import cumsum
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a=cumsum(a)
b=cumsum(b)

read=bisect(a,k)
time=a[read-1]
ans=read

for i in range(read):
    extra=k-time
    r=bisect(b,extra)
    ans=max(ans,read+r)
    read-=1
    time=a[read-1]
read=bisect(b,k)
ans=max(ans,read)
print(ans)
n,k,s = map(int,input().split())
x = [0]*n
for i in range(k):
    x[i] = s
else:
    x[i+1] = 1 if s != 1 else 2

for i in range(n-1):
    print(x[i],end=" ")
else:
    print(x[i+1])


### FIXED CODE ###

n,k,s = map(int,input().split())
x = [0]*n
for i in range(n):
    if i < k:
        x[i] = s
    else:
        if s != 10**9:
            x[i] = s+1
        else:
            x[i] = 1

for i in range(n-1):
    print(x[i],end=" ")
else:
    print(x[n-1])
x=raw_input()

print x ** 3

### FIXED CODE ###

x=eval(input())
print(x**3)
import math
# from functools import reduce
# def gcd_list(numbers):
#     return reduce(math.gcd, numbers)

n=int(input())

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

left=[a[0]]
right=[a[n-1]]
for i in range(n-2):
    left.append(math.gcd(left[i],a[i+1]))
    right.append(math.gcd(right[i],a[n-2-i]))

# print(left)
# print(right)
last=[right[n-2],left[n-2]]

for i in range(n-2):
    last.append(math.gcd(left[i],right[n-3-i]))

print(max(last))

### FIXED CODE ###

from fractions import gcd
# from functools import reduce
# def gcd_list(numbers):
#     return reduce(math.gcd, numbers)

n=int(input())

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

left=[0]*(n+1)
right=[0]*(n+1)

for i in range(n):
    left[i+1]=gcd(left[i],a[i])
    right[n-i-1]=gcd(right[n-i],a[n-i-1])

# print(left)
# print(right)
last=[0]*n

for i in range(n):
    last[i]=(gcd(left[i],right[i+1]))


print(max(last))
N,K=(int(x) for x in input().split())
S=list(int(i) for i in input())
S[K-1] = S[K-1].lower()
print(','.join(S))

### FIXED CODE ###

N,K=(int(x) for x in input().split())
S=list(input())
S[K-1] = S[K-1].lower()
print(''.join(S))
import heapq

h,w = map(int,input().split())
sh,sw = map(int,input().split())
gh,gw = map(int,input().split())
s = [input() for _ in range(h)]

sh-=1; sw-=1; gh-=1; gw-=1;

INF = 10**7
dist = [[INF]*w for _ in range(h)]
dist[sh][sw] = 0
q = [(0,sh,sw)]

while q:
    
    d,vsh,vsw = heapq.heappop(q)
    
    for dh in range(-2,3):
        for dw in range(-2,3):
            newh = vsh+dh
            neww = vsw+dw
            if newh<0 or h<=newh or neww<0 or w<=neww: continue
            if dh == 0 and dw==0: continue
            if s[newh][neww] == "#": continue
                
            if abs(dh)+abs(dw)==1:
                if dist[newh][neww] > d:
                    dist[newh][neww] = d
                    if newh == gh and neww = gw: break
                    heapq.heappush(q,(d,newh,neww))
            else:
                if dist[newh][neww] > d+1:
                    dist[newh][neww] = d+1
                    heapq.heappush(q,(d+1,newh,neww))
                    
if dist[gh][gw] == INF: print(-1)
else: print(dist[gh][gw])

### FIXED CODE ###

from collections import deque

h,w = map(int,input().split())
sh,sw = map(int,input().split())
gh,gw = map(int,input().split())
s = [input() for _ in range(h)]

sh-=1; sw-=1; gh-=1; gw-=1;

dist = [[-1]*w for _ in range(h)]
dist[sh][sw] = 0
q = deque([(0,sh,sw)])
warpq = deque([])

while q or warpq:
    while q:

        d,vsh,vsw = q.popleft()

        flag = 0
        
        for dh,dw in [(-1,0),(1,0),(0,-1),(0,1)]:
            newh = vsh+dh
            neww = vsw+dw
            if newh<0 or h<=newh or neww<0 or w<=neww: continue
            if s[newh][neww] == "#":
                if flag ==0:
                    warpq.append((d,vsh,vsw))
                    flag = 1
                continue

            if dist[newh][neww] == -1:
                dist[newh][neww] = d
                q.append((d,newh,neww))

    while warpq:

        d,vsh,vsw = warpq.popleft()
        for dh in range(-2,3):
            for dw in range(-2,3):
                newh = vsh+dh
                neww = vsw+dw
                if newh<0 or h<=newh or neww<0 or w<=neww: continue
                if abs(dh)+abs(dw)<=0: continue
                if s[newh][neww] == "#": continue

                if dist[newh][neww] == -1:
                    dist[newh][neww] = d+1
                    q.append((d+1,newh,neww))
            
print(dist[gh][gw])
lis=[]
for i in range(5):
    x=int(input())
    lis.append([x%10,x])
lis.sort()
t=0
for i in range(4):
    t+=lis[i,1]+10-lis[i,0]
print(t+lis[4,1])

### FIXED CODE ###

lis=[]
for i in range(5):
    x=int(input())
    if x%10!=0:
        lis.append([x%10,x])
    else:
        lis.append([10,x])
lis1=sorted(lis,reverse=True)
t=0
for i in range(4):
    if lis1[i][0]!=0:
        t+=lis1[i][1]+10-lis1[i][0]
    else:
        t+=lis1[i][1]
print(t+lis1[4][1])