Harryxun/stf_run huggingface dataset:
N, M = map(int, input().split())
A = list(map(int, input().split()))
SA = sorted(A)

D = []
for _ in range(M):
  B, C = map(int, input().split())
  D += B * [C]
SD = sorted(D, reverse=True)
SD = SD[:min(N, len(SD))]

for i in range(N):
  if SD[i] > SA[i]:
    SA[i] = SD[i]
print(sum(SA))
  


### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
#SA = sorted(A)

D = []
for _ in range(M):
  B, C = map(int, input().split())
  D.append([B, C])

SD = sorted(D, key=lambda x:x[1], reverse=True)

for b, c in SD:
  A += b * [c]
  if len(A) > N*2:
    break

SA = sorted(A, reverse=True)
#X = min(N, len(SD))
#SD = SD[:X]

print(sum(SA[:N]))
v = str(input()).splitlines()
dif_max = -200000

for i in range(len(v)):
    v[i] = int(v[i])

for i in range(1,v[0],1):
    for j in range(i+1, v[0], 1):
        dif = v[j] - v[i]
        dif_max = dif if dif_max < dif else dif_max
print("{}".format(dif_max))

### FIXED CODE ###

cnt = int(input())
dif_max = -1000000000
v_min = 1000000000

for i in range(cnt):
    buf = int(input())
    if i > 0:
        dif_max = dif_max if buf - v_min < dif_max else buf - v_min
    v_min = buf if buf < v_min else v_min
print(dif_max)
N = int(input() )
for i in range(N):
  C[i] = list(map(int, input().split() ) )
 
C.sort(key= lambda s:(s[1],s[0]) )
 
 
judge = "Yes"
time = 0
for i in range(N):
  time += C[i][0]
  if time > C[i][1]:
    judge = "No"
    break
print(judge)

### FIXED CODE ###

N = int(input() )
C = []
for i in range(N):
  A, B = map(int, input().split() )
  C.append([A, B])
C.sort(key=lambda s:s[1] )
 
judge = "Yes"
time = 0
for i in range(N):
  time += C[i][0]
  if time > C[i][1]:
    judge = "No"
    break
print(judge)
P=[]
C=[]
point=1000 
D,G=map(int,input().split())
for i in range(D):
    p,c= map(int,input().split())
    P.append(p)
    C.append(c)

for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :            
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
        if (~i>>j) & 1 :                
            needproblem=j+1
            
    if score>G :
        point=min(point,solve)
    elif score<=G :                
        needsolve=(G-score)//(needproblem*100)
        if needsolve>P[needproblem-1] :  
            continue
        elif needsolve<=P[needproblem-1] :
            resolve=solve+needsolve
            point=min(point,resolve)
print(point)

### FIXED CODE ###

D,G=map(int,input().split())
# bit全探索で、全問解く問題の組み合わせをすべて試す
 
scores=[None]*D
for i in range(D):
  p,c=map(int,input().split())
  # 一問の得点、問題数、ボーナス、全てといたときの得点
  scores[i]=[(i+1)*100,p,c,((i+1)*100)*p+c]
 
# あとあとのために点数高い順に並べる
scores=sorted(scores,key=lambda x:x[0])[::-1]
 
# 全問とく組み合わせに対して、最小の問題数
ans=D*100
for i in range(2**D):
  total=0
  solve=0
  for j in range(D):
    if (i>>j)&1:
      # 全問とく問題のボーナスを足していく
      total+=scores[j][3]
      solve+=scores[j][1]
  if total>=G:
    if ans>solve:
      ans=solve
    continue
  rest=G-total
  for j in range(D):
    if (i>>j)&1==0:
      point=scores[j][0]
      num=scores[j][1]-1 # 全問とかないので1減らす
      if point*num<rest:
        rest-=point*num
        solve+=num
      else:
        solve+=(rest//point+(rest%point>0))
        rest=0
    if rest<=0 and ans>solve:
      ans=solve
  
print(ans)
# coding: utf-8
 
# R: Right hand side
# L: Left  hand side
def add_stone(stone, pos, searched_stones):
    sample = searched_stones[::[1, -1][pos == "R"]]
    if sample[0] == stone:
        return None
 
    for n, s in enumerate(sample[1:]):
        if s == stone:
            return stone * (n + 2) + sample[1 + n:]
 
 
def stones_bfs(searched_stones):
    
    queue = [searched_stones + "0"]
    patterns = [["B", "R"], ["B", "L"], ["W", "R"], ["W", "L"]]
    
    while queue:
        stones = queue.pop(0)
        if (stones.count("W") == len(stones) - 1 |
            stones.count("B") == len(stones) - 1):
            return int(stones[-1])
            
        for p in patterns:
            s = add_stone(*p, stones[:-1])
            if s is not None:
                queue += [s + str(int(stones[-1]) + 1)]
 
print(stones_bfs(input().strip()))

### FIXED CODE ###

# coding: utf-8

stones = input().strip()
counter, switch = 0, stones[0]

for s in stones[1:]:
    if switch != s:
        switch = s
        counter += 1

print(counter)
N, M = map(int, raw_input().split(' '))

q = [ int(input()) for _ in range(N) ]
poll = set()

cnt = 0

for _ in reversed(q):
	if not _ in poll:
		print(_)
		
		cnt = cnt + 1
		
		if cnt == M:
			break	
		
		poll.append(_)
		

### FIXED CODE ###

N, M = map(int, raw_input().split(' '))

q = [ int(input()) for _ in range(N) ]
poll = set()

cnt = 0

for _ in reversed(q):
	if not _ in poll:
		print(_)
		
		cnt = cnt + 1
		
		if cnt == M:
			break	
		
		poll.add(_)
n = int(input())
frag = 10**9
a = list(map(float, input().split()))

for i in range(n):
  a[i] = a[i]/float(frag)
  
ans = 1

for i in range(n):
  ans = ans * a[i]

for i in range(n):  
	ans = ans * float(frag)
    
    
if(ans > 10**18):
    ans = -1

print(int(ans))

### FIXED CODE ###

n = int( input() )
A = list( map( int,input().split() ) )
 
if 0 in A:
  print( 0 )
else:
  ret = 1
  for a in A:
    ret = ret * a
    if ret > 10 ** 18:
      ret = -1
      break
  print( ret )
list_len = int(input())
input_list = map(int, input().split())
even_list = input_list
even_list_len = list_len
count = 0
 
while:
  even_list = filter(lambda num: num % 2, input_list)
  even_list_len = len(even_list)
  if list_len != even_list_len:
    break
  even_list = map(lambda num: num / 2, even_list)
  count += 1
    
print(count)

### FIXED CODE ###

input_list_len = int(input())
input_list = map(int, input().split())
even_list = input_list
even_list_len = input_list_len
count = 0

while True:
    even_list = list(filter(lambda num: num % 2 == 0, even_list))
    even_list_len = len(even_list)
    if input_list_len != even_list_len:
        break
    even_list = map(lambda num: num / 2, even_list)
    count += 1

print(count)
cnt = 1
l = a[0]
for _ in range(N):
    if l in a:
        l = a[l-1]
        cnt += 1
        if l == 2:
            print(cnt)
            break
else:
    print(-1)

### FIXED CODE ###

N = int(input())
a = list(int(input()) for _ in range(N))
cnt = 0
l = 1
for _ in range(N):
        l = a[l-1]
        cnt += 1
        if l == 2:
            print(cnt)
            break
else:
    print(-1)
from math import gcd
from functools import reduce
from itertools import product ##for i in z for j in z -> product(z,z)
k=int(input())
z=range(1,k+1)
print(sum(gcd(i,gcd(j,k)) product(z,z,z)))


### FIXED CODE ###

k=int(input())
z=range(1,k+1)
import math
from functools import reduce
sum=0
for i in z:
	for j in z:
		for jj in z:
			sum=sum+reduce(math.gcd,[i,j,jj])
print(sum)
import numpy as np

def main():
    N, M, C = np.array([int(x) for x in input().split(' ')])
    b_arr = np.array([int(x) for x in input().split(' ')])
    a_mat = np.zeros((N,M))

    for i in range(N):
        a_mat[i] = np.array([int(x) for x in input().split(' ')])

    print ( len(list( np.where( a_mat.dot(b_arr)> -C ) )[0]) )

if __name__ == '__main__':
    main()



### FIXED CODE ###

H, W = map(int, input().split())
h, w = map(int, input().split())

res = (H-h)*(W-w)

print(res)
# D - Even Relation

n = int(input())

# adjacency list
alist = [[] for _ in range(n)]

for i in range(n-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    alist[u].append((v, w))
    alist[v].append((u, w))

#print(alist)

dlist = [-1] * n

def dfs(node, par, dist):
    dlist[node] = dist%2
    for i, j in alist[node]:
        if i==par:
            continue
        else:
            dfs(i, node, dist+j)

dfs(0,0,0)

for i in range(n):
    print(dlist[i])    


### FIXED CODE ###

# D - Even Relation

from collections import deque

n = int(input())

# adjacency list
alist = [[] for _ in range(n)]

for _ in range(n-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    alist[u].append((v, w%2))
    alist[v].append((u, w%2))

#print(alist)

dlist = [-1] * n
dlist[0] = 0

q = deque()
q.append(0)

while len(q)>0:
    node = q.popleft()
    for i, j in alist[node]:
        if dlist[i]<0:
            q.append(i)
            dlist[i] = (dlist[node] + j)%2
        else:
            continue

'''
def dfs(node, par, dist):
    dlist[node] = dist%2
    for i, j in alist[node]:
        if i==par:
            continue
        else:
            dfs(i, node, dist+j)
dfs(0,0,0)
'''

for i in range(n):
    print(dlist[i])
n,m=map(int,input().split())
nod=[[]]
check=[[0,0]]
for i in range(n-1):
  nod.append([])
  check.append([10**10,0])
for i in range(m):
  a,b=map(int,input().split())
  nod[a-1].append(b)
  nod[b-1].append(a)


def dfs(k):
  count=check[k-1][0]+1
  uselist=nod[k-1]
  for x in uselist:
    if count<check[x-1][0]:
      check[x-1][0]=count
      check[x-1][1]=k
      dfs(x)
    else:
      continue

dfs(1)
print("Yes")
for i in range(n-1):
  print(check[i+1][1])

### FIXED CODE ###

from collections import deque
dic={}
n,m=map(int,input().split())
nod=[[]]
keep=[0]*n
for i in range(n-1):
  nod.append([])
for i in range(m):
  a,b=map(int,input().split())
  nod[a-1].append(b)
  nod[b-1].append(a)
use=deque()
use.append(1)
for i in range(0,10**100):
  if bool(use):
    sss=use.popleft()
    for j in nod[sss-1]:
      if not j in dic:
        keep[j-1]=sss
        use.append(j)
        dic[j]=1
  else:
    break

keep.pop(0)
print("Yes")
for x in keep:
  print(x)
n,m,c = map(int,input().split())
input_b = map(int,input().split())
while True:
  try:
    list_a=list(map(int,input().split()))
    answer = c
    count = 0
    for i in range(len(list_a)):
    answer += input_b[i] * list_a[i]
    if answer > 0
      count+=1
    print count
  except:
    break;

### FIXED CODE ###

w,h = map(int,input().split())
W,H = map(int,input().split())
print(str((W-w)*(H-h)))
n = int(input())

name = []

while n > 0:
    n -= 1
    name.append(alp[n % 26])
    n //= 26

name.reverse()

print(*name,sep='')

### FIXED CODE ###

n = int(input())

alp = 'abcdefghijklmnopqrstuvwxyz'

name = []

while n > 0:
    n -= 1
    name.append(alp[n % 26])
    n //= 26

name.reverse()

print(*name,sep='')
a=int(input())
b=int(input())
if a<=8 and b<=8:
    print('Yay!')
else:
    print(':(')

### FIXED CODE ###

a,b=map(int,input().split())
if a<=8 and b<=8:
    print('Yay!')
else:
    print(':(')
A = int(input())
B = int(input())
if (A<=9) & (B<=9):
  print(A*B)
else:
  print(-1)

### FIXED CODE ###

A,B = map(int, input().split())
if (A<=9) & (B<=9):
  print(A*B)
else:
  print(-1)
a, b, c, N = map(int, raw_input().split())

if N % 2 == 0:
    ans = a - b
else:
    ans = b - a

if abs(ans) > 10^18:
    print('Unfair')
else:
    print(ans)

### FIXED CODE ###

a, b, c, N = map(int, raw_input().split())

if N % 2 == 0:
    ans = a - b
else:
    ans = b - a

if abs(ans) > 10**18:
    print('Unfair')
else:
    print(ans)
from scipy.special import comb
# a = comb(n, r)
# a = comb(n, r, exact=True)

n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
a = []
a.append(l[0])
cnt = 1
numMap = {}

for i in range(1, n):
    if l[i] == l[i-1]:
        cnt += 1
    else:
        numMap[l[i-1]] = cnt
        a.append(l[i])
        cnt = 1

numMap[l[-1]] = cnt

for i, val in numMap.items():
    #print(i, val)
    temp = comb(val, 3, exact=True)
    ans += temp

# print(a)
# print(numMap)
# print(ans)

for i in range(len(a)):
    for j in range(i+1, len(a)):
        length = a[i] + a[j]

        for k in range(j+1, len(a)):
            if a[k] >= length:
                break
            else:
                ans += numMap[a[i]] * numMap[a[j]] * numMap[a[k]]

print(ans)

### FIXED CODE ###

import bisect
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
biSet = set()


for i in range(n):
    for j in range(i+1, n):
        length = l[i] + l[j]

        index = bisect.bisect_left(l[j+1:], length)
        #print(index)
        if index > 0:
            ans += index


print(ans)
def dp_a_frog1(stones):
    if len(stones) == 0:
        return 0
    dp = [0] * len(stones)
    for i in range(1, len(stones)):
        cost_jump = dp[i-1] + abs(stones[i-1] - stones[i])
        if i > 1:
            cost_jump_2 = dp[i-2] + abs(stones[i-2] - stones[i])
            cost_jump = min(cost_jump, cost_jump_2)
        dp[i] = cost_jump
    return dp[len(stones) - 1]
 

if __name__ == '__main__':
	N = int(input())
	h = list(map(int, input().split()))
    print(dp_a_frog1(h))
    

### FIXED CODE ###

def dp_a_frog1(stones):
    if len(stones) == 0:
        return 0
    dp = [0] * len(stones)
    for i in range(1, len(stones)):
        cost_jump = dp[i - 1] + abs(stones[i - 1] - stones[i])
        if i > 1:
            cost_jump_2 = dp[i - 2] + abs(stones[i - 2] - stones[i])
            cost_jump = min(cost_jump, cost_jump_2)
        dp[i] = cost_jump
    return dp[len(stones) - 1]


if __name__ == '__main__':
    N = int(input())
    h = list(map(int, input().split()))
    print(dp_a_frog1(h))
N=int(input())
S=input()
sl=list(S)
change=[0]
for i in range(1,N):
  if (sl[i-1]==')')and(sl[i]=='('):
    change.append(i)

change.append(N)
r_add=0
l_add=0
for i in range(len(change)-1):
  A=sl[change[i]:change[i+1]]
  r=0
  l=0
  for a in A:
    if a=='(':
      l+=1
    else:
      r+=1
      
  if r==l:
    continue
  elif r>l:
    l_add+=r-l
    r_add=max(0,r_add-(r-l))
  else:
    r_add+=l-r
      
print('('*l_add+S+')'*r_add)print('('*l_add+S+')'*r_add)

### FIXED CODE ###

N=int(input())
S=input()
sl=list(S)
change=[0]
for i in range(1,N):
  if (sl[i-1]==')')and(sl[i]=='('):
    change.append(i)

change.append(N)
r_add=0
l_add=0
for i in range(len(change)-1):
  A=sl[change[i]:change[i+1]]
  r=0
  l=0
  for a in A:
    if a=='(':
      l+=1
    else:
      r+=1
      
  if r==l:
    continue
  elif r>l:
    if r_add>0:
      if r_add>=r-l:
        r_add-=r-l
      else:
        l_add+=r-l-r_add
        r_add=0
        
    else:
      l_add+=r-l
      
  else:
    r_add+=l-r
      
print('('*l_add+S+')'*r_add)
def binarySearch(key, arr, N):
    left = 0
    right = N
    while left < right:
        mid = (left + right) // 2
        if arr[mid] == key:
            return mid
        elif key < arr[mid]:
            right = mid
        else:
            left = mid + 1


N1 = int(input())
arr1 = [int(n) for n in input().split()]
N2 = int(input())
arr2 = [int(n) for n in input().split()]

print(sum([binarySearch(key, arr1, N1) for key in arr2]))



### FIXED CODE ###

def binarySearch(key, arr, N):
    left = 0
    right = N
    while left < right:
        mid = (left + right) // 2
        if arr[mid] == key:
            return 1
        elif key < arr[mid]:
            right = mid
        else:
            left = mid + 1
    return 0


N1 = int(input())
arr1 = [int(n) for n in input().split()]
N2 = int(input())
arr2 = [int(n) for n in input().split()]

print(sum([binarySearch(key, arr1, N1) for key in arr2]))
s = input()
 
for i in range(len(s)):
    if s[i] == '?':
        if i == 0 and s[1] == 'D':
            s = s.replace('?','P',1)
        elif i == 0 and s[1] == 'P':
            s = s.replace('?','D',1)
        elif i == 0 and s[1] == '?':
            s = s.replace('?','D',1)
        elif s[i-1] =='P' :
            s = s.replace('?','D',1)
        elif s[i-1] =='D' and (i ==len(s)-1):
            s = s.replace('?','D',1)
        elif s[i-1] =='D' and (s[i+1] == 'P' or s[i+1] == '?'):
            s = s.replace('?','D',1)
        else:
            s = s.replace('?','P',1)

 
print(s)

### FIXED CODE ###

s = input()
 
for i in range(len(s)):
    if s[i] == '?':
        if i == 0 and len(s) == 1:
            s = s.replace('?','D',1)
        elif i == 0 and s[1] == 'D':
            s = s.replace('?','P',1)
        elif i == 0 and s[1] == 'P':
            s = s.replace('?','D',1)
        elif i == 0 and s[1] == '?':
            s = s.replace('?','D',1)
        elif s[i-1] =='P':
            s = s.replace('?','D',1)
        elif s[i-1] =='D' and (i ==len(s)-1):
            s = s.replace('?','D',1)
        elif s[i-1] =='D' and (i <len(s)-1 and(s[i+1] == 'P' or s[i+1] == '?')):
            s = s.replace('?','D',1)
        else:
            s = s.replace('?','P',1)


print(s)
S=input()
Q=[s for s in S if s != 'A']
U=list('KIHBR')

import sys
if S.count('A')>4:
    print('NO')
    sys.exit()
else:
    for i in range(len(S)):
        if S[i] not in list('AKIHABARA'):
            print('NO')
            sys.exit()
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        print('NO')
        sys.exit()
    elif S[i]=='K' and S[i+1]!='I':
        print('NO')
        sys.exit()
    elif S[i]=='I' and S[i+1]!='H':
        print('NO')
        sys.exit()
for i in range(len(Q)):
    if Q[i]==U[i]:
        pass
    else:
        print('NO')
        break
else:
    print('YES')

### FIXED CODE ###

S=input()
Q=[s for s in S if s != 'A']
U=list('KIHBR')
import sys
if S.count('A')>4:
    print('NO')
    sys.exit()
elif len(Q)!=5:
    print('NO')
    sys.exit()
for i in range(len(S)):
    if S[i] not in list('AKIHABARA'):
        print('NO')
        sys.exit()
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        print('NO')
        sys.exit()
    elif S[i]=='K' and S[i+1]!='I':
        print('NO')
        sys.exit()
    elif S[i]=='I' and S[i+1]!='H':
        print('NO')
        sys.exit()
for i in range(len(U)):
    if Q[i]==U[i]:
        pass
    else:
        print('NO')
        break
else:
    print('YES')
N,X,T=map(int,input().split())
if N%X ==0:
    print(N*T//x)
else:
    print(((N//X)+1)*T)


### FIXED CODE ###

N,X,T=map(int,input().split())
if N%X ==0:
    print(N*T//X)
else:
    print(((N//X)+1)*T)
a, b, c = map(int, input())
print(abs(a-b+c))

### FIXED CODE ###

a, b, c = map(int, input().split())
if a < b+c:
	print(abs(a-(b+c)))
else:
  print(0)
x,y=input().split()
if x=="A":x=10
if x=="B":X=11
if x=="C":x=12
if x=="D":x=13
if x=="E":x=14
if x=="F":x=15
if y=="A":y=10
if y=="B":y=11
if y=="C":y=12
if y=="D":y=13
if y=="E":y=14
if y=="F":y=15
if x<y:print("<")
elif x>y:print(">")
else:print("=")

### FIXED CODE ###

x,y=input().split()
lis=["A","B","C","D","E","F"]
for i in range(6):
    if x==lis[i]:x=i+10
    if y==lis[i]:y=i+10
if x<y:print("<")
elif x>y:print(">")
elif x==y:print("=")
n, m = map(int, input().split())
if m >= n*2:
    leave_c = m - n*2
    available = leave_c // 4
    print(n + available)
else:
    availabe_c = m // 2
    print(available_c)

### FIXED CODE ###

n, m = map(int, input().split())
if m >= n*2:
    leave_c = m - n*2
    available = leave_c // 4
    print(n + available)
else:
    available_c = m // 2
    print(available_c)
import numpy as np
H, W = map(int, input().split())
red_map = np.array([input().split() for i in range(H)], dtype="int")
blue_map = np.array([input().split() for i in range(H)], dtype="int")
sub_map = abs(red_map - blue_map)
dp = [[[] for i in range(W)] for i in range(H)]
 
for i in range(H):
  for j in range(W):
    if not i and not j:
      dp[i][j].append(sub_map[i][j])
      dp[i][j].append(-sub_map[i][j])
    if i > 0 and j > 0:
      for k in dp[i-1][j]:
        dp[i][j].append(k + sub_map[i][j])
        dp[i][j].append(k - sub_map[i][j])
      for l in dp[i][j-1]:
        dp[i][j].append(l + sub_map[i][j])
        dp[i][j].append(l - sub_map[i][j])
    if i > 0 and not j:
      for m in dp[i-1][j]:
        dp[i][j].append(m + sub_map[i][j])
        dp[i][j].append(m - sub_map[i][j])
    if j > 0 and not i:
      for n in dp[i][j-1]:
        dp[i][j].append(n + sub_map[i][j])
        dp[i][j].append(n - sub_map[i][j])

print(min(np.abs(dp[H-1][W-1])))

### FIXED CODE ###

import numpy as np
H, W = map(int, input().split())
red_map = np.array([input().split() for i in range(H)], dtype="int")
blue_map = np.array([input().split() for i in range(H)], dtype="int")
sub_map = abs(red_map - blue_map)
dp = [[2020]*W for i in range(H)]
max_deviation = 2**(80*(H+W))

for i in range(H):
  for j in range(W):
    if not i and not j:
      dp[i][j] = (max_deviation<<sub_map[i][j] | max_deviation>>sub_map[i][j])
    if i > 0:
      dp[i][j] |= (dp[i-1][j]<<sub_map[i][j] | dp[i-1][j]>>sub_map[i][j])
    if j > 0:
      dp[i][j] |= (dp[i][j-1]<<sub_map[i][j] | dp[i][j-1]>>sub_map[i][j])
      
pre_ans = dp[H-1][W-1]>>80*(H+W)
pre_ans_bit = format(pre_ans&-pre_ans, "b")
ans = len(pre_ans_bit)-1
print(ans)
# 問題：https://atcoder.jp/contests/abc176/tasks/abc176_d

import numpy as np

h, w = map(int, input().strip().split())
cx, cy = map(int, input().strip().split())
dx, dy = map(int, input().strip().split())
cx -= 1
cy -= 1
dx -= 1
dy -= 1
qx = [cx]
qy = [cy]

s = [input() for _ in range(h)]
reached = np.zeros((h, w))
for i in range(h):
    for j in range(w):
        if s[i][j] == '.':
            reached[i].append(0)
        if s[i][j] == '#':
            reached[i].append(1)
res = 0

while qx:
    pre_qx = []
    pre_qy = []
    while qx:
        x = qx.pop(0)
        y = qy.pop(0)
        if reached[x][y] == 1:
            continue
        pre_qx.append(x)
        pre_qy.append(y)
        reached[x][y] = 1
        if x > 0 and reached[x-1][y] == 0:
            qx.append(x-1)
            qy.append(y)
        if x < h-1 and reached[x+1][y] == 0:
            qx.append(x+1)
            qy.append(y)
        if y > 0 and reached[x][y-1] == 0:
            qx.append(x)
            qy.append(y-1)
        if y < w-1 and reached[x][y+1] == 0:
            qx.append(x)
            qy.append(y+1)
    if reached[dx][dy] == 1:
        break
    res += 1
    while pre_qx:
        x = pre_qx.pop(0)
        y = pre_qy.pop(0)
        lx = max(x-2, 0)
        rx = min(x+3, h)
        ly = max(y-2, 0)
        ry = min(y+3, w)
        for i in range(lx, rx):
            for j in range(ly, ry):
                if reached[i][j] == 0:
                    qx.append(i)
                    qy.append(j)

if reached[dx][dy] == 0:
    res = -1

print(res)



### FIXED CODE ###

# 問題：https://atcoder.jp/contests/abc176/tasks/abc176_a

n, x, t = map(int, input().strip().split())
res = (n-1) // x + 1
res *= t
print(res)
A,B = int(input().split())

print(max(a+b,a-b,a*b))


### FIXED CODE ###

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

print(max(a+b,a-b,a*b))