Harryxun/stf_run huggingface dataset:
N, K, *A = map(int, open(0).read().split())
MOD = 10 ** 9 + 7

if sum(v == 0 for v in A) > N - K:
    print(0)
    exit()


if all(v <= 0 for v in A):
    x = sorted([v for v in A if v < 0])
    ans = 1
    if K % 2 == 0:
        for i in range(K):
            ans = ans * x[i] % MOD
    else:
        for i in range(N - K, N):
            ans = ans * x[i] % MOD
            
    print(ans)
    exit()


x = sorted([(abs(v), v // abs(v)) for v in A])
plus = []
minus = []
for i in range(K):
    v, s = x.pop()
    if s == 1:
        plus.append(v)
    else:
        minus.append(v)


if len(minus) % 2 != 0:
    p_cand = MOD
    m_cand = MOD
    while x:
        v, s = x.pop()
        if s == 1 and p_cand == MOD:
            p_cand = v
        elif s == -1 and m_cand == MOD:
            m_cand = v
    
    if p_cand == MOD and m_cand != MOD and plus:
        plus.pop()
        minus.append(m_cand)
    elif m_cand == MOD and p_cand != MOD and minus:
        minus.pop()
        plus.append(p_cand)
    elif p_cand != MOD and m_cand != MOD and plus and minus:
        p_val = plus.pop() * p_cand
        m_val = minus.pop() * m_cand
        
        if p_val > m_val:
            plus.append(p_val)
        else:
            minus.append(m_val)
            
ans = 1
for v in plus:
    ans = ans * v % MOD
for v in minus:
    ans = ans * v % MOD
print(ans)




### FIXED CODE ###

N, K, *A = map(int, open(0).read().split())

MOD = 10 ** 9 + 7
s = []  # v >= 0
t = []  # v < 0
for i in range(N):
    if A[i] < 0:
        t.append(A[i])
    else:
        s.append(A[i])
        
ok = False  # ans > 0
if len(s) > 0:
    if N == K:
        ok = len(t) % 2 == 0
    else:
        ok = True
else:
    ok = K % 2 == 0

ans = 1
if not ok:
    x = sorted(A, key=lambda x: abs(x))
    for i in range(K):
        ans = ans * x[i] % MOD
else:
    s.sort()
    t.sort(key=lambda x: abs(x))
    if K % 2 == 1:
        ans = ans * s.pop() % MOD
        
    p = []
    while len(s) >= 2:
        x = s.pop() * s.pop()
        p.append(x)
    
    while len(t) >= 2:
        x = t.pop() * t.pop()
        p.append(x)

    p.sort(reverse=True)
    for i in range(K // 2):
        ans = ans * p[i] % MOD
    
print(ans)
n, y = map(int, input().split())
for i in range(n):
    for j in range(n-i):
        if 10000*i+5000*j+1000*(n-i-j) == y:
            print(i,j,n-i-j)
            break()
print(-1,-1,-1)

### FIXED CODE ###

n, y = map(int, input().split())
for i in range(n+1):
    for j in range(n+1-i):
        if 10000*i+5000*j+1000*(n-i-j) == y:
            print(i,j,n-i-j)
            exit()
print(-1,-1,-1)
n, m = map(int, raw_input().split())
A = []
b = []
c = 0
 
for i in range(n):
   A += [map(int, raw_input().split())]
   for j in range(m):
      b += [input()]
      c += A[i][j] * b[j]
   print c

### FIXED CODE ###

n, m = map(int, raw_input().split())
A = []
b = []
    
for i in range(0, n):
   A += [map(int, raw_input().split())]
  
for j in range(0, m):
   b += [input()]
     
for i in range(0, n):
   c = 0
   for j in range(0, m):
      c += A[i][j] * b[j]
   print c
print(len(set(input().split()))

### FIXED CODE ###

print(len(set(input().split())))
K, X = map(int, input().split())

for i in range(2*K):
  list[i]=(X-K+1+i)
  print(*list)

### FIXED CODE ###

K, X = map(int, input().split())

for i in range(2*K-1):
  print(X-K+1+i,end=" ")
N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


for i in range(1,N+1,2):
    if(len(make_divisors(i))==8):
        cnt+=1
        
print(cnt)

### FIXED CODE ###

N = int(input())
cnt=0
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

for i in range(1,N+1,2):
    if(len(make_divisors(i))==8):
        cnt+=1
        
print(cnt)
import sys


def main():
    a, b = [int(s) for s in sys.stdin.readline().strip().split()]

    def gcd(x, y):
        while y:
            x, y = y, x % y
        return x

    def divisors(n, div, ans):
        if n == 1:
            return
        if n % div == 0:
            ans.append(div)
            divisors(n // div, div, ans)
        else:
            divisors(n, div+1, ans)

    gcd_val = gcd(a, b)
    divs = []
    divisors(gcd_val, 2, divs)

    ans = 1
    for div in sorted(list(divs)):
        if div == 1:
            continue
        if gcd_val % div == 0:
            ans += 1
            while gcd_val % div == 0:
                gcd_val = gcd_val // div
    print(ans)


main()


### FIXED CODE ###

import sys
import math

def main():
    a, b = [int(s) for s in sys.stdin.readline().strip().split()]

    def factorize(x):
        ret = set()
        for n in range(2, int(math.sqrt(x))+2):
            if x % n == 0:
                while x % n == 0:
                    x //= n
                ret.add(n)
        if x != 1:
            ret.add(x)
        return ret

    a_primes = factorize(a)
    b_primes = factorize(b)
    shared = a_primes.intersection(b_primes)
    print(len(shared) + 1)


main()
from bisect import bisect_left,bisect
import math

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

def is_ok(arg):
  L = bisect(A, arg)
  cnt = 0
  for i in range(L, N):
    p, q = divmod(A[i], arg)
    if q == 0:
      cnt += p-1
    else:
      cnt += p
  return cnt <= K

ng = -1
ok = max(A) + 1

def m_bisect(ng, ok):
  while (abs(ok - ng) > 1):
    mid = (ok + ng) // 2
    if is_ok(mid):
      ok = mid
    else:
      ng = mid
  return ok

print(m_bisect(ng, ok))

### FIXED CODE ###

from bisect import bisect_left,bisect
import math

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

m = 0
M = max(A) + 1

while M - m > 1:
  temp = (M + m) // 2
  L = bisect(A, temp)
  cnt = 0
  for i in range(L, N):
    p, q = divmod(A[i], temp)
    if q == 0:
      cnt += p-1
    else:
      cnt += p
  if cnt > K:
    m = temp
  else:
    M = temp

print(M)
N = int(input())
a = list(map(int, input().split()))

dp = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
    p = (N - l) % 2
    if p == 0:
        for l in range(N + 1 - i):
            r = l + i
            t0 = dp[l + 1][r] + a[l]
            t1 = dp[l][r - 1] + a[r - 1]
            if t0 > t1:
                dp[l][r] = t0
            else:
                dp[l][r] = t1
    else:
        for l in range(N + 1 - i):
            r = l + i
            t0 = dp[l + 1][r] - a[l]
            t1 = dp[l][r - 1] - a[r - 1]
            if t0 < t1:
                dp[l][r] = t0
            else:
                dp[l][r] = t1
print(dp[0][N])


### FIXED CODE ###

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

dp = [[0] * (N + 1) for _ in range(N + 1)]
for l in range(1, N + 1):
  for i in range(N + 1 - l):
    j = i + l
    if (N - l) % 2 == 0:
      dp[i][j] = max(dp[i + 1][j] + a[i], dp[i][j - 1] + a[j - 1])
    else:
      dp[i][j] = min(dp[i + 1][j] - a[i], dp[i][j - 1] - a[j - 1])
print(dp[0][N])
import bisect
A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [-INF] + [int(input()) for i in range(A)] + [INF]
t = [-INF] + [int(input()) for i in range(B)] + [INF]
for q in range(Q):
  x = int(input())
  b, d = min(bisect.bisect_right(s, x), A-1), min(bisect.bisect_right(t, x), B-1)
  a, c = max(b-1, 0), max(d-1, 0)
  
  res = INF
  for S in [s[b - 1], s[b]]:
    for T in [t[d - 1], t[d]]:
      d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
  	  res = min(res, d1, d2)
  	  print(res)

### FIXED CODE ###

import bisect
A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [-INF] + [int(input()) for i in range(A)] + [INF]
t = [-INF] + [int(input()) for i in range(B)] + [INF]
for q in range(Q):
    x = int(input())
    b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)

    res = INF
    for S in s[b-1:b+1]:
        for T in t[d-1:d+1]:
            d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
            res = min(res, d1, d2)
    print(res)
import sys
n,m=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
s=[[0]*(10**5+1)]
for i in l:
  if s[i[0]].append(i[1])
for i in range(len(s)):
  s[i].sort()
for i in l:
  print('{:0>6}{:0>6}'.format(str(i[0]),str(s[i[0]].index(i[1]))))

### FIXED CODE ###

import sys
import bisect
n,m=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
s=[[0] for i in range(10**5+1)]
for i in l:
  s[i[0]].append(i[1])
for i in range(len(s)):
  s[i].sort()
for i in l:
  print('{:06}{:06}'.format(i[0],bisect.bisect_left(s[i[0]],i[1])))
n = int(input())
num = list(map(int, input().split()))
limit = 10**18

num.sort()
result = A[0]

for i in num[1:]:
  result *= i
  if result > limit:
    exit()

print(result)


### FIXED CODE ###

a, b = map(int, input().split())
print(a*b)
n = int(input())
print(n * (n-1)//2)

### FIXED CODE ###

S = input()
T = input()
cnt = 0
for i in range(len(S)):
  if S[i] == T[i]:
    cnt += 1
print(cnt)
h,w=[int(j) for j in input().split()]
s=[input()for i in range(h)]
ans=0
def f(i,j,se):
    se.add((i,j))
    res=0
    b=True
    for x,y in [(1,0),(-1,0),(0,1),(0,-1)]:
        p,q=i+x,j+y
        if 0<=p<h and 0<=q<w:
            if s[p][q]!=s[i][j] and (p,q) not in se:
                b=False
                res+=f(p,q,se)
    if b:
        if s[i][j]==".":
            return 1
        else:
            return 0
    else:
        if s[i][j]==".":
            return res+1
        else:
            return res

for i in range(h):
    for j in range(w):
        if s[i][j]=="#":
            ans+=f(i,j,set())

print(ans)

### FIXED CODE ###

h,w=[int(j) for j in input().split()]
s=[input()for i in range(h)]
par=[-1 for i in range(h*w)]    #par<0なら自身が親で要素の個数、>0なら子で親の位置示す
def root(a):
    if par[a]<0:
        return a
    else:
        return root(par[a])

def size(a):
    return -par[root(a)]

def connect(a,b):
    a=root(a)
    b=root(b)
    if a==b:
        return False
    if size(a)<size(b):
        a,b=b,a
    par[a]+=par[b]
    par[b]=a
    return True

for i in range(h):
    for j in range(w):
        for x,y in [(1,0),(-1,0),(0,1),(0,-1)]:
            p,q=i+x,j+y
            if 0<=p<h and 0<=q<w:
                if s[p][q]!=s[i][j]:
                    if root(w*p+q)!=root(w*i+j):
                        connect(w*p+q,w*i+j)

from collections import Counter
c=Counter()
for i in range(h):
    for j in range(w):
        p=i*w+j
        q=root(p)
        if c[q]==0:
            c[q]=[0,0]
        if s[i][j]=="#":
            c[q][0]+=1
        else:
            c[q][1]+=1
ans=0
for i in c:
    ans+=c[i][0]*c[i][1]
print(ans)
print(input()**3)

### FIXED CODE ###

print(pow(int(input()),3))
#!/usr/bin/python3
import sys
from functools import reduce
from operator import mul
input = lambda: sys.stdin.readline().strip()
n, k = [int(x) for x in input().split()]
a = sorted((int(x) for x in input().split()), key=abs)
sgn = [0 if x == 0 else x // abs(x) for x in a]
M = 10**9 + 7
def modmul(x, y):
    return x * y % M
if reduce(mul, sgn[-k:]) >= 0:
    print(reduce(modmul, a[-k:]))
elif any(x > 0 for x in a[:n-k]):
    rem = next(i for i, x in enumerate(a[-k:]) if x < 0)
    print(next(x for x in reversed(a[:n-k]) if x > 0) * reduce(modmul, (x for i, x in enumerate(a[-k:]) if i != rem), default=1) % M)
else:
    print(reduce(modmul, a[:k]))

### FIXED CODE ###

#!/usr/bin/python3
import sys
from functools import reduce
from operator import mul
input = lambda: sys.stdin.readline().strip()
n, k = [int(x) for x in input().split()]
a = sorted((int(x) for x in input().split()), key=abs)
sgn = [0 if x == 0 else x // abs(x) for x in a]
M = 10**9 + 7
def modmul(x, y):
    return x * y % M
if reduce(mul, sgn[-k:]) >= 0:
    print(reduce(modmul, a[-k:], 1))
else:
    largest_unselected_neg = next(i for i, x in enumerate(reversed(a[:-k])) if x < 0) if any(x < 0 for x in a[:-k]) else None
    largest_unselected_pos = next(i for i, x in enumerate(reversed(a[:-k])) if x > 0) if any(x > 0 for x in a[:-k]) else None
    smallest_selected_neg = next(i for i, x in enumerate(a[-k:]) if x < 0) if any(x < 0 for x in a[-k:]) else None
    smallest_selected_pos = next(i for i, x in enumerate(a[-k:]) if x > 0) if any(x > 0 for x in a[-k:]) else None
    can1 = largest_unselected_neg is not None and smallest_selected_pos is not None
    can2 = largest_unselected_pos is not None and smallest_selected_neg is not None
    def ans1():
        return list(reversed(a[:-k]))[largest_unselected_neg] * reduce(modmul, (x for i, x in enumerate(a[-k:]) if i != smallest_selected_pos), 1) % M 
    def ans2():
        return list(reversed(a[:-k]))[largest_unselected_pos] * reduce(modmul, (x for i, x in enumerate(a[-k:]) if i != smallest_selected_neg), 1) % M
    if can1 and not can2:
        print(ans1())
    elif can2 and not can1:
        print(ans2())
    elif can1 and can2:
        if list(reversed(a[:-k]))[largest_unselected_neg] * a[-k:][smallest_selected_neg] > list(reversed(a[:-k]))[largest_unselected_pos] *  a[-k:][smallest_selected_pos]:
            print(ans1())
        else:
            print(ans2())
    else:
        print(reduce(modmul, a[:k], 1))
a, b = map(int, input().split())

print('{0} {1}'.format(a*b, 2a+2b))

### FIXED CODE ###

import fileinput

for line in fileinput.input():
  a, b = map(int, line.strip().split())

print('{0} {1}'.format(a*b, (2*a)+(2*b)))
A,B = map(int,input().split())
c=0
count=0

while(c<B):
    if(count<1):
        c+=A
        count+=1
    else:
        c+=(A-1)
        count+=1
if(B<1.2):
    count*=0
print(count)

### FIXED CODE ###

s1=list(input())
s2=list(input())
count=0
for i in range(len(s1)):
    if(s1[i]==s2[i]):
        count+=1
print(count)
a,b,c,d=map(int, input().split())
import math
n1=math.ceil(a/min(c,d))
if a<=min((c,d))*n1<=b:
    l1=(b-min((c,d))*n1)//min((c,d))+1
else: l1=0
  n2=math.ceil(a/max(c,d))
if a<=max((c,d))*n2<=b:
    l2=(b-max((c,d))*n2)//max((c,d))+1
else: l2=0
lcm=(c*d)//math.gcd(c, d)
n3=math.ceil(a/lcm)
if a<=lcm<=b:
    l3=(b-lcm)*n3//lcm+1
else: l3=0
ans=(b-a+1)-(l1+l2-l3)
print(ans)

### FIXED CODE ###

a,b,c,d=map(int,input().split())
total=b-a+1
cdead=b//c-(a-1)//c
ddead=b//d-(a-1)//d
from fractions import gcd

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

z=lcm(c,d)
cddead=b//z-(a-1)//z
print(total-cdead-ddead+cddead)
n, m = map(int, input().split())
a = [0]
b = [0]
for i in range(1, m+1):
    ta, tb = map(int, input().split())
    a.append(ta)
    b.append(tb)
dir = [[] for _ in range(m+1)]
for i in range(1, m+1):
    dir[a[i]].append(b[i])
    dir[b[i]].append(a[i])
ans = [0 for i in range(n+1)]
flag = [0 for i in range(n+1)]
flag[1] = 1
que = [1]
while len(que) != 0:
    #print('que: ', len(que), que)
    now = que.pop()
    flag[now] = 1
    for to in dir[now]:
        if flag[to] != 1 and not (to in que):
            que.append(to)
            flag[to] != 1
            ans[to] = now
"""         print(to)
        ans[to] = now
        flag[to] = 1
        for toto in dir[to]:
            if flag[toto] != 1:
                que.append(toto) """
print('Yes')
for i in range(2,n+1):
    print(ans[i])

### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
dir = [[] for _ in range(n+1)]

for i in range(m):
    ta, tb = map(int, input().split())
    dir[ta].append(tb)
    dir[tb].append(ta)

ans = [0]*(n+1)
flag = [False]*(n+1)
flag[1] = True
que = deque([1])
while que:
    #print('que: ', len(que), que)
    now = que.popleft()
    for to in dir[now]:
        if flag[to]:
            continue
        que.append(to)
        flag[to] = True
        ans[to] = now

print('Yes')
for i in range(2,n+1):
    print(ans[i])
n = int(input())
ans = 0
s = []
cnt = []
for i in range(n):
  s_ = list(str(input()))
  s_.sort()
  if s_ in s:
    cnt[s.index(s_)] += 1
  else:
    s.append(s_)
    cnt.appned(1)

print(sum(cnt))

### FIXED CODE ###

n = int(input())
s = []
cnt = {}
ans = 0
for i in range(n):
  s_ = list(str(input()))
  s_.sort()
  s_ = "".join(s_)
  if s_ in cnt:
    ans += cnt[s_]
    cnt[s_] += 1
  else:
    cnt[s_] = 1

print(ans)
for i in range(3):
  c = [input().split()]
  print(c[i])

### FIXED CODE ###

ans = ""
for i in range(3):
  c = input()
  ans += c[i]
print(ans)
n = int(input())
x = list(map(int,input().split()))
maxx = max(x)
a = []
for i in range(1,maxx):
	ans = 0
	for xx in x:
		ans += int((xx-i)**2)
	a.append(ans)
print(min(a))

### FIXED CODE ###

n = int(input())
x = list(map(int,input().split()))
maxx = max(x)
a = []
for i in range(1,maxx+1):
	ans = 0
	for xx in x:
		ans += int((xx-i)**2)
	a.append(ans)
print(min(a))
from sys import stdin
a=stdin.readline().rstrip())
x=a.count("1")
print("x")






### FIXED CODE ###

from sys import stdin
a=stdin.readline().rstrip()
x=a.count("1")
print(x)
n=int(input())
ac=0
wa=0
tle=0
re=0
for i in range(n):
  num=str(input())
  if num=="AC":
    ac+=1
  elif num=="WA":
    wa+=1
  elif num=="TLE":
    tle+=1
  else num=="RE":
    re+=1
   

print("AC ×"{}.format(ac)
print("WA ×"{}.format(wa)
print("TLE ×"{}.format(tle)
print("RE ×"{}.format(re)


### FIXED CODE ###

n=int(input())
ac=0
wa=0
tle=0
re=0
for i in range(n):
  num=str(input())
  if num=="AC":
    ac+=1
  elif num=="WA":
    wa+=1
  elif num=="TLE":
    tle+=1
  else:
    re+=1
    
print("AC x {}".format(ac))
print("WA x {}".format(wa))
print("TLE x {}".format(tle))
print("RE x {}".format(re))
# -*- coding: utf-8 -*-
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if( e - a > k):
	print(':)')
else:
	print('Yay'")

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if( e - a > k):
	print(":(")
else:
	print("Yay!")
import sys
input=sys.stdin.readline

def func(dst, src, mp):
    if len(dst) == 0: # dst が空になったら終了
        return mp
    for s in src: # 長さが一致していたら何もせず除外
        if s in dst:
            src.remove(s)
            dst.remove(s)
#            print("removed", s, src, dst, mp)
    for i in dst: # 持っているどの竹よりも短い dst には、短縮魔法を使うしかない
        if i < min(src):
            tmp = min(src)
            mp += min(src) - i
            src.remove(tmp)
            dst.remove(i)
#            print("shorten", tmp, src, dst, mp)
    # 持っている竹のうち、mp 消費が10未満で処理できるものがあれば、その中で最小のものを延長
    mi = 10
    dd = None
    ss = None
    for s in src:
        for d in dst:
            tmp = mi
            mi = min(mi, abs(d-s))
            if mi != tmp:
                dd = d
                ss = s
    if mi < 10:
        mp += dd - ss
        src.remove(ss)
        dst.remove(dd)
#        print("extend", ss, src, dst, mp)
    # 結合した時に、目標に近くなる 2 本を結合
    mi = 1000
    for s in src:
        for d in dst:
            mi = min(mi, abs(s-d))
    s1 = s2 = None
    for i in range(len(src)):
        for j in range(i+1,len(src)):
            for d in dst:
                tmp = mi
                mi = min(mi, abs(d - (src[i] + src[j])))
                if mi != tmp:
                    s1 = src[i]
                    s2 = src[j]
    if s1 != None and s2 != None:
        src.remove(s1)
        src.remove(s2)
        mp += 10
#        print("synthesize", s1, s2, src, dst,mp)
        src.append(s1+s2)
    else:
        # 結合しても意味が無い場合、最も差が小さいものを変更
        mi = 1000
        ss = None
        dd = None
        for s in src:
            for d in dst:
                tmp = mi
                mi = min(mi, abs(s-d))
                if tmp != mi:
                    ss = s
                    dd = d
        if ss != None and dd != None:
            mp += abs(s-d)
            src.remove(s)
            dst.remove(d)
    return func(dst, src, mp)

def main():
    N,A,B,C = map(int, input().split())
    T = [A,B,C]
    L = []
    for _ in range(N):
        L.append(int(input()))
    print(func(T,L,0))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input=sys.stdin.readline

def main():
    N,A,B,C = map(int, input().split())
    L = []
    for _ in range(N):
        L.append(int(input()))
    mi = 1000*N
    for i in range(4**N):
        mp = 0
        a = b = c = 0
        x = 0
#        print(bin(i) + " ", end="")
        while i > 0:
            if i%4 == 1:
                if a > 0:
                    mp += 10
                a += L[x]
            if i%4 == 2:
                if b > 0:
                    mp += 10
                b += L[x]
            if i%4 == 3:
                if c > 0:
                    mp += 10
                c += L[x]
            i >>= 2
            x += 1
        if a > 0 and b > 0 and c > 0:
            mi = min(mi, mp + abs(A-a) + abs(B-b) + abs(C-c))
#            print(a,b,c,mi)
    print(mi)

if __name__ == '__main__':
    main()
from sys import stdin
from itertools import groupby

a = ['_','.,!? ','abc','def','ghi','jkl','mno','pqrs','tuv','wxyz']
for i in input():
	b = [[i for i in j] for i,j in groupby(raw_input())]
	c = []
	d = ''
	for i in b:
		index = int(i[0])
		s = a[index][(len(i))%len(a[index])-1]
		if s == '_':
			d = d + ''.join(c)
			c = []
		else:
			c.append(s)
	if d != '':
		print d

### FIXED CODE ###

from itertools import groupby

a = ['_','.,!? ','abc','def','ghi','jkl','mno','pqrs','tuv','wxyz']
for i in xrange(input()):
	b = [[i for i in j] for i,j in groupby(raw_input())]
	c = []
	d = ''
	for i in b:
		index = int(i[0])
		s = a[index][(len(i))%len(a[index])-1]
		if s == '_':
			d = d + ''.join(c)
			c = []
		else:
			c.append(s)
	print d
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
mod=10**9+7
d=[0]*(n+1)
d[0]=1 
if a[0]==1:
  d[1]=0
else:
  d[1]=1
for i in range(2,n+1):
  if i not in a:
    d[i]=(d[i-1]+d[i-2])%mod
print(d[n])

### FIXED CODE ###

n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
mod=10**9+7
d=[mod]*(n+1)
d[0]=1;d[1]=1
for i in a:
  d[i]=0
for i in range(2,n+1):
  d[i]=min(d[i],(d[i-1]+d[i-2])%mod)
print(d[n])
print(sum([i for i in (list(range(1,int(input())+1)) if i % 3 != 0 and i % 5 != 0]))


### FIXED CODE ###

n=int(input())
n=list(range(1,n+1))
n=([i for i in n if i % 3 != 0])
n=([i for i in n if i % 5 != 0])
print(sum(n))
MOD = 10**9+7
n,m = map(int,input().split())

f = [1,1]
for i in range(2, n):
    f.append(f[i-2]+f[i-1])

cur = 0
ans = 1
for i in range(m):
    a = int(input())
    if a==cur:
        print(0)
        exit(0)
    ans *= f[a-cur-1]
    ans %= MOD
    cur = a+1
ans *= f[n-cur]
ans %= MOD
print(ans)


### FIXED CODE ###

MOD = 10**9+7
n,m = map(int,input().split())

f = [1,1]
for i in range(2, n+1):
    f.append(f[i-2]+f[i-1])

cur = 0
ans = 1
for i in range(m):
    a = int(input())
    if a==cur:
        print(0)
        break
    ans *= f[a-cur-1]
    ans %= MOD
    cur = a+1
else:
    ans *= f[n-cur]
    ans %= MOD
    print(ans)
import bisect
from functools import lru_cache

@lru_cache(maxsize=None)

def kaijou(n):
    if n <= 1:
        return 1
    return kaijou(n-1)*n

def comb(n,r):
    return kaijou(n)/kaijou(r)/kaijou(n-r)

n = input()
A = list(map(int,input().split()))
A.sort()
m = A[-1]
i = bisect.bisect_left(A,m//2)
if i == 0:
    if comb(m,A[i]) >= comb(m,A[i+1]):
        print(m,A[i])
    else:
        print(m,A[i+1])
else:
    if comb(m,A[i-1]) >= comb(m,A[i]):
        print(m,A[i-1])
    else:
        print(m,A[i])

### FIXED CODE ###

import sys
import bisect
n = int(input())
A = list(map(int,input().split()))
A.sort()
m = A[-1]
if n == 2:
    print(A[-1],A[0])
    sys.exit()
i = bisect.bisect_left(A,m//2)
if i == 0:
    print(m,A[0])
else:
    if m - A[i] < A[i-1]:
        print(m,A[i-1])
    else:
        print(m,A[i])
import fractions

N = int(input())
T = [int(input()) for _ in range(N)]

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

ans = T[0]

for i in range(1, N):
    ans = lcm(ans, T[i])

print(ans)


### FIXED CODE ###

import fractions

N = int(input())
T = [int(input()) for _ in range(N)]

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

ans = T[0]

for i in range(1, N):
    ans = lcm(ans, T[i])

print(ans)