Harryxun/stf_run huggingface dataset:
import sys
import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix

input = sys.stdin.readline

cost = []
row = []
col = []

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

for _ in range(m):
    a, b, c = map(int, input().split())
    cost.append(c)
    row.append(a-1)
    col.append(b-1)

q = int(input())
st = [list(map(int, input().split())) for _ in range(q)]

csr = csr_matrix((cost, (row, col)), shape = (n, n))
path = shortest_path(csr, directed=False)

cost = []
row = []
col = []

for i in range(n):
    for j in range(n):
        if path[i][j] <= l:
            cost.append(1)
            row.append(i)
            col.append(j) 

csr = csr_matrix((cost, (row, col)), shape = (n, n))
path = shortest_path(csr, directed=False)

INF = float('inf')

for s,t in st:
    ans = path[s-1][t-1]
    if ans == INF:
        print(-1)
    else:
        print(int(ans) - 1)






### FIXED CODE ###

import sys
import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix

input = sys.stdin.readline

n, m, l = list(map(int, input().split()))
g_dense = np.zeros((n, n))

for _ in range(m):
    a, b, c = map(int, input().split())
    g_dense[a-1][b-1] = c

q = int(input())
st = [list(map(int, input().split())) for _ in range(q)]

path = shortest_path(g_dense, directed=False)

g_dense = np.zeros((n, n))

for i in range(n):
    for j in range(n):
        if path[i][j] <= l:
            g_dense[i][j] = 1

path = shortest_path(g_dense, directed=False)

INF = float('inf')

for s,t in st:
    ans = path[s-1][t-1]
    if ans == INF:
        print(-1)
    else:
        print(int(ans) - 1)
K = int(input())
S = input()
if len(S)<=K:
  input(S)
else:
  input(S[:K] + "...")

### FIXED CODE ###

K = int(input())
S = input()
if len(S)<=K:
  print(S)
else:
  print(S[:K] + "...")
S = input()
SS = int(S)
for i in range(0, 9):
    for j in range(0, i):
        for k in range(0, j):
            X = int(S[k] + S[j] + S[i])
            if abs(753 - X) < SS:
                SS = abs(753 - X)
print(SS)

### FIXED CODE ###

S = input()
SS = int(S)
for i in range(0, len(S) - 2):
            X = int(S[i: i + 3])
            if abs(753 - X) < SS:
                SS = abs(753 - X)
print(SS)
N,M=(map(int,input().split()))

C=[input().split() for i in range(N)]

k=0
l=0#何番目の店
m=0#その店で買う数
money=0
X=0#持ち数

while M>X:
    Min=int(C[0][0])
    for i in C:#どの店で買うか
        if Min>=int(i[0]):
            Min=int(i[0])
            l=k
        k+=1
    money+=int(C[l][1])*Min
    X+=m
    if X>M:
        money-=int(C[l][1])*Min
        X-=m
        for x in range(int(C[l][1])):#何個かえるか
            m+=1
            if M==X+m:#max
                money+=m*Min
                print(money)
                break


    C.pop(l)#取り出す
    #リセット
    k=0
    l=0
    m=0#その店で買う数


### FIXED CODE ###

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

C=[input().split() for i in range(N)]
B=[]
for i in C:
    B.append(list(map(int,i)))

B.sort()

k=0
l=0#何番目の店
m=0#その店で買う数
money=0
X=0#持ち数
for a,b in B:
    if(M<=0):
        break
    if(b<=M):
        money+=a*b
    else:
        money+=M*a
    M-=b
print(money)
import numpy as np
[n,m]=[int(x) for x in input().split()]
LR_T=np.array([[int(x)-1 for x in input().split()] for _ in range(m)]).T

print(np.min(LR_T[1])-np.max(LR_T[0])+1)


### FIXED CODE ###

import numpy as np
[n,m]=[int(x) for x in input().split()]
LR_T=np.array([[int(x)-1 for x in input().split()] for _ in range(m)]).T

print(max(np.min(LR_T[1])-np.max(LR_T[0])+1,0))
def main():    
  	N, Q = map(int, input().split())
    S = input()

    list = [0] * (N + 1)

    for i in range(N):
        list[i + 1] = list[i] + (1 if S[i:i + 2] == "AC" else 0)

    for i in range(Q):
        a, b = map(int, input().split())
        output = list[b - 1] - list[a - 1]
        print(output)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N, Q = map(int, input().split())
    S = input()

    list = [0] * (N + 1)

    for i in range(N):
        list[i + 1] = list[i] + (1 if S[i:i + 2] == "AC" else 0)

    for i in range(Q):
        a, b = map(int, input().split())
        output = list[b - 1] - list[a - 1]
        print(output)


if __name__ == '__main__':
    main()
n, m = map(int, input().split())
T1 = [[] for i in range(n)]
T2 = [[] for i in range(m)]
for i in range(n):
    a = list(input())
    T1[i] = a
for i in range(m):
    a = list(input())
    T2[i] = a

flag = False
for i in range(n - m):
    for j in range(n - m):
        if T1[i][j: j + m] == T2[0]:
            k = i
            l = 0
            while k < n - m + 1:
                if T1[k][j:j + m] != T2[l]:
                    break
                k += 1
                l += 1
                if k == i + m:
                    flag = True


if flag:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n, m = map(int, input().split())
T1 = [[] for i in range(n)]
T2 = [[] for i in range(m)]
for i in range(n):
    a = list(input())
    T1[i] = a
for i in range(m):
    a = list(input())
    T2[i] = a

flag = False
for i in range(n - m + 1):
    for j in range(n - m + 1):
        l = 0
        if T1[i][j: j + m] == T2[l]:
            k = i
            while k < n - m + 1 and l < m:
                if T1[k][j:j + m] != T2[l]:
                    break
                k += 1
                l += 1
                if l == m:
                    flag = True


if flag:
    print("Yes")
else:
    print("No")
int A=input()
int B=input()

print(A*B)

### FIXED CODE ###

a, b = map(int, input().split())
print(a*b)
A, B = map(int, input().split())

white = '.'
black = '#'
grid = [[black * 100] for i in range(50)] + [[white * 100] for i in range(50)]

for i in range(A-1):
    grid[(i % 50) * 2][0] = grid[(i % 50) * 2][0][:(i % 50) * 2] + white + grid[(i % 50) * 2][0][(i % 50) * 2 + 1:]

for i in range(B-1):
    grid[(i % 50) * 2+49][0] = grid[(i % 50) * 2+49][0][:(i % 50) * 2] + black + grid[(i % 50) * 2+49][0][(i % 50) * 2 + 1:]

print(100, 100)
for g in grid:
    print(g)

### FIXED CODE ###

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

white = '.'
black = '#'
grid = [[black * 100] for i in range(50)] + [[white * 100] for i in range(50)]

for i in range(A-1):
    grid[(i // 50)*2][0] = grid[(i // 50)*2][0][:(i % 50) * 2] + white + grid[(i // 50)*2][0][(i % 50) * 2 + 1:]

for i in range(B-1):
    grid[(i // 50)*2 + 51][0] = grid[(i // 50)*2 + 51][0][:(i % 50) * 2] + black + grid[(i // 50)*2 + 51][0][(i % 50) * 2 + 1:]

print(100, 100)
for g in grid:
    print(g[0])
#!/usr/bin/env python3

n_nodes, q_query = map(int, input().split())

edges = [[] for _ in range(n_nodes)]
for _ in range(n_nodes - 1):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

queries = []
for _ in range(q_query):
    p, x = map(int, input().split())
    queries.append([p - 1, x])

# print(n_nodes, q_query)
# print(edges, queries)


def dfs(v, parents):
    for v_next in edges[v]:
        if parents[v_next] == -1:
            parents[v_next] = v
            dfs(v_next, parents)


parents = [-1 for _ in range(n_nodes)]
parents[0] = 0
dfs(0, parents)
# print(parents)

res = [0 for _ in range(n_nodes)]
for node, point in queries:
    res[node] += point

for node in range(n_nodes):
    if node > 0:
        p = parents[node]
        res[node] += res[p]

print(*res)


### FIXED CODE ###

#!/usr/bin/env python3

import sys

input = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 6)

N, Q = map(int, input().split())

edges = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

query = []
for _ in range(Q):
    p, x = map(int, input().split())
    query.append([p, x])

counter = [0 for _ in range(N)]
for p, x in query:
    counter[p - 1] += x


def dfs(v, parent):
    for v_next in edges[v]:
        if v_next != parent:
            counter[v_next] += counter[v]
            dfs(v_next, v)


root = 0
dfs(root, None)

print(*counter)
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)

res = 0
big = 0
small = 0

for i in range(n-1):
    if a[i:][0] <= a[i] / 2:
        t = a[i:][0]
        comb = 1
        for k in range(t, a[i]+1):
            comb *= k
        for k in range(1, a[i]-t+2):
            comb /= k
        if comb >= res:
            res = comb
            big = a[i]
            small = t
    elif a[-1] >= a[i] / 2:
        t = a[-1]
        comb = 1
        for k in range(t, a[i]+1):
            comb *= k
        for k in range(1, a[i]-t+2):
            comb /= k
        if comb >= res:
            res = comb
            big = a[i]
            small = t
    else:
        left = i+1
        right = n-1
        while True:
            j = (left + right) // 2
            if n == 2:
                t = a[1]
                break
            elif left == right:
                t = a[left]
                break
            elif a[i]/2 >= a[j+1] and a[i]/2 <= a[j]:
                if abs(a[j+1]-a[i]/2) >= abs(a[j]-a[i]/2):
                    t = a[j]
                else:
                    t = a[j+1]
                break
            elif a[i]/2 > a[j]:
                right = j
            else:
                left = j

        comb = 1
        for k in range(t, a[i]+1):
            comb *= k
        for k in range(1, a[i]-t+2):
            comb /= k
        if comb >= res:
            res = comb
            big = a[i]
            small = t

print(big, small)

### FIXED CODE ###

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
a1 = a.pop(0)

if a[0] <= a1 / 2:
    res = a[0]
elif a[-1] >= a1 / 2:
    res = a[-1]
else:
    left = 0
    right = n-2
    while True:
        j = (left + right) // 2
        if left == right:
            res = a[left]
            break
        elif a1/2 >= a[j+1] and a1/2 <= a[j]:
            if abs(a[j+1]-a1/2) >= abs(a[j]-a1/2):
                res = a[j]
            else:
                res = a[j+1]
            break
        elif a1/2 > a[j]:
            right = j
        else:
            left = j

print(a1, res)
import math
a, b, c, d = map(int, input().split())
lcm = (c*d)//math.gcd(c, d)
a -= 1
ans1 = b - b//c - b//d + b//lcm
ans2 = a - a//c - a//d + a//lcm
print(ans1 - ans2)


### FIXED CODE ###

import fractions
a, b, c, d = map(int, input().split())
lcm = (c*d)//fractions.gcd(c, d)
a -= 1
ans1 = b - b//c - b//d + b//lcm
ans2 = a - a//c - a//d + a//lcm
print(ans1 - ans2)
n,m=map(int,input().split())

par=[i for i in range(n)]

visited=[False]*n

def find(x):
  if par[x]==x:
    return par[x]
  else:
    par[x]=find(par[x])
    return par[x]


def find2(x):
  visited[x]=True
  if par[x]==x:
    return par[x]
  else:
    par[x]=find2(par[x])
    return par[x]

def union(x,y):
  fx=find(x)
  fy=find(y)
  if fx!=fy:
    par[fx]=fy

ans=-1

for i in range(m):
  x,y=map(int,input().split())
  union(x-1,y-1)

cnt=0

for i in range(n):
  if visited[i]==False:
    cnt+=1
    find2(i)


ans=min(cnt,len(set(par)))


print(ans)


### FIXED CODE ###

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

par=[i for i in range(n)]
size=[1]*n

def find(x):
  if par[x]==x:
    return x
  else:
    par[x]=find(par[x])
    return par[x]
def union(a,b):
  x=find(a)
  y=find(b)
  if x!=y:
    if size[x]<size[y]:
      par[x]=par[y]
      size[y]+=size[x]
    else: 
      par[y]=par[x]
      size[x]+=size[y]
  else:
    return

for i in range(m):
  x,y,z=map(int,input().split())
  union(x-1,y-1)


ans={find(i) for i in range(n)}

print(len(ans))
s=input()
l=len(s)
k=int(input())
x=set()
for i in range(1,k):
    for j in range(l-i+1):
        x.add(s[j:j+i])
x=sorted(list(x))
print(x[k-1])


### FIXED CODE ###

s=input()
l=len(s)
k=int(input())
x=set()
for i in range(1,min(l,k)+1):
    for j in range(l-i+1):
        x.add(s[j:j+i])
x=sorted(list(x))
print(x[k-1])
N = int(input())
A = int(input())
if N%500 =< A:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = int(input())
A = int(input())
if N%500 <= A:
  print("Yes")
else:
  print("No")
from collections import deque
s = deque(input())
q = int(input())
a = 0
c = ""
for i in range(q):
    b = list(input().split())
    if b[0] == "1":
        if a == 0:
            a = 1
        else:
            a = 0
    else:
        if (a, b[1]) == (0, "1") or (a, b[1]) == (1, "2"):
            s.appendleft(0, b[2])
        else:
            s.append(b[2])
if a == 0:
    for i in range(len(s)):
        c += s[i]
else:
    for i in range(len(s)):
        c += s[-i-1]
print(c)

### FIXED CODE ###

from collections import deque
s = deque(input())
q = int(input())
a = 0
c = ""
for i in range(q):
    b = list(input().split())
    if b[0] == "1":
        if a == 0:
            a = 1
        else:
            a = 0
    else:
        if (a, b[1]) == (0, "1") or (a, b[1]) == (1, "2"):
            s.appendleft(b[2])
        else:
            s.append(b[2])
if a == 0:
    for i in range(len(s)):
        c += s.popleft()
else:
    for i in range(len(s)):
        c += s.pop()
print(c)
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy
 


def main():
  	s = input()
   	if s[-1] == "s":
        print(s + "es")
   	else:
        print(s + "s")

if __name__ == "__main__":
    main()

### FIXED CODE ###

import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy
 


def main():
    s = input()
    if s[-1] == "s":
        print(s + "es")
    else:
        print(s + "s")

if __name__ == "__main__":
    main()
dat =list(input().split())

for i in dat:
	i = int(i)

dat.sort()
dat.reverse()

asum = 0
bsum = 0
sum=0

for i in range(len(dat)):
     asum =  asum + dat[i]
		
print(sum)

### FIXED CODE ###

n = int(input())
dat = list(input().split())

dat = list(map(int,dat))

dat.sort(reverse=True)

asum = 0
bsum = 0

for i in range(n):
	if i % 2 == 0:
		asum = asum + dat[i]
	else:
		bsum = bsum + dat[i]
		
print(asum-bsum)
import statistics
import math

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

B = []
C = []
D = []
E = []

chikai = math.floor(sum(A) / 4)
s = 0
for i in range(len(A)):
    s += A[i]
    if s + A[i + 1] > chikai:
        if (A[i + 1] ) / 2 >= chikai - s:
            B = [A[j] for j in range(i + 1)]
            del A[0:i+1]
        else:
            B = [A[j] for j in range(i + 2)]
            del A[0:i+2]
        break

chikai = math.floor(sum(A) / 3)
s = 0
for i in range(len(A)):
    s += A[i]
    if s + A[i + 1] > chikai:
        if (A[i + 1] ) / 2 >= chikai - s:
            C = [A[j] for j in range(i + 1)]
            del A[0:i+1]
        else:
            C = [A[j] for j in range(i + 2)]
            del A[0:i+2]
        break

chikai = math.floor(sum(A) / 2)
s = 0
for i in range(len(A)):
    s += A[i]
    if s + A[i + 1] > chikai:
        if (A[i + 1] ) / 2 >= chikai - s:
            D = [A[j] for j in range(i + 1)]
            del A[0:i+1]
        else:
            D = [A[j] for j in range(i + 2)]
            del A[0:i+2]
        break

E = A[:]


print((max(sum(B),sum(C),sum(D),sum(E))-min(sum(B),sum(C),sum(D),sum(E))))

### FIXED CODE ###

import statistics
import math

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


ureshimi = []
k = 0
l = 2

B = 0
C = 0
D = 0
E = 0

sumBC = sum(A[0:2])
sumDE = sum(A) - sumBC

for i in range(2, N - 1):
    for j in range(k, i):
        if j == i - 1:
            k = j
            C = sumBC - B
            break
        elif B + A[j] >= sumBC / 2:
            if sumBC / 2 - B  > A[j] / 2:
                B += A[j]
                k = j + 1
                C = sumBC - B
                break
            else:
                k = j
                C = sumBC - B
                break
        B += A[j]
    for j in range(l, N):
        if j == N - 1:
            l = j
            E = sumDE - D
            break
        elif D + A[j] >= sumDE / 2:
            if sumDE / 2 - D > A[j] / 2:
                D += A[j]
                l = j + 1
                E = sumDE - D
                break
            else:
                l = j
                E = sumDE - D
                break
        D += A[j]
    ureshimi.append(max([B, C, D, E]) - min([B, C, D, E]))
    sumBC += A[i]
    sumDE -= A[i]
    D -= A[i]
        

print(min(ureshimi))
n = int(input())
s = str(inout())

ans = 0

for i in range(n-2):
    if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
        ans += 1
    else:
        continue
      
print(ans)


### FIXED CODE ###

n = int(input())
s = str(input())
 
ans = 0
 
for i in range(n-2):
    if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
        ans += 1
    else:
        continue
      
print(ans)
inputdata = list(map(input().split()))
# data = list(map(int, "41 2 5 6".split()))

N = data[0] # days of summer vacation
M = data[1] # summer assignments

A = 0 # days to do the i-th assignment.

for i in range(2, M+2) :
    # print(data[i])
    A += data[i]

if A <= N :
    print(N-A)
else :
    print(-1)

### FIXED CODE ###

data = list(map(int, input().split()))
# data = list(map(int, "41 2".split()))

N = data[0] # days of summer vacation
M = data[1] # summer assignments

A = 0 # days to do the i-th assignment.

assignments = list(map(int, input().split()))
# assignments = list(map(int, "5 6".split()))

if sum(assignments) <= N :
    print(N-sum(assignments))
else :
    print(-1)
n,h=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
a=set()
for i in range(n):
  a.add(l[i][0])
maxA=max(a)
b=set()
for i in range(n):
  b.add(l[i][1])
b=sorted(b)
b.reverse()
damage=0
count=0
f=0
for i in range(n):
  if damage>=h:
    f=1
    break
  else:
    if b[i]>maxA:
      damage+=b[i]
      count+=1
    else:
      break
if f==1:
  print(count)
else:
  count+=((h-damage-1)//maxA)+1
  print(count)

### FIXED CODE ###

n,h=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
a=set()
for i in range(n):
  a.add(l[i][0])
maxA=max(a)
b=[]
for i in range(n):
  if l[i][1]>maxA:
    b.append(l[i][1])
b.sort()
b.reverse()
damage=0
count=0
f=0
for i in range(len(b)):
  if damage>=h:
    f=1
    break
  else:
    if b[i]>maxA:
      damage+=b[i]
      count+=1
    else:
      break
if f==1:
  print(count)
else:
  count+=((h-damage-1)//maxA)+1
  print(count)
X=int(input())
Y=[]
for i in range(1,X):
    for j in range(2,X):
        if i**j>X:
            break;
        Y.append(i**j)

print(max(Y))

### FIXED CODE ###

x = int(input())
 
m = 1
 
for i in range(1, 32):
    for j in range(2, 10):
        p = pow(i, j)
        if p > x:
            break
        if p > m:
            m = p
 
print(m)
import sys
sys.setrecursionlimit(10 ** 7)

H, W = map(int, input().split())
A = []
for _ in range(H):
    A.append(input())


from collections import deque
todo = deque()
seen = [[False] * W for _ in range(H)]
route= [[0] * W for _ in range(H)]
for y in range(H):
    for x in range(W):
        if A[y][x] == '#':
            todo.append((x, y))
            seen[y][x] = True



dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
cnt = 0
while todo:
    for _ in range(len(todo)):
        x, y = todo.popleft()
        #print(x, y)
        for i in range(4):
            if 0 <= x + dx[i] < W and 0 <= y + dy[i] < H:
                if seen[y + dy[i]][x + dx[i]] == False:
                    route[y + dy[i]][x + dx[i]] = route[y][x] + 1
                    seen[y + dy[i]][x + dx[i]] = True
                    todo.append((x + dx[i], y + dy[i]))
    # cnt += 1

#print(seen)
# print(route)
M = 0
for y in range(W):
    for x in range(H):
        M = max(M, route[y][x])
print(M)

### FIXED CODE ###

from collections import deque

h,w = map(int,input().split())
matrix = [["a" for _ in range(w+2)]] + [list("a" + input() + "a") for _ in range(h)] + [["a" for _ in range(w+2)]]

matrix_list1 = deque()
cnt = 0

#黒いタイルの位置情報を確認
for i in range(1,h+1):
    for j in range(1,w+1):
        if matrix[i][j] == "#":
            matrix_list1.append([i,j])

#白いタイルが無くなるまで、黒いタイルを増やす
while len(matrix_list1) != 0:     
    for _ in range(len(matrix_list1)):
        x,y = matrix_list1.popleft()
        if matrix[x+1][y] == ".":
            matrix[x+1][y] = "#"
            matrix_list1.append([x+1,y])
        if matrix[x-1][y] == ".":
            matrix[x-1][y] = "#"
            matrix_list1.append([x-1,y])
        if matrix[x][y+1] == ".":
            matrix[x][y+1] = "#"
            matrix_list1.append([x,y+1])
        if matrix[x][y-1] == ".":
            matrix[x][y-1] = "#"
            matrix_list1.append([x,y-1])
    else:
        if len(matrix_list1) > 0:
            cnt += 1
    
print(cnt)
package main

import "fmt"

func main() {
	var n int
	var ans int = 1
	fmt.Scan(&n)
	t := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&t[i])
	}

	for i := 0; i < n; i++ {
		ans = ans * t[i]
	}

	if ans > 1000000000000000000 {
		ans = -1
	}
	fmt.Println(ans)
}


### FIXED CODE ###

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

ans = 1

if 0 in A:
    print(0)
    exit()

for i in range(N):
    ans *= A[i]

    if ans > 10**18:
        ans = -1
        break

print(ans)
a = int(input())
b = int(input())
c = int(input())
d = int(input())

num_listx = []
num_listy = []

for num in range(b):
  if num >= a:
    num_listx.append(num)
for nums in range(d):
  if nums >= c:
    num_listy.append(nums)
    
print(max(num_listx) * max(num_listy))


### FIXED CODE ###

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

ans = max(a*c,a*d,b*c,b*d)

print(ans)
a=list(map(int, input().split()))
b=2＊a[3]＊a[2]
c=a[2]＊a[4]＊2+a[0]＊(a[3]-a[4])
d=2＊a[4]＊a[2]
e=a[2]＊a[3]＊2+a[1]＊(a[4]-a[3])
f=a[0]＊a[3]+a[1]＊a[4]
if a[3]>=a[4]:print(min(b,c,f))
else:print(min(d,e,f))


### FIXED CODE ###

a, b, c, x, y = map(int, input().split())
res = 0
if a+b > c*2:
    mi = min(x, y)
    res += c*2 * mi
    x -= mi
    y -= mi
res += x * min(a, c*2)
res += y * min(b, c*2)
print(res)
N = int(input())

goods = {}
for i in range(N):
  name = input().rstrip()
  if name in goods.keys():
    goods[name] += 1
  else:
    goods[name] = 1
print(len(goods.keys()))

### FIXED CODE ###

a, b, c, d = map(int, input().split())
while(a > 0 and c > 0):
  c -= b
  if c <= 0:
    break
  a -= d
  if a <= 0:
    break
if a > c:
  print('Yes')
else:
  print('No')
def main():
    a,b = input().split()
    a = int(a)
    b_n = b[0]
    b_ = b[2:]
    ans = a*int(b_n)+int(str(a*int(b_))[:-2])
    print(int(ans))

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    a,b = input().split()
    b = b[0] + b[2:]
    print(int(a)*int(b)//100)

if __name__ == "__main__":
    main()
import collections

N = int(input())
a = []

for i in range(N):
    a.append(str(input()))
a = collections.Counter(a)
b = max(a.values())

max_k_list = [kv[0] for kv in a.items() if kv[1] == b]
max_k_list = sorted(max_k_list)

for i in max_k_list:
print(i)   

### FIXED CODE ###

import collections

n = int(input())
s = []
for i in range(n):
    s.append(input())

c = collections.Counter(s)
c_s = c.most_common()
m = c.most_common()[0][1]
ans = []
for j in range(len(c_s)):
    if c_s[j][1] != m:
        break
    else:
        ans.append(c_s[j][0])
ans.sort()
for t in ans:
    print(t)
x = int(input())
    if x == 0:
        print(1)
    else:
        print(0)

### FIXED CODE ###

x = int(input())
if x == 0:
    print(1)
else:
    print(0)
S = input()
T = input()
S = [i for i in S]
T = [i for i in T]

for i in range(3):
  if S[i]==T[i]:
    cnt+=1

print(cnt)

### FIXED CODE ###

S = input()
T = input()
S = [i for i in S]
T = [i for i in T]
cnt=0

for i in range(3):
  if S[i]==T[i]:
    cnt+=1

print(cnt)
A, B = map(int, input().split())

if (A-1) % (B-1) ==0:
	print(int((B-1)/(A-1)))
else:
	print(int((B-1)/(A-1))+1)

### FIXED CODE ###

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

if B == 1:
	print(0)
	sys.exit()

if (B-1) % (A-1) ==0:
	print(int((B-1)/(A-1)))
else:
	print(int((B-1)/(A-1))+1)