Harryxun/stf_run huggingface dataset:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)

nums = {}
nums[1] = 2
nums[2] = 5
nums[3] = 5
nums[4] = 4
nums[5] = 5
nums[6] = 6
nums[7] = 3
nums[8] = 7
nums[9] = 6

dp = [-float('inf')]*(N+1)
dp[0] = 0

for i in range(N+1):
    for a in A:
        if i-nums[a] >= 0:
            dp[i] = max(dp[i], dp[i-nums[a]]+1)

ans = ""
i = N
for _ in range(dp[-1]):
    for a in A:
        if dp[i]-1 == dp[i-nums[a]]:
            ans += str(a)
            i = i-nums[a]
            break
print(ans)


### FIXED CODE ###

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)

nums = {}
nums[1] = 2
nums[2] = 5
nums[3] = 5
nums[4] = 4
nums[5] = 5
nums[6] = 6
nums[7] = 3
nums[8] = 7
nums[9] = 6

dp = [-float('inf')]*(N+1)
dp[0] = 0

for i in range(N+1):
    for a in A:
        if i-nums[a] >= 0:
            dp[i] = max(dp[i], dp[i-nums[a]]+1)

ans = ""
i = N
while i > 0:
    for a in A:
        if i >= nums[a] and dp[i]-1 == dp[i-nums[a]]:
            ans += str(a)
            i = i-nums[a]
            break
print(ans)
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import deque
import pprint

inf = 10**18
mod = 10**9+7

n = int(input())
a = list(map(int, input().split()))
a.sort()
b = []
pre = a[0]
if a[0] != a[1]:
    b.append(a[0])
    if pre == 1:
        print(1)
        sys.exit()
else:
    if pre == 1:
        print(0)
        sys.exit()

for num in a:
    if pre != num:
        b.append(num)
        pre = num

judge = [False for i in range(10**6+1)]
for num in b:
    judge[num] = True
for i in range(1,int(math.sqrt(10**6+1))):
    if judge[i] == 1:
        for j in range(i*2,10**6+1,i):
            judge[j] = False
ans = 0
for i in range(1,10**6+1):
    if judge[i]:
        ans+=1
print(ans)

### FIXED CODE ###

# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import deque
import pprint

inf = 10**18
mod = 10**9+7

n = int(input())
a = list(map(int, input().split()))
a.sort()
if n == 1:
    print(1)
    sys.exit()
if n == 2:
    if a[0] == a[1]:
        print(0)
    elif a[1]%a[0] == 0:
        print(1)
    else:
        print(2)
    sys.exit()

b = []
pre = a[0]
if a[0] != a[1]:
    if pre == 1:
        print(1)
        sys.exit()
else:
    if pre == 1:
        print(0)
        sys.exit()

judge = [False for i in range(10**6+1)]
for num in a:
    judge[num] = True
for i in range(1,(10**6)):
    if judge[i]:
        for j in range(i*2,10**6+1,i):
            judge[j] = False
ans = 0
for i in range(1,10**6+1):
    if judge[i]:
        ans+=1
subans = 0
c = collections.Counter(a)
for k,v in c.items():
    if v > 1 and judge[k]:
        subans+=1
print(ans-subans)
N = int(input())

A = list(map(int, input().split()))
S = sum(A)

for i in range(N-1):
    S -= A[i]
    ans += A[i] * S
    

ans = ans % (10 ** 9  +7)        

print(ans)


### FIXED CODE ###

N = int(input())

A = list(map(int, input().split()))
S = sum(A)
ans = 0
for i in range(N):
    S -= A[i]
    ans += A[i] * S
    

ans = ans % (10 ** 9  +7)        

print(ans)
import sys

def main(l):
    u = set()
    l = list(sorted(l))
    for i, a in enumerate(reversed(l)):
        searching = (1 << a.bit_length()) - a
        for j, b in enumerate(l[:-i-1]):
            if b == searching and not j in u:
                u.add(j)
                break

    return len(u)


if __name__ == '__main__':
    input()
    main(map(int, input()))

### FIXED CODE ###

import re
import sys

line = next(map(str.strip, sys.stdin))

count = 0
nb_bs = 0
for i, c in enumerate(line):
    if c == 'W' and nb_bs > 0:
        count += nb_bs
    elif c == 'B':
        nb_bs += 1

print(count)
s = int(input())

if s[:1] <= 12 and s[2:] <= 12:
  print("AMBIGUOUS")
elif s[:1] <= 12:
  print("MMYY")
elif s[2:] <= 12:
  print("YYMM")
else:
  print("NA")

### FIXED CODE ###

s = input()

if 0 < int(s[:2]) <= 12 and 0 < int(s[2:]) <= 12:
  print("AMBIGUOUS")
elif 0 < int(s[:2]) <= 12:
  print("MMYY")
elif 0 < int(s[2:]) <= 12:
  print("YYMM")
else:
  print("NA")
n, m = (int(i) for i in input().split())
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]
a.sort()
bc.sort(key=lambda x:x[1], reverse=True)
# print(a)
# print(bc)

index = 0
break_flag = False

for i in range(m):
    for j in range(bc[i][0]):
        if(a[index] < bc[i][1]):
            a[index] = bc[i][1]
            index += 1
            # print(a)
        else:
            break_flag = True
            break
    if  break_flag:
        break
print(sum(a))

### FIXED CODE ###

n, m = (int(i) for i in input().split())
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]
a.sort()
bc.sort(key=lambda x:x[1], reverse=True)

# print(a)
# print(bc)

index = 0
break_flag = False

for i in range(m):
    for j in range(bc[i][0]):
        if (index < n):
            if(a[index] < bc[i][1]):
                a[index] = bc[i][1]
                index += 1
                # print(a)
            else:
                break_flag = True
                break
        else:
            break_flag = True
            break
    if  break_flag:
        break
print(sum(a))
A,B,C,K = map(int,input().split())

def solve(a,b,c,k):
  s = 0
  while k > 0:
    if a > 0:
      a -= 1
      s += 1
      k -= 1
    elif b > 0:
      b -= 1
      k -= 1
    else:
      c -= 1
      s -= 1
      k -= 1

  return s
    
print(solve(A,B,C,K))

### FIXED CODE ###

s = input()
t = input()

if t[:-1] == s:
  print("Yes")
else:
  print("No")
# -*- coding: utf-8 -*-

import sys


lineNumber = 0
out = False
#for line in [ "2", "1000", "800", "9999999999", "1" ]:
for line in sys.stdin.readlines():
    lineNumber += 1

    # line exception
    if lineNumber == 1:
        continue
    
    # get data
    List = map(int, line.strip().split())

    # set data
    if lineNumber % 2 == 0: a = line.strip()
    else                  : b = line.strip()


    # sum
    if lineNumber % 2 == 1:
        if not out: out = True
        else      : print

        maxlen = max(len(a), len(b))
        if maxlen > 80:
            print "overflow",
            continue

        upper = 0
        c = ""
        for i in xrange(1, maxlen+1):
            try:
                buf = int(a[-i]) + int(b[-i]) + upper
                upper = buf / 10
                buf %= 10
            except:
                try:
                    buf = int(a[-i]) + upper
                    upper = buf / 10
                    buf %= 10
                except:
                    buf = int(b[-i]) + upper
                    upper = buf / 10
                    buf %= 10
            c = str(buf) + c

        if upper != 0: c = str(upper) + c

        if len(c) > 80: print "overflow",
        else          : print int(c),

### FIXED CODE ###

for i in range(int(raw_input())):
    x = int(raw_input())
    y = int(raw_input())
    s = str(x+y)
    if len(s) > 80:
        print "overflow"
    else :
        print s
if x == 0:
  x = 1
else:
  x = 0
print(x)

### FIXED CODE ###

x = int(input())
if x == 0:
  x = 1
elif x == 1:
  x = 0
print(x)
n, m, l = (int(i) for i in input().split())
A = []
B = []
#C = [[0] * n] * l
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(0,n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(0,m):
    swap_list = input().split()
    B.append(swap_list)

#?????????????????????
for i in range(0,n):
    for j in range(0,l):
        for k in range(0,m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
for i in range(0,n):
    print(" ".join(map(str, C[i][:])))

### FIXED CODE ###

n, m, l = (int(i) for i in input().split())
A = []
B = []
C = [[0 for i in range(l)] for j in range(n)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
    #A.append([int(i) for i in input().split()])
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)
    #B.append([int(i) for i in input().split()])
#????????????????¨????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
#for i in range(n):
#    for j in range(l):
#        print("{0}".format(C[i][j]), end="\b")
#    print("")
for i in range(n):
    print(" ".join(map(str, C[i][:])))
#for r in C:
#    print(" ".join([str(d) for d in r]))
S,W = map (int12,input().split())
if S > W:
  print("safe")
else :
  print("unsafe")


### FIXED CODE ###

S,W = map (int,input().split())
if S > W:
  print("safe")
else :
  print("unsafe")
x = int(input())
b = int(input())
c = int(input())
x -= a
x = x- b*(x//b)
print(x)

### FIXED CODE ###

x = int(input())
a = int(input())
b = int(input())
x -= a
x -= b*(x//b)
print(x)
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
for i in range(min(X), max(X)):
    ans = 0
    for j in X:
        ans += (j - i) * (j - i)
    ans_list.append(ans)

print(min(ans_list))


### FIXED CODE ###

import sys
N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
if N == 1:
    print('0')
    sys.exit()
for i in range(min(X), max(X) + 1):
    ans = 0
    for j in X:
        ans += (j - i) ** 2
    ans_list.append(ans)

print(min(ans_list))
import numpy as np

A = input()
B = input()

N,X = map(int,A.split())
L = np.array(map(int,B.split( )))
L_sum = 0
jump = 1
for i in range(N+1):
  L_sum += L[i]
  if(L_sum<X):
    jump += 1 
  else:
    jump += 0

print(jump)

### FIXED CODE ###

import numpy as np

A = input()
B = input()

N,X = map(int,A.split())
L = np.array(list(map(int, B.strip().split())))

L_sum = 0
jump = 1

for i in range(N):
  L_sum += L[i]
  if(L_sum>X):
    jump += 0
  else:
    jump += 1

print(jump)
import sympy
n = int(input())
i = 0
remove_nums = [1]
while True:
    divisors = sympy.divisors(int(n))
    z_cand = [d for d in divisors if d not in remove_nums]
    if z_cand == []:
        break
    z = min(z_cand)
    remove_nums.append(z)
    n = n/z
    i += 1
print(i)

### FIXED CODE ###

import math
import numpy as np
n = int(input())
fac = []
sqrt_n = math.sqrt(n)
for i in range(2, int(sqrt_n)):
    if not n % i:
        fac.append(0)
    while not n % i:
        n /= i
        fac[-1] += 1
if n > sqrt_n:
    fac.append(1)
num = 0
for f in fac:
    num += np.count_nonzero(f >= np.cumsum(range(1, f+1)))
print(num)
def trans(cur, prev, score, paths, N):
    # inf check
    if cur in paths:
        nodes = paths[cur]
        for n, s in nodes:
            if prev == n:
                return 'inf'
    if cur == N:
        return score

    nodes = paths[cur]
    for n, s in nodes:
        score += s
        return trans(n, cur, score, paths, N)


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

paths = {}
for i in range(M):
    a, b, c = map(int, input().split())
    if a in paths:
        paths[a].append((b, c))
    else:
        paths[a] = [(b, c)] 

cur_node = 1
prev_node = -1
score = trans(cur_node, prev_node, 0, paths, N)
print(score)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

def set_enable_goal(cur_node, back_paths, enable_goal):
    if cur_node in back_paths:
        for next_node in back_paths[cur_node]:
            if enable_goal[next_node - 1] == 0:
                enable_goal[next_node - 1] = 1
                set_enable_goal(next_node, back_paths, enable_goal)


N, M = map(int, input().split())
MIN = float('-inf')
INF_LIMIT = -MIN

back_paths = {}
all_paths = {}
for i in range(M):
    a, b, c = map(int, input().split())
    if a in all_paths:
        all_paths[a].append((b, c))
    else:
        all_paths[a] = [(b, c)]

    if b in back_paths:
        back_paths[b].append(a)
    else:
        back_paths[b] = [a]


# path cut
enable_goal= [0 for i in range(N)]
enable_goal[N - 1] = 1
set_enable_goal(N, back_paths, enable_goal)

for a, paths in all_paths.items():
    if not enable_goal[a - 1]:
        all_paths[a] = []
    else:
        valid_paths = []
        for b, c in paths:
            if enable_goal[b - 1]:
                valid_paths.append((b, c))
        all_paths[a] = valid_paths


scores = [MIN for i in range(N)]
scores[0] = 0

is_inf = False
for n in range(N):
    for a in all_paths.keys():
        for b, c in all_paths[a]:
            scores[b - 1] = max(scores[b - 1], scores[a - 1] + c)

# loop check
if not is_inf:
    prev_score = scores[N - 1]
    for a in all_paths.keys():
        for b, c in all_paths[a]:
            scores[b - 1] = max(scores[b - 1], scores[a - 1] + c)
    if prev_score != scores[N - 1]:
        is_inf = True


if is_inf:
    print('inf')
else:
    print(scores[N - 1])
import statistics

while True:
    n = int(input())
    if n == 0:
        break
    s = map(int, input().split())
    print(statistics.pstdev(s))

### FIXED CODE ###

while True:
    n = int(input())
    if n == 0:
        break
    s = list(map(int, input().split()))
    m = sum(s) / n
    a = sum((x - m) ** 2 for x in s) / n
    print(a ** 0.5)
from math import floor,ceil
X = int(input())

p = 100
c = 0
while cash < X:
    p=floor(p*1.01)
    c += 1
print(c)


### FIXED CODE ###

from math import floor,ceil
X = int(input())
 
p = 100
c = 0
while p < X:
    p=floor(p*1.01)
    c += 1
print(c)
from itertools import permutations
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
p=[i for i in range(1,n+1)]
np=list(permutations(p))
edge=[[] for i in range(m)]
for i in range(m):
  edge[l[i][0]-1].append(l[i][1]-1)
  edge[l[i][1]-1].append(l[i][0]-1)
ans=0
for i in range(len(np)):
  if np[i][0]!=1:
    continue
  else:
    ok=True
    for j in range(n-1):
      if np[i][j]-1 not in edge[np[i][j+1]-1]:
        ok=False
    if ok:
      ans+=1
print(ans)

### FIXED CODE ###

from itertools import permutations
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
p=[i for i in range(1,n+1)]
np=list(permutations(p))
edge=[[] for i in range(n)]
for i in range(m):
  edge[l[i][0]-1].append(l[i][1]-1)
  edge[l[i][1]-1].append(l[i][0]-1)
ans=0
for i in range(len(np)):
  if np[i][0]!=1:
    continue
  else:
    ok=True
    for j in range(n-1):
      if np[i][j]-1 not in edge[np[i][j+1]-1]:
        ok=False
    if ok:
      ans+=1
print(ans)
n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

def f(i, m):
    if m == 0:
        return True
    elif m < 0:
        return False
    elif i >= n:
        return False
    elif f(i+1, m):
        return True
    elif f(i+1, m-a[i]):
        return True
    else:
        return False

for k in m:
    print('yes' if f(0, k) else 'no')


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))
memory = [[-1 for i in range(max(m)+1)]for j in range(n)]

def f(i, m):
    if m == 0:
        return 1
    elif i >= n:
        return 0
    elif memory[i][m] != -1:
        return memory[i][m]
    elif m - a[i] >= 0:
        res0 = f(i+1, m)
        res1 = f(i+1, m-a[i])
        if res0 or res1:
            memory[i][m] = 1
            return 1
        else:
            memory[i][m] = 0
            return 0
    else:
        res = f(i+1, m)
        memory[i][m] = res
        return res

for k in m:
    print('yes' if f(0, k) else 'no')
a,b,c = map(int, input().split())
 
for i in range(c):
  if(a == 0):
  	b -= 1
    if(b == 0):
      break
  elif(a > 0):
    a -= 1
print(str(a),str(b))


### FIXED CODE ###

a,b,c = map(int, input().split())
 
print(max(0,a-c),max(0, b - max(0,c-a)))
N = int(input())
edg = [list(map(int,input().split())) for _ in range(N-1)]
vtx = [[] for _ in range(N)]
for e in edg:
    v1,v2,w = e
    vtx[v1-1].append([v2-1,w])
    vtx[v2-1].append([v1-1,w])

colors = [1 for _ in range(N)]

def dfs(vtx,i=0,p=-1,c=1): # vertex and its parent
    colors[i] = c
    for v,w in vtx[i]:
        if v == p:
            continue
        dfs(vtx,v,i,1-c if w%2 != 0 else c)
dfs(vtx)

for v in colors:
    print(v)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
N = int(input())
edg = [list(map(int,input().split())) for _ in range(N-1)]
vtx = [[] for _ in range(N)]
for e in edg:
    v1,v2,w = e
    vtx[v1-1].append([v2-1,w])
    vtx[v2-1].append([v1-1,w])

colors = [1 for _ in range(N)]

def dfs(vtx,i=0,p=-1,c=1): # vertex and its parent
    colors[i] = c
    for v,w in vtx[i]:
        if v == p:
            continue
        dfs(vtx,v,i,1-c if w%2 != 0 else c)
dfs(vtx)

for v in colors:
    print(v)
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 fractions

# 入力
A,B = map(int,input().split())

print(int((A * B) // fractions.gcd(A, B)))
#                           जय श्री राम

import sys; import math; from collections import *
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().split())
def get_list(): return list(get_ints())
def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9+7); SEXYMOD = 998244353; MAXN = int(1e5)

# sys.stdin  = open("input.txt","r"); sys.stdout = open("output.txt","w")

# for _testcases_ in range(int(input())):
start =  26
n = int(input())
ans = []
flag =  False
if n % 26 == 0:
    flag = True
while n:
    ans.append(n%26)
    n //= 26
# print(ans)
ans = ans[::-1]
if flag:
    ans [0] -= 1
    if ans[0] == 0:
        del ans[0]
for i in ans:
    if i == 0:
        i = 26
    printspx(chr(i+ord('a')-1))



'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

### FIXED CODE ###

#                           जय श्री राम

import sys; import math; from collections import *
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().split())
def get_list(): return list(get_ints())
def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9+7); SEXYMOD = 998244353; MAXN = int(1e5)

#sys.stdin  = open("input.txt","r"); sys.stdout = open("output.txt","w")

# for _testcases_ in range(int(input())):
n = input()
if n >= 'a' and n <= 'z':
    print('a')
else:
    print('A')


'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''
import sys
input = sys.stdin.readline

def make_fact_list(n, MOD):
    # make factorial list from 0 to n
    fact = [0] * (n+1)
    inv = [0] * (n+1)
    factinv = [0] * (n+1)

    fact[0]=fact[1]=1
    inv[1]=1
    factinv[0]=factinv[1]=1

    for i in range(2,n+1):
        fact[i] = fact[i-1] * i % MOD
        inv[i] = MOD - (( inv[MOD % i] *  (MOD // i)) % MOD )
        factinv[i] = factinv[i-1] * inv[i] % MOD
    
    return fact, factinv

def cbn(n, k, MOD, fact = [], factinv = []):
    if len(fact) == 0 and len(factinv) == 0:
        fact, factinv = make_fact_list(n, MOD)
    return fact[n] * factinv[n-k] * factinv[k] % MOD


MOD = pow(10, 9) + 7
x, y = list(map(int, input().split()))

if (2*x-y) % 3 != 0 or (2*y-x) % 3 != 0:
    print(0)
else:
    s = (2*x-y) // 3
    t = (2*y-x) // 3

    fact, factinv = make_fact_list(s + t, MOD)
    print(cbn(s+t, s, MOD, fact, factinv))

### FIXED CODE ###

import sys
input = sys.stdin.readline

def make_fact_list(n, MOD):
    # make factorial list from 0 to n
    fact = [0] * (n+1)
    inv = [0] * (n+1)
    factinv = [0] * (n+1)

    fact[0]=fact[1]=1
    inv[1]=1
    factinv[0]=factinv[1]=1

    for i in range(2,n+1):
        fact[i] = fact[i-1] * i % MOD
        inv[i] = MOD - (( inv[MOD % i] *  (MOD // i)) % MOD )
        factinv[i] = factinv[i-1] * inv[i] % MOD
    
    return fact, factinv

def cbn(n, k, MOD, fact = [], factinv = []):
    if len(fact) == 0 and len(factinv) == 0:
        fact, factinv = make_fact_list(n, MOD)
    return fact[n] * factinv[n-k] * factinv[k] % MOD


MOD = pow(10, 9) + 7
x, y = list(map(int, input().split()))

if (2*x-y) % 3 != 0 or (2*y-x) % 3 != 0:
    print(0)
elif (2*x-y) // 3 < 0 or (2*y-x) // 3 < 0:
    print(0)
else:
    s = (2*x-y) // 3
    t = (2*y-x) // 3

    fact, factinv = make_fact_list(s + t + 1, MOD)
    print(cbn(s+t, s, MOD, fact, factinv) % MOD)
a=[N,K,X,Y]
for i in range(0,4):
    a=a.append(input())
if N>K:
    print(K*X+(N-K)*Y)
else:
    print(N*X)

### FIXED CODE ###

N=int(input())
K=int(input())
X=int(input())
Y=int(input())
if N>K:
    print(K*X+(N-K)*Y)
else:
    print(N*X)
string=input

string=string.split(' ')
A= int(A[0])
B= int(A[1])

if A>9 or b>9:
    print(-1)
    else:
        print(A*B)



### FIXED CODE ###


string=input()
string=string.split(' ')
A= int(string[0])
B= int(string[1])

if A>9 or B>9:
    print(-1)
else:
        print(A*B)
A, B, C = map(int,input().slpit())
 
if A==B:
  print(C)
elif B==C:
  print(A)
else:
  print(B)

### FIXED CODE ###

A, B, C = map(int, input().split())
 
if A==B:
  print(C)
elif B==C:
  print(A)
else:
  print(B)
while 1:
	n,m=map(int, raw_input().split())
	if n==0:break
	c=sorted(map(int,raw_input().split()))[::-1]
	c[m-1::m] = [0 for i in range(m-1,n,m)]
	print sum(c)
	

### FIXED CODE ###

# try-except is necessary for avoiding Runtime Error 
while 1:
	try:
		n,m=map(int,raw_input().split())
		if n==0:break
		v=sorted(map(int,raw_input().split()))[::-1]
		for i in range(m-1,n,m):
			v[i]=0
		print sum(v)
	except:
		pass
if __name__ == "__main__":
    n = int(input())
    l_a = list(map(int, input().split()))
    s_a = list(set(l_a))

    s_a.sort()

    dub_a = [0]*max(s_a)

    for i in l_a:
        dub_a[i-1] += 1

    dp = [1]*max(s_a)

    for i in s_a:
        if 2*i > len(dp)-1:
            pass
        elif dp[2*i-1] == 0:
            pass
        else:
            for j in range(2*i-1, len(dp)+1, i):
                dp[j] = 0


    count = 0
    for i in l_a:
        if dp[i-1]==1 and dub_a[i-1]==1:
            count += 1
    print(count)

### FIXED CODE ###

if __name__ == "__main__":
    n = int(input())
    l_a = list(map(int, input().split()))
    s_a = list(set(l_a))

    #s_a.sort()

    dub_a = [0]*(max(s_a)+1)

    for i in l_a:
        dub_a[i] += 1

    dp = [1]*(max(s_a)+1)

    for i in s_a:
        for j in range(2*i, len(dp), i):
            dp[j] = 0


    count = 0
    for i in s_a:
        if dp[i]==1 and dub_a[i]==1:
            count += 1
    print(count)
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
	int k;
	cin >> k;
    int ans = 0;
	
	for (int i = 1; i <= k; ++i) {
		for (int j = i; j <= k; j += i) {
			ans += i;
		}
	}
	cout << ans << '\n';
	
	return 0;
}


### FIXED CODE ###

N = int(input())
ans = 0
l = [0] * (10 ** 7 + 1)
for i in range(1, N + 1):
    for j in range(i, N + 1, i):
        l[j] += 1

for i in range(1, N + 1):
    ans += i * l[i]
print(ans)
a,b=map(int,input().split())
d=a//b
r=a%b
f=float(a/b)
print("{} {} {}".format())

### FIXED CODE ###

a,b=map(int,input().split())
d=a//b
r=a%b
f=float(a/b)
print('{0} {1} {2:0.5f}'.format(d, r, f))