Harryxun/stf_run huggingface dataset:
first_input = input().split()
x = int(first_input[0])
n = int(first_input[1])
if n != 0:
    second_input = map(int, input().split())
    p_a = list(map(int, second_input))
else:
    second_input = input()

def create_full_array(minimum, maximum):
    diff = maximum - minimum
    full_list = []
    for i in range(minimum,maximum+1):
        full_list.append(int(i))
    return full_list

if n == 0:
    print(x)
elif x > max(p_a) + 1 or x < min(p_a):
    ans = x - 1
    print(x - 1)
else:
    full_array = create_full_array(min(p_a), max(p_a))
    if x in p_a:
        target_list = list(set(p_a)^set(full_array))
        abs_key = {}
        for i in target_list:
            abs_key[i] = abs(x-i)
        minimum = min(abs_key.values())
        t_k = []
        t_v = []
        [t_k.append(k) for k, v in abs_key.items() if v == minimum]
        print(min(t_k))

    else:
        print(x)

### FIXED CODE ###

first_input = input().split()
x = int(first_input[0])
n = int(first_input[1])
if n != 0:
    second_input = map(int, input().split())
    p_a = list(map(int, second_input))
else:
    second_input = input()

def create_full_array(minimum, maximum):
    full_list = []
    for i in range(minimum,maximum+1):
        full_list.append(int(i))
    return full_list

if n == 0:
    print(x)
elif x > max(p_a) + 1 or x < min(p_a):
    ans = x - 1
    print(ans)
elif x == max(p_a) + 1:
    ans = x + 1
    print(ans)
else:
    full_array = create_full_array(min(p_a), max(p_a))
    if x in p_a:
        target_list = list(set(p_a)^set(full_array))
        abs_key = {}
        if len(target_list) == 0:
            if abs(x - min(p_a)) <= abs(x - max(p_a)):
                print(min(p_a) - 1)
            else:
                print(max(p_a) + 1)
        else:
            for i in target_list:
                abs_key[i] = abs(x-i)
            minimum = min(abs_key.values())
            t_k = []
            t_v = []
            [t_k.append(k) for k, v in abs_key.items() if v == minimum]
            print(min(t_k))

    else:
        print(x)
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def solve(ai,aj,bi,bj):
    s=pow(3,30)
    dist=abs(ai-bi)+abs(aj-bj)
    while 1:
        s//=3
        si,sj,ti,tj=ai//s,aj//s,bi//s,bj//s
        if si==sj and ti==tj:continue
        if si!=ti:return dist
        if abs(sj-tj)>1 and si%3==1:
            up=s*(si-1)-1
            down=s*si
            return min(min(ai,bi)-up,down-max(ai,bi))*2+dist

def main():
    q=II()
    for _ in range(q):
        ai,aj,bi,bj=MI1()
        if abs(ai-bi)<abs(aj-bj):ai,aj,bi,bj=bi,bj,ai,aj
        print(solve(ai,aj,bi,bj))

main()

### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def solve(ai,aj,bi,bj):
    s=pow(3,30)
    dist=abs(ai-bi)+abs(aj-bj)
    while s>1:
        s//=3
        si,sj,ti,tj=ai//s,aj//s,bi//s,bj//s
        if si!=ti:
            return dist
        if abs(sj-tj)>1 and si%3==1:
            up=s*si-1
            down=s*(si+1)
            return min(min(ai,bi)-up,down-max(ai,bi))*2+dist
    return dist

def main():
    q=II()
    for _ in range(q):
        ai,aj,bi,bj=MI1()
        if abs(ai-bi)>abs(aj-bj):ai,aj,bi,bj=aj,ai,bj,bi
        print(solve(ai,aj,bi,bj))

main()
a,b = map(int(input()))

seki = a*b

if seki % 2 == 0:
    print("Even")

elif seki % 2 == 1:
  	print("Odd")

### FIXED CODE ###

a, b = map(int, input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")
if S<=W:
    print('unsafe')
    
else:
    print('safe')

### FIXED CODE ###

S,W=map(int,input().split())

if S<=W:
    print('unsafe')
    
else:
    print('safe')
def inverse(a): #aのmodを法にした逆元を返す
    return pow(a,mod-2,mod)

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

B = []
zero = 0
pl = 0
mi = 0
for i in A:
    if i == 0:
        zero += 1
    else:
        B.append( ( abs(i) , i // abs(i) ) )
        if i < 0:
            mi += 1
        else:
            pl += 1

last_pl = None

B.sort()
B.reverse()
mod = 10**9+7

if N - zero < K:
    print (0)
    sys.exit()

if pl == 0:

    if K % 2 == 0:
        now = 1
        for i in range(K):
            now *= B[i][0]
            now = mod
        print (now % mod)
        sys.exit()
    else:
        now = 1
        if zero > 0:
            print (0)
            sys.exit()
        
        for i in range(K):
            now *= B[N-i-1][0] * B[N-i-1][1]
            now %= mod
        print (now % mod)
        sys.exit()


lasp = None
lasm = None

now = 1
for i in range(K):
    now *= B[i][0] * B[i][1]

    if now >= 0:
        now %= mod
    else:
        now = now % mod - mod

    if B[i][1] > 0:
        lasp = B[i][0]
    else:
        lasm = -1 * B[i][0]

if now > 0:
    print (now % mod)
    sys.exit()

else:

    a2 = ans * inverse(lasp)
    change2 = 1 / lasp
    for i in range(K+1,len(B)):
        if B[i][1] > 0:
            a2 *= B[i][0]
            change2 *= B[i][0]
            break
    else:
        change2 = float("-inf")

    a3 = ans * inverse(lasm % mod)
    change3 = 1 / lasm
    for i in range(K+1,len(B)):
        if B[i][1] < 0:
            a3 *= -1 * B[i][0]
            change3 *= -1 * B[i][0]
            break
    else:
        change3 = float("-inf")

    if change2 > change3:
        print (a2 % mod)
    else:
        print (a3 % mod)
    
            
    




### FIXED CODE ###


"""

https://atcoder.jp/contests/abc173/tasks/abc173_e

クソだけどやろう

正負・0を分割

0がある場合は、最大を0に更新
0がN-K個より多い場合は即終了

残りの場合は、0を取らなくても構成できる場合のみ


"""

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

pl = []
mi = []
znum = 0

if K == 1:
    print (max(A))
    sys.exit()

for i in A:
    if i > 0:
        pl.append(i)
    elif i == 0:
        znum += 1
    else:
        mi.append(i)

ans = float("-inf")
if znum > 0:
    ans = 0

#0にならざるを得ない場合を処理
if znum > N-K:
    print (ans)
    sys.exit()

#答えが負になる場合も処理する
#大きいほうからかけていけばいい
#N個の場合 or 正がない場合は負になりえない
mod = 10**9+7
pl.sort()
mi.sort()

if K == N:
    ans = 1
    for i in range(N):
        ans *= A[i]
        ans %= mod
    print (ans)
    sys.exit()

if K % 2 == 1 and len(pl) == 0:
    if znum > 0:
        ans = 0
    else:
        ans = 1
    mi.reverse()
    for i in range(K):
        ans *= mi[i]
        ans %= mod
    print (ans)
    sys.exit()

#まず、2個づつセットにすることを考える
#正負でセットにしていって、あまり同士も合成する

if K % 2 == 1:
    K -= 1
    ans = pl[-1]
    del pl[-1]
else:
    ans = 1

pl2 = []
pl.reverse()
if len(pl) % 2 == 1:
    pl.append(0)
if len(mi) % 2 == 1:
    mi.append(0)
for i in range(0,len(pl),2):
    pl2.append(pl[i] * pl[i+1])
for i in range(0,len(mi),2):
    pl2.append(mi[i] * mi[i+1])


pl2.sort()
pl2.reverse()
for i in range(K//2):
    ans *= pl2[i]
    ans %= mod
print (ans)
print('Yes' if S != 'AAA' and S != 'BBB' else 'No')

### FIXED CODE ###

S = input()
print('Yes' if S != 'AAA' and S != 'BBB' else 'No')
N = int(input())
Plist = list(map(int,input().split()))
ctr = 0
 
for i in range(1,N-2):
  if (Plist[i] > Plist[i-1]) or (Plist[i] > Plist[i+1]):
    ctr += 1
 
print(ctr)

### FIXED CODE ###

N = input()

for i in N:
  if N.count(i) != 2:
    print("No")
    exit()

print("Yes")
import math
x1,y1,x2,y2 = map(int,input().split())
print(math.sqrt((x2-x1)**2+(y2-y1)**2))



### FIXED CODE ###

import math
x1,y1,x2,y2 = map(float,input().split())
print('{0:.5f}'.format(math.sqrt((x2-x1)**2+(y2-y1)**2)))
import math

def main2():
    input()
    t = sorted(list(map(int, input().split())))
    c = math.factorial(t[-1]) // (math.factorial(t[-1] - t[len(t)//2]) * math.factorial(t[len(t)//2]))
    c2 = math.factorial(t[-1]) // (math.factorial(t[-1] - t[len(t)//2 + 1]) * math.factorial(t[len(t)//2 + 1]))
    if c < c2:
        print(t[-1], t[len(t) // 2 + 1])
    else:
        print(t[-1], t[len(t) // 2])



if __name__ == '__main__':
    main2()


### FIXED CODE ###

def main3():
    input()
    t = sorted(list(map(int, input().split())))
    ma = t.pop(-1)
    r = min(t, key=lambda x: abs(x - ma / 2))
    print(ma, r)

if __name__ == '__main__':
    main3()
import math
N = int(input())
for i range(N):
  a,t = map(int,input().split())
  if i == 0:
    x,y = a,t
  else:
    xa = math.ceil(x/a)
    yb = math.ceil(y/b)
    c = max(xa,yb)
    x,y = a*c,b*c
print(x+b)

### FIXED CODE ###

N = int(input())
for i in range(N):
  a,t = map(int,input().split())
  if i == 0:
    x,y = a,t
  else:
    xa = x//a if x%a==0 else x//a+1
    yt = y//t if y%t==0 else y//t+1
    c = max(xa,yt)
    x,y = a*c,t*c
print(x+y)
n = str(input())
if len(n) <= 2:
    print(0)
else:
    a = n[0:-2]
    tens = int(n[-2])
    need = tens*2
    ones = int(n[-1])
    if ones == 0:
    elif ones <= 5:
        need += 1
    else:
        need +=2

    if need <= int(a):
        print(1)
    else:
        print(0)


### FIXED CODE ###

n = str(input())
if len(n) <= 2:
    print(0)
else:
    a = n[0:-2]
    tens = int(n[-2])
    need = tens*2
    ones = int(n[-1])
    if ones == 0:
        need +=0
    elif ones <= 5:
        need += 1
    else:
        need +=2
    if need <= int(a):
        print(1)
    else:
        print(0)
N = int(input())

X = N / 1.08

for x in range(X-2, X+3):
    n = int(x * 1.08)
    if n == N:
        print(n)
print(':(')


### FIXED CODE ###

N = int(input())

X = int(N / 1.08)

ans = ':('
for x in range(X-5, X+6):
    n = int(x * 1.08)
    if n == N:
        ans = x
        break
print(ans)
import queue

h, w = map(int, input().split())
mat = ["#"*(w+2)]
for y in range(h):
  mat.append("#"+input()+"#")
mat.append("#"*(w+2))

d_mat1 = [[-1]*(w+2) for i in range(h+2)]
d_mat2 = [[-1]*(w+2) for i in range(h+2)]
q = queue.Queue()
for x in range(1, w+1):
  for y in range(1, h+1):
    if mat[x][y] == ".":
      start = (x, y)
      d_mat1[x][y] = 0
      break
q.put(start)

while not q.empty():
  x, y = q.get()
  d = d_mat1[x][y]
  if mat[x-1][y] == "." and d_mat1[x-1][y] == -1:
    d_mat1[x-1][y] = d+1
    q.put((x-1, y))
    
  if mat[x+1][y] == "." and d_mat1[x+1][y] == -1:
    d_mat1[x+1][y] = d+1
    q.put((x+1, y))
    
  if mat[x][y-1] == "." and d_mat1[x][y-1] == -1:
    d_mat1[x][y-1] = d+1
    q.put((x, y-1))
    
  if mat[x][y+1] == "." and d_mat1[x][y+1] == -1:
    d_mat1[x][y+1] = d+1
    q.put((x, y+1))

end = (x,y)
d_mat2[x][y] = 0
q.put(end)
while not q.empty():
  x, y = q.get()
  d = d_mat2[x][y]
  if mat[x-1][y] == "." and d_mat2[x-1][y] == -1:
    d_mat2[x-1][y] = d+1
    q.put((x-1, y))
    
  if mat[x+1][y] == "." and d_mat2[x+1][y] == -1:
    d_mat2[x+1][y] = d+1
    q.put((x+1, y))
    
  if mat[x][y-1] == "." and d_mat2[x][y-1] == -1:
    d_mat2[x][y-1] = d+1
    q.put((x, y-1))
    
  if mat[x][y+1] == "." and d_mat2[x][y+1] == -1:
    d_mat2[x][y+1] = d+1
    q.put((x, y+1))

print(d_mat2[x][y])


### FIXED CODE ###

import queue

def bfs(start):
  d_mat = [[-1]*(w+2) for i in range(h+2)]
  q.put(start)
  d_mat[start[0]][start[1]] = 0
  while not q.empty():
    x, y = q.get()
    d = d_mat[x][y]
    if mat[x-1][y] == "." and d_mat[x-1][y] == -1:
      d_mat[x-1][y] = d+1
      q.put((x-1, y))
    
    if mat[x+1][y] == "." and d_mat[x+1][y] == -1:
      d_mat[x+1][y] = d+1
      q.put((x+1, y))
    
    if mat[x][y-1] == "." and d_mat[x][y-1] == -1:
      d_mat[x][y-1] = d+1
      q.put((x, y-1))
    
    if mat[x][y+1] == "." and d_mat[x][y+1] == -1:
      d_mat[x][y+1] = d+1
      q.put((x, y+1))
  return d_mat[x][y]
h, w = map(int, input().split())
mat = ["#"*(w+2)]
for y in range(h):
  mat.append("#"+input()+"#")
mat.append("#"*(w+2))

d_mat1 = [[-1]*(w+2) for i in range(h+2)]
d_mat2 = [[-1]*(w+2) for i in range(h+2)]
q = queue.Queue()
start_list = []
flag = True
for x in range(1, w+1):
  if flag:
    for y in range(1, h+1):
      if mat[y][x] == ".":
        start = (y, x)
        start_list.append(start)
        
q.put(start)

while not q.empty():
  x, y = q.get()
  d = d_mat1[x][y]
  if mat[x-1][y] == "." and d_mat1[x-1][y] == -1:
    d_mat1[x-1][y] = d+1
    q.put((x-1, y))
    
  if mat[x+1][y] == "." and d_mat1[x+1][y] == -1:
    d_mat1[x+1][y] = d+1
    q.put((x+1, y))
    
  if mat[x][y-1] == "." and d_mat1[x][y-1] == -1:
    d_mat1[x][y-1] = d+1
    q.put((x, y-1))
    
  if mat[x][y+1] == "." and d_mat1[x][y+1] == -1:
    d_mat1[x][y+1] = d+1
    q.put((x, y+1))



print(max(list(map(bfs, start_list))))
import numpy as np
import sys
import math

N , M = map(int,input().split())
miti = [ [] for _ in range(M)]  
for m in range(M):
    a , b = map(int , input().split())
    if b-1 != 0:
        miti[a-1].append(b-1)
    if a-1 != 0:
        miti[b-1].append(a-1)
visit = [0] * N
point = [ [-1 , -1] for _ in range(N)]

def bfs():
    nextV = [0]
    visit[0] = 1
    while True:
        G = nextV
        # 次のloop用
        nextV = []
        cost = +1
        for m in G:
            # m : 現在地
            # n : 目的地

            # mから到達可能な点nを調べる
            for n in miti[m]:
                if visit[n] == 0 :
                    # first visit
                    visit[n] = 1
                    point[n][0] = m
                    point[n][1] = cost
                    # 次の探索範囲を追加
                    nextV.append(n)
                else:
                    continue
        if sum(visit) == N :
            break

def solve():
    bfs()
    print("Yes")
    for a in point[1::]:
        print(a[0]+1)

if __name__ == "__main__":
    solve()



### FIXED CODE ###

import numpy as np
import sys
import math

N , M = map(int,input().split())
miti = [ [] for _ in range(N)]
for m in range(M):
    a , b = map(int , input().split())
    if b-1 != 0:
        miti[a-1].append(b-1)
    if a-1 != 0:
        miti[b-1].append(a-1)
visit = [0] * N
point = [ -1 for _ in range(N)]

def bfs():
    nextV = [0]
    visit[0] = 1
    total = 1
    while True:
        G = nextV
        # 次のloop用
        nextV = []
        for m in G:
            # m : 現在地
            # n : 目的地

            # mから到達可能な点nを調べる
            for n in miti[m]:
                if visit[n] == 0 :
                    # first visit
                    visit[n] = 1
                    point[n] = m
                    # 次の探索範囲を追加
                    nextV.append(n)
                    total += 1
                else:
                    continue
        if total == N :
            break

def solve():
    bfs()
    print("Yes")
    for a in point[1::]:
        print(a+1)

if __name__ == "__main__":
    solve()
n, limit = map(int, input().split())
x = []
for _ in range(n):
  c, t = map(int, input().split())
  x.append((c, t))

y = min(c for c, t in x if t <= limit)
print(y)
             

### FIXED CODE ###

n, limit = map(int, input().split())
x = []
for _ in range(n):
  c, t = map(int, input().split())
  x.append((c, t))

y = min((c for c, t in x if t <= limit), default=0)
if y:
  print(y)
else:
  print('TLE')
n=int(input())
s=list(input())
a=[]
a.append(s[0])
for i in range(n):
  if s[i] != s[i+1]:
    a.append(s[l+1])
  else:
    continue
print(len(a))

### FIXED CODE ###

n=int(input())
s=list(input())
a=[]
a.append(s[0])
for i in range(n-1):
  if s[i] != s[i+1]:
    a.append(s[i+1])
  else:
    continue
print(len(a))
input = input()
A = int(input[0])
B = int(input[1])
C = int(input[2])

X = C - (A - B)
print(X)

### FIXED CODE ###

input = input().split()
A = int(input[0])
B = int(input[1])
C = int(input[2])
 
X = C - (A - B)
if X < 0: X = 0
print(X)
# coding: utf-8
from collections import defaultdict
N = int(input())
S = defaultdict(int)
for _ in range(N):
    S[input()] += 1
M = int(input())
for _ in range(M):
    S[input()] -= 1
print(max(*S.values(), 0))

### FIXED CODE ###

# coding: utf-8
N = int(input())
S = {}
for _ in range(N):
    s = input()
    if s not in S:
        S[s] = 0
    S[s] += 1
M = int(input())
for _ in range(M):
    s = input()
    if s not in S:
        S[s] = 0
    S[s] -= 1
T = list(S.values())
T.append(0)
print(max(T))
n = int(input())

l = len(str(n))
# if n < 10:
#     ans = n
# else:
ans1 = 9 * (l-1) + int(str(n)[0]) - 1
ans2 = sum([int(x) for x in list(str(n))])
ans = max(ans1, ans2)
# print(ans1, ans2)
print(ans)

### FIXED CODE ###

A, B, C, K = list(map(int, input().split()))

if K % 2 != 0:
    r = B - A
else:
    r = A - B

if abs(r) > 10 ** 18:
    print('Unfair')
else:
    print(r)
N, M = map(int, input().split())

class Union_Find:
    def __init__(self,n):
        self.parent = [i for i in range(n)]
        self.rank = [1 for i in range(n)]
    
    def find(self,x):
        if self.parent[x] == x:
            return x
        else:
            return self.find(self.parent[x])
    
    def unite(self, x, y):
        if self.rank[x] == self.rank[y]:
            self.parent[y] = x
            self.rank[x] += 1
        elif self.rank[x] > self.rank[y]:
            self.parent[y] = x
        else:
            self.parent[x] = y

uftree = Union_Find(N+1)

for i in range(M):
    x, y, _ = map(int, input().split())
    uftree.unite(x, y)

result = 0
for i in range(1, N+1):
    if uftree.find(i) == i:
        result += 1

print(result)



### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

N, M = map(int, input().split())
paths = [[] for _ in range(N)]

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

visited = [False] * N

def dfs(node, prev):
    if visited[node]:
        return
    visited[node] = True
    for n in paths[node]:
        if n != prev:
            dfs(n, node)
count = 0
for i in range(N):
    if visited[i] == False:
        count += 1
        dfs(i,-1)

print(count)
N = int(input())
a = list(map(int, input().split()))
 
ball = [0] * N
 
 
if a[-1] == 1:
        ball[-1] = 1
 
for i in reversed(range(N-1)):
        tmp = 0
        if i != 0:
                for j in range(i + (i + 1), N, i + 1):
                        #print("i j ", i , j)
                        if (j + 1) % (i + 1) == 0:
                                tmp += ball[j]
        else:
                tmp = ball(a[1:])
        #print(i+1, tmp, a[i])
        if tmp % 2 != a[i]:
                ball[i] = 1
 
#print(ball)
 
print(sum(ball))
for i in range(N):
        if ball[i] == 1:
                print(i+1, end = " ")

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
 
ball = [0] * N
 
 
if a[-1] == 1:
        ball[-1] = 1
 
for i in reversed(range(N-1)):
        tmp = 0
        if i != 0:
                for j in range(i + (i + 1), N, i + 1):
                        #print("i j ", i , j)
                        if (j + 1) % (i + 1) == 0:
                                tmp += ball[j]
        else:
                tmp = sum(ball[1:])
        #print(i+1, tmp, a[i])
        if tmp % 2 != a[i]:
                ball[i] = 1
 
#print(ball)
 
print(sum(ball))
for i in range(N):
        if ball[i] == 1:
                print(i+1, end = " ")
import sys
input = sys.stdin.readline
INF = float("inf")

def main():
    n = int(input())
    A = list(map(int, input().split()))
    color = [0] * 8
    god = 0
    for i in A:
        if i < 400:
            color['gray'] = 1
        elif i < 800:
            color['brown'] = 1
        elif i < 1200:
            color['green'] = 1
        elif i < 1600:
            color['light_blue'] = 1
        elif i < 2000:
            color['blue'] = 1
        elif i < 2400:
            color['yellow'] = 1
        elif i < 2800:
            color['orange'] = 1
        elif i < 3200:
            color['red'] = 1
        else:
            god += 1
    # print(color)
    print(len(color), len(color) + god)


if __name__ == '__main__':
    main()


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
color = [0] * 8
select = 0
for i in range(N):
    for j in range(8):
        if 400 * j <= A[i] < 400 * (j + 1):
            color[j] += 1
            break
        elif 400 * (j + 1) == 3200:
            select += 1
            break
ans = 0

for k in range(8):
    if color[k] != 0:
        ans += 1
print(max(ans, 1), ans + select)
import math

s = input().split()
a, b = int(s[0]), int(s[1])


def lcm(x, y):
    return int((x * y) / math.gcd(x, y))


print(lcm(a, b))

### FIXED CODE ###

import fractions
a,b=map(int, input().split())
f=fractions.gcd(a,b)
f2=a*b//f
print(f2)
n = int(input())

def func(x):
  if x < 2:
    return 1
  else:
    return x * func(x - 2)
  
tmp = func(n)
res = 0
while tmp % 10 == 0:
  tmp = tmp // 10
  res += 1
print(res)

### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7

def resolve():
    n = int(input())
    if n % 2 != 0:
        print(0)
        exit()
    L = n // 2
    res = 0
    while L:
        res += L // 5
        L //= 5
    print(res)

if __name__ == '__main__':
    resolve()
A,B = int(input())

A = 10
B = 9

if A * B :
    print(-1)
else:
    print(A,B)

### FIXED CODE ###

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

if a<10 and b<10:
    print(a*b)
else:
    print(-1)
n, k = list(map(int, input().split()))
x = [int(input()) for i in range(n)]
ans = [min(abs(x[i]), abs(x[i+k-1]))+x[i+k-1]-x[i] for i in range(n-k+1)]
print(min(ans))

### FIXED CODE ###

n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = [min(abs(x[i]), abs(x[i+k-1]))+x[i+k-1]-x[i] for i in range(n-k+1)]
print(min(ans))
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

if N - A.count(0) < K:
    print(0)
    exit(0)

plus = []
minus = []
for a in A:
    if a > 0:
        plus.append(a)
    elif a < 0:
        minus.append(a)
    else:
        plus.append(a)
        minus.append(a)


ans = 1
if K % 2 == 1 and len(plus) == 0:
    minus.sort(reverse=True)
    for i in range(K):
        ans *= minus[i]
        ans %= MOD
    print(ans)
    exit(0)

plus.sort(reverse=True)
minus.sort()

i = 0
j = 0

if K % 2 == 1 and len(plus) > 0:
    ans = plus[0]
    K -= 1
    plus = plus[1:]

for _ in range(K//2):
    if i+1 >= len(plus):
        ans *= (minus[j] * minus[j+1])
        ans %= MOD
        j += 2
        continue
    elif j+1 >= len(minus):
        ans *= (plus[i] * plus[i+1])
        ans %= MOD
        i += 2
        continue

    a = plus[i] * plus[i+1]
    b = minus[j] * minus[j+1]
    if a > b:
        ans *= a
        i += 2
    else:
        ans *= b
        j += 2
    ans %= MOD

print(ans)


### FIXED CODE ###

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

ans = 1
if N == K:
    for a in A:
        ans *= a
        ans %= MOD
    print(ans)
    exit(0)

if N - A.count(0) < K:
    print(0)
    exit(0)

plus = []
minus = []
for a in A:
    if a > 0:
        plus.append(a)
    else:
        minus.append(a)

if K % 2 == 1 and len(plus) == 0:
    minus.sort(reverse=True)
    for i in range(K):
        ans *= minus[i]
        ans %= MOD
    print(ans)
    exit(0)

plus.sort(reverse=True)
minus.sort()

if len(minus) == 0:
    for k in range(K):
        ans *= plus[k]
        ans %= MOD
    print(ans)
    exit(0)

i = 0
j = 0

if K % 2 == 1:
    ans = plus[0]
    K -= 1
    plus = plus[1:]

for _ in range(K//2):
    if i+1 >= len(plus):
        ans *= (minus[j] * minus[j+1])
        ans %= MOD
        j += 2
        continue
    elif j+1 >= len(minus):
        ans *= (plus[i] * plus[i+1])
        ans %= MOD
        i += 2
        continue

    a = plus[i] * plus[i+1]
    b = minus[j] * minus[j+1]
    if a > b:
        ans *= a
        i += 2
    else:
        ans *= b
        j += 2
    ans %= MOD

print(ans)