Harryxun/stf_run huggingface dataset:
X,K,D = map(int,input().split())
X_div_D = X//D

p_min = X % D
n_min = abs(p_min - D)

if p_min <= n_min:
  ans_min = p_min
  min_idx = X_div_D
  sign_min = 1
else:
  ans = min = n_min
  min_idx = X_div_D + 1
  sign_min = -1
  
if K < min_idx:
  print(X - K * D)
else:
  if (K - min_idx) % 2 == 0:
    print(ans_min)
  else:
    print(abs(ans_min - sign_min * D))

### FIXED CODE ###

X,K,D = map(int,input().split())
X = abs(X)
X_div_D = X//D

ans_min = X % D

if K <= X_div_D:
  print(X - K * D)
else:
  if (K % 2) ^ (X_div_D % 2) == 0:
    print(ans_min)
  else:
    print(abs(ans_min - D))
a, b = (int(i) for i in input().split())
 
if a % 2 != b % 2:
  return "IMPOSSIBLE"
else:
  return int((a+b) / 2)

### FIXED CODE ###

a, b = (int(i) for i in input().split())
 
if a % 2 != b % 2:
  print("IMPOSSIBLE")
else:
  print(int((a+b) / 2))
n = int(input())
points = []
ans = [0,0,0]
for i in range(n):
  x,y,h = map(int,input().split())
  points.append((x,y,h))

def f(points):
  for x in range(0,101):
    for y in range(0,101):
      h = 0
      same = True
      for p in points:
        h_p = abs(x-p[0]) + ans(y-p[1]) + p[2]
        if h != 0 and h != h_p:
          same = False
          break
        elif h == 0:
          h = h_p
      if same:
        return x,y,h
      
ans = f(points)
print("{} {} {}", format(ans[0], ans[1], ans([2])))

### FIXED CODE ###

n = int(input())
points = []
for i in range(n):
    x, y, h = map(int, input().split())
    points.append((x, y, h))
points.sort(key=lambda x:x[2], reverse=True)


def f(points):
    for x in range(0, 101):
        for y in range(0, 101):
            p = points[0]
            h = abs(x - p[0]) + abs(y - p[1]) + p[2]
            same = True
            for i in range(1, len(points)):
                p = points[i]
                h_p = max(0, h - abs(x - p[0]) - abs(y - p[1]))
                if h_p != p[2]:
                    same = False
                    break
            if same:
                return x, y, h
    return -1,-1,-1


ans = f(points)
print("{} {} {}".format(ans[0], ans[1], ans[2]))
[n,w] = [int(i) for i in input().split()]
w_v = []
for i in range(n):
    w_v.append([int(j) for j in input().split()])

"""
dp[i][v] = w
i : 何番目までのものを使うか
v : ちょうどその価値になる
w : その時の重さ
最後に後ろから全探索して重さ超えてないやつ探す？
"""
INF = 20
v_max = 20
dp = [[INF] * (v_max) for i in range(n)]
##print(dp)
#価値0になるところの重さは0
for i in range(n):
    dp[i][0] = 0
for i in range(n):
    #print("step",i)
    if i != 0:
        for v_zantei in range(v_max):
            if v_zantei >= w_v[i][1]:
                dp[i][v_zantei] = min(dp[i-1][v_zantei],dp[i-1][v_zantei - w_v[i][1]] + w_v[i][0])
            else:
                dp[i][v_zantei] = dp[i-1][v_zantei]
        #print(dp[i])
    else:
        dp[i][w_v[i][1]] = w_v[i][0]
        #print(dp[i])
ans = -1
for v in range(v_max-1,-1,-1):
    #print(w,dp[n-1][v],ans)
    if dp[n-1][v] <= w and ans < v:
        ##print(v)
        ans = v
print(ans)


### FIXED CODE ###

[n,w] = [int(i) for i in input().split()]
w_v = []
for i in range(n):
    w_v.append([int(j) for j in input().split()])

"""
dp[i][v] = w
i : 何番目までのものを使うか
v : ちょうどその価値になる
w : その時の重さ
最後に後ろから全探索して重さ超えてないやつ探す？
"""
INF = 10 ** 9 + 7
v_max = 10**3 * n + 1
dp = [[INF] * (v_max) for i in range(n)]
##print(dp)
#価値0になるところの重さは0
for i in range(n):
    dp[i][0] = 0
if n != 1:
    for i in range(n):
        #print("step",i)
        if i != 0:
            for v_zantei in range(v_max):
                if v_zantei >= w_v[i][1]:
                    dp[i][v_zantei] = min(dp[i-1][v_zantei],dp[i-1][v_zantei - w_v[i][1]] + w_v[i][0])
                else:
                    dp[i][v_zantei] = dp[i-1][v_zantei]
            #print(dp[i])
        else:
            dp[i][w_v[i][1]] = w_v[i][0]
            #print(dp[i])
    ans = -1
    for v in range(v_max-1,-1,-1):
        #print(w,dp[n-1][v],ans)
        if dp[n-1][v] <= w and ans < v:
            ##print(v)
            ans = v
    print(ans)
else:
    print(w_v[0][1])
H, N = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    
import numpy as np

dp = np.zeros([N+1, H+1])
dp[0, 1:] = np.inf

for i in range(0, N):
    for j in range(1, H+1):        
        dp[i+1][j] = min(dp[i][j], dp[i+1][max(0, j-A[i])] + B[i])
        
print(int(dp[-1][-1]))

### FIXED CODE ###

H, N = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    
#import numpy as np
#dp = np.zeros([N+1, H+1])
#dp[0, 1:] = np.inf
dp = [[0]*(H+1) for _ in range(N+1)]
for j in range(1, H+1):
	dp[0][j] = float('inf')

for i in range(0, N):
    for j in range(1, H+1):        
        dp[i+1][j] = min(dp[i][j], dp[i+1][max(0, j-A[i])] + B[i])
        
print(int(dp[-1][-1]))
n=int(input())
li = list(map(int,input().split()))
count=1
li2=[]
for i in range(1,n):
  li2=li[0,i-1]
  if(max(li2)>=li[i]):
    count+=1
print(count)


### FIXED CODE ###

n=int(input())
li = list(map(int,input().split()))
count=1
m=n
for i in range(1,n):
    m=min(m,li[i-1])
    if(m==1):
        break
    if(m>=li[i]):
        count+=1
print(count)
s=str(input())
y=700
x=0
while x!=2
if s[x]=Ｏ：
　　　y+=100
else:
    y+=0  
x+=1
break
print(y)

### FIXED CODE ###

S = input()
s = S.count('o')*100
 
print(700+s)
n, k = map(int, input().split())
x = n
min_n = n
rlist = []
while x>0:
    rlist.append(abs(x-k))
    x = abs(x-k)
    min_n = min(rlist)
    if (min_n == abs(x-k)):break
print(min(rlist))



### FIXED CODE ###

n, k = map(int, input().split()) 
t = n % k
if (k-t > t):
    print(t)
else:
    print(k-t)
print('OEdvde n'['0'in s:=input()or'4'in s::2])

### FIXED CODE ###

a,b=map(int,input().split())
print(['Even','Odd'][a*b%2>0])
n, m =map(int,input().split())
c = list(map(int,input().split()))

INF = 10**10
dp = [INF]*(n**2)
dp[0] = 0

for i in range (n+1):
    for j in c:
        dp[i+j] = min(dp[i+j],dp[i]+1)
print(dp[n])


### FIXED CODE ###

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

INF = 10**100
dp = [INF]*500000
dp[0] = 0

for i in range (n+1):
    for j in c:
        dp[i+j] = min(dp[i+j],dp[i]+1)
print(dp[n])
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
uni = UnionFind(n)
for i in range(m):
    a, b = ab[i]
    uni.union(a, b)
print(uni.group_count() - 1)


### FIXED CODE ###

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
uni = UnionFind(n)
for i in range(m):
    a, b = ab[i]
    uni.union(a - 1, b - 1)
print(uni.group_count() - 1)
a=input()
for i in range(len(a)):
  a[i]='x'
print(a)

### FIXED CODE ###

a=input()
b=''
for i in range(len(a)):
  b+='x'

print(b)
# -*- cod:utf-8 -*-
import sys

sys.setrecursionlimit(100000)

def dfs(x, y, sym):
    field[x][y] = '.'
    for dx in range(-1,2):
        if dx==-1 or dx==1:
            nx = x + dx
            ny = y
            if(nx>=0 and nx<N and 0<=ny and ny<M and field[nx][ny]==sym):
                dfs(nx, ny, sym)
        else:
            nx = x
            for dy in [-1,1]:
                ny = y + dy
                if(nx>=0 and nx<N and 0<=ny and ny<M and field[nx][ny]==sym):
                    dfs(nx, ny, sym)
def solve():
    res = 0
    flg=0
    for i in range(N):
        for j in range(M):
            if not field[i][j] == '.':
                if field[i][j] == '@':
                    dfs(i, j, '@')
                    res += 1
                elif field[i][j] == '#':
                    dfs(i, j, '#')
                    res += 1
                else:
                    dfs(i, j, '*')
                    res += 1
    print(res)


while True:
    datas = sys.stdin.readlines()
    data = datas[0].split(' ')
    N = int(data[0])
    M = int(data[1])
    if ' ' in data[-1]:
        data2 = datas[-1].split(' ')
        L = int(data2[0])
        K = int(data2[1])
        if L==0 and K==0:
            break
    field = [[0 for i in range(N) ]for j in range(M)]

    for i in range(M):
        field[i] = list(datas[i+1])[0:-1]
    solve()

### FIXED CODE ###

# -*- coding:utf-8 -*-
import sys
def dfs(x, y, sym):
	tile[x][y] = "."
	for i in range(len(DX)):
		nx = x + DX[i]
		ny = y + DY[i]
		if (0<=nx and nx<N and 0<=ny and ny<M and tile[nx][ny] is sym):
			dfs(nx, ny, sym)

def solve():
	res = 0
	for i in range(N):
		for j in range(M):
			sym = tile[i][j]
			if tile[i][j] != ".":
				if tile[i][j] is sym:
					dfs(i, j, sym)
					res += 1
	print(res)

counter=0
DX = [-1,0,1,0]
DY = [0,-1,0,1]
sys.setrecursionlimit(10**7)
while True:
	line = input()
	if " " in line:
		nums = line.split(" ")
		N = int(nums[0])
		M = int(nums[1])
		tile = [[0 for i in range(M)] for j in range(N)]
	else:
		tile[counter-1] = list(line)
	if N is 0 and M is 0:
		break
	counter += 1
	if counter-1 is N:
		solve()
		counter = 0
a=input()
b=input()
c=input()
if a == b:
 print(int(c))
elif a == c:
 print(int(b))
elif b == c:
 print(int(a))

### FIXED CODE ###

a,b,c=map(int,input().split())
if a==b:
    print(c)
elif b==c:
  print(a)
else:
  print(b)
%import numpy as np
c1 = [int(i) for i in input().split()]
c2 = [int(i) for i in input().split()]
c3 = [int(i) for i in input().split()]
s = sum(c1) + sum(c2) + sum(c3)
print('Yes' if s % 3 == 0 else 'No')

### FIXED CODE ###

import numpy as np
c = np.array([[int(i) for i in input().split()] for _ in range(3)])
b = np.sum(c) % 3 == 0
b &= np.sum(c[0] - c[1]) % 3 == 0
b &= np.sum(c[0] - c[2]) % 3 == 0
b &= np.sum(c[1] - c[2]) % 3 == 0
c = c.T
b &= np.sum(c[0] - c[1]) % 3 == 0
b &= np.sum(c[0] - c[2]) % 3 == 0
b &= np.sum(c[1] - c[2]) % 3 == 0
print('Yes' if b else 'No')
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    for i, a, b in map(lambda x: (x, int(x*0.08), int(x*0.1)), range(A*100)):
        if a == A and b == B:
            return i
    return -1


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B))

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    for i, a, b in map(lambda x: (x, int(x*0.08), int(x*0.1)), range(A*100)):
        if a == A and b == B:
            return i
    return -1


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B))

if __name__ == '__main__':
    main()
a,b,k = map(int,input().split())
c = list(range(a,b+1))
ans = c[:k] + c[-k:]
ans = list(set(ans))
ans.sort()
for i in ans:
    print(i)

### FIXED CODE ###

a,b,k = map(int,input().split())
ans = [a+i for i in range(k) if a+i <= b] + [b-i for i in range(k) if b-i >= a]
ans = list(set(ans))
ans.sort()

for i in ans:
    print(i)
def main():
    len_s = 0
    ans = -1
    dic = {}
    N, K = map(int, input().split())
    for _ in range(N):
        a, b = map(int, input().split())
        if a not in dic:
            dic[a] = b
        else:
            dic[a] = b + dic[a].values
    dic = sorted(dic.items())
    for key, value in dic:
        len_s += value
        if len_s >= K and ans == -1:
            ans = key
    print(ans)
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    len_s = 0
    ans = -1
    dic = {}
    N, K = map(int, input().split())
    for _ in range(N):
        a, b = map(int, input().split())
        if a not in dic:
            dic[a] = b
        else:
            dic[a] += b
    dic = sorted(dic.items())
    for key, value in dic:
        len_s += value
        if len_s >= K and ans == -1:
            ans = key
    print(ans)
if __name__ == '__main__':
    main()
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n,m=mii()

arr=sorted(limii())

mat=[]
for i in range(m):
    b,c=mii()
    mat.append([b,c])

mat.sort(key=lambda x: x[1],reverse=True)
maxboundary=mat[0][1]
ans=0
i=0
temp=0
while maxboundary>arr[temp] and temp<n and i<m:
    ans+=mat[i][1]
    temp+=1
    mat[i][0]-=1
    if mat[i][0]==0:
        i+=1
        if i<m:
            maxboundary=mat[i][1]
    #print(ans,temp,i,mat,maxboundary)

print(ans+sum(arr[temp:]))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n,m=mii()

arr=sorted(limii())

mat=[]
for i in range(m):
    b,c=mii()
    mat.append([b,c])

mat.sort(key=lambda x: x[1],reverse=True)
maxboundary=mat[0][1]
ans=0
i=0
temp=0
while maxboundary>arr[temp] and temp<n and i<m:
    ans+=mat[i][1]
    
    temp+=1
    if temp==n:
        break
    mat[i][0]-=1
    if mat[i][0]==0:
        i+=1
        if i<m:
            maxboundary=mat[i][1]
    #print(ans,temp,i,mat,maxboundary)

print(ans+sum(arr[temp:]))
a,b = input().split()
c = a*b
print('{:g}'.format(c))

### FIXED CODE ###

from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))
S = str(input())
f = []
l = []
ans = 'Yes'
for i in range((len(S)-1)/2):
    f.append(S[i])
    l.append(S[-i-1])
if f == l 

### FIXED CODE ###

S = str(input())
f = []
l = []
ans = 'Yes'
for i in range(int((len(S)-1)/2)):
    f.append(S[i])
    l.append(S[-i-1])
for i in range(len(f)):
    if f[i] != l[-i-1]:
        ans = 'No'
print(ans)
S = input()
N = len(S)

def ctoi(c):
    return ord(c) - ord('a')

cums = [0]
for c in S:
    cums.append(cums[-1] ^ (1<<ctoi(c)))
if cums[-1] == 0:
    print(1)
    exit()

dp = {0:0}
for b in cums:
    if b in dp: continue
    for k in range(26):
        if b&(1<<k)==0: continue
        msk = b^(1<<k)
        if msk in dp:
            if b in dp:
                dp[b] = min(dp[b], dp[msk]+1)
            else:
                dp[b] = dp[msk]+1
print(dp[cums[-1]])

### FIXED CODE ###

def ctoi(c):
    return ord(c) - ord('a')

def solve(s):
    masks = [1<<k for k in range(26)]
    cums = [0]
    for c in s:
        cums.append(cums[-1] ^ masks[ctoi(c)])
    if cums[-1] == 0:
        print(1)
        exit()

    dp = {0:0}
    for b in cums:
        for m in masks:
            msk = b^m
            if msk in dp:
                if b in dp:
                    dp[b] = min(dp[b], dp[msk]+1)
                else:
                    dp[b] = dp[msk]+1
    return dp[cums[-1]]

print(solve(input()))
import math
price = int(input())
tax = 8
price_1 = math.ceil(price / (1 + tax / 100))
price_2 = math.floor(price * tax / 100)
print(price_1 if price == price_1 + price2 else ':(')

### FIXED CODE ###

import math
price = int(input())
tax = 8
price_1 = math.ceil(price / (1 + tax / 100))
price_2 = math.floor(price_1 * tax / 100)
print(price_1 if price == price_1 + price_2 else ':(')
n=list(input().reverse())

if (n[0]=="2" or n[0]=="4" or n[0]=="5" or n[0]=="7" or n[0]=="9"):
    print("hon")
elif (n[0]=="0" or n[0]=="1" or n[0]=="6" or n[0]=="8"):
    print("pon")
else:
    print("bon")

### FIXED CODE ###

n=list(input())

n==n.reverse()

if (n[0]=="2" or n[0]=="4" or n[0]=="5" or n[0]=="7" or n[0]=="9"):
    print("hon")
elif (n[0]=="0" or n[0]=="1" or n[0]=="6" or n[0]=="8"):
    print("pon")
elif (n[0]=="3"):
    print("bon")
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

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

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

    if k == 1:
        print(0)
        exit()

    aa.sort()

    cnt = 0

    c = 1
    large = k+1
    before = 0

    for i, j in zip(aa[k-1:], reversed(aa[:-k+1])):

        cnt += (i-j)*(c-before)
        before = c
        c = c*large/(large-k)

        large += 1
    print(int(cnt%(10**9+7)))


### FIXED CODE ###

if __name__ == '__main__':
    import sys
    input = sys.stdin.readline


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

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

    """

    n = 100000
    k = 50000
    aa = [i for i in range(100000)]
    """

    import math

    if k == 1:
        print(0)
    else:
        def cmb(n, r, p):
            if (r < 0) or (n < r):
                return 0
            r = min(r, n - r)
            return fact[n] * factinv[r] * factinv[n-r] % p

        p = 10 ** 9 + 7
        N = 10 ** 5  # N は必要分だけ用意する
        fact = [1, 1]  # fact[n] = (n! mod p)
        factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
        inv = [0, 1]  # factinv 計算用

        for i in range(2, N + 1):
            fact.append((fact[-1] * i) % p)
            inv.append((-inv[p % i] * (p // i)) % p)
            factinv.append((factinv[-1] * inv[-1]) % p)

        aa.sort()

        cnt = 0

        c = 1
        large = k
        before = 0

        for i, j in zip(aa[k-1:], reversed(aa[:-k+1])):
            c = cmb(large, k, p)
            cnt += (i-j)*(c-before)
            cnt = cnt%(10**9+7)
            before = c
            large += 1

        print(int(cnt%(10**9+7)))
# bit全探索
N = int(input())
F = [list(map(int,input().split())) for _ in range(N)]
P = [list(map(int,input().split())) for _ in range(N)]
ans = -float('inf')
for i in range(2**10):
    if i == 0: # 全く営業しないパターン
        continue
    profit = 0
    pattern = [0]*10
    for j in range(10):
        if 1 << j & i:
            pattern[j] = 1
    #print(pattern)

    for k in range(N):
        l = sum([pattern[m] == F[k][m] == 1 for m in range(10)])
        # l = 0
        # for m in range(10):
        #     if pattern[m] == F[k][m] == 1:
        #         l += 1

        #print(l)
        profit += P[k][l]
    ans = max(ans,profit)
print(ans)





### FIXED CODE ###

n,a,b = map(int,input().split())
print(min(n*a,b))
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.sort(reverse=1)
b.sort(reverse=1)
c.sort(reverse=1)
m=[]
for i in range(x):
  for j in range(y):
    for k in range(z):
      if i*j*k>K:
        continue
      m.append(a[i]+b[j]+c[k])
m.sort(reverse=1)
for i in m[:K]:
  print(i)

### 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()))
a.sort(reverse=1)
b.sort(reverse=1)
c.sort(reverse=1)
m=[]
for i in range(x):
  for j in range(y):
    for k in range(z):
      if (i+1)*(j+1)*(k+1)>K:
        break
      m.append(a[i]+b[j]+c[k])
m.sort(reverse=1)
for i in m[:K]:
  print(i)
A,B,C = sported(list(map(int,input().split())))
print(int(A*B*0.5))

### FIXED CODE ###

sides = list(map(int,input().split()))
s1,s2 = sorted(sides)[:2]
print(int(s1*s2/2))