Harryxun/stf_run huggingface dataset:
import numpy as np
from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())

Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1

maze = [input() for _ in range(H)]

INF = 10 ** 12

score = np.zeros((H, W), dtype=int)
score[:, :] = INF
score[Ch, Cw] = 0

candidates = deque()
candidates.append((Ch, Cw))

walk = [(0, 1), (0, -1), (-1, 0), (1, 0)]
warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]

while candidates:
    h, w = candidates.popleft()
    # move
    for dh, dw in walk:
        y = h + dh
        x = w + dw
        s = score[h, w]
        if y < 0 or H <= y:
            continue
        if x < 0 or W <= x:
            continue        
        if maze[y][x] == '.' and score[y, x] > s:
            score[y, x] = s
            candidates.appendleft((y, x))
    # warp
    for dh, dw in warp:
        y = h + dh
        x = w + dw
        s = score[h, w]
        if y < 0 or H <= y:
            continue
        if x < 0 or W <= x:
            continue
        if maze[y][x] == '.' and score[y, x] > s + 1:
            score[y, x] = s + 1
            candidates.append((y, x))

if score[Dh, Dw] == INF:
    print(-1)
else:
    print (score[Dh, Dw])


### FIXED CODE ###

#import numpy as np
from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())

Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1

maze = [input() for _ in range(H)]

INF = 10 ** 12

score = [[INF] * W for _ in range(H)]

score[Ch][Cw] = 0

candidates = deque()
candidates.append((Ch, Cw))

walk = [(0, 1), (0, -1), (-1, 0), (1, 0)]
warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]

while candidates:
    h, w = candidates.popleft()
    # move
    for dh, dw in walk:
        y = h + dh
        x = w + dw
        s = score[h][w]
        if y < 0 or H <= y:
            continue
        if x < 0 or W <= x:
            continue        
        if maze[y][x] == '.' and score[y][x] > s:
            score[y][x] = s
            candidates.appendleft((y, x))
    # warp
    for dh, dw in warp:
        y = h + dh
        x = w + dw
        s = score[h][w]
        if y < 0 or H <= y:
            continue
        if x < 0 or W <= x:
            continue
        if maze[y][x] == '.' and score[y][x] > s + 1:
            score[y][x] = s + 1
            candidates.append((y, x))

if score[Dh][Dw] == INF:
    print(-1)
else:
    print (score[Dh][Dw])
# 9or8で埋めたやつが強い あるいはオリジナル
# 桁を一つ落として（1なら9999...）残りを9で埋める
# オリジナルはたとえば199とかのとき19が最大になる

s = input()
tmp = 0
for i in s:
    tmp += int(i)
if s[0] == "1":
    print(max(9 * (len(s) - 1), tmp))
else:
    print(int(max(s[0]) - 1 + 9 * (len(s) - 1), tmp))



### FIXED CODE ###

# 9or8で埋めたやつが強い あるいはオリジナル
# 桁を一つ落として（1なら9999...）残りを9で埋める
# オリジナルはたとえば199とかのとき19が最大になる

s = input()
tmp = 0
for i in s:
    tmp += int(i)
if s[0] == "1":
    print(max(9 * (len(s) - 1), tmp))
else:
    print(max(int(s[0]) - 1 + 9 * (len(s) - 1), tmp))
import math
a, b, x = map(int, input().split())
if x >= a**2*b/2:
  print(90 - math.degrees(math.atan(a**3/(2*a**2*b-2*x))))
else:
  print((90 - math.degrees(math.atan(2*x/(a*b**2)))))

### FIXED CODE ###

import math
a, b, x = map(int, input().split())

if x == a**2*b:
  print(0)
  
elif x >= a**2*b/2:
  print(90 - math.degrees(math.atan(a**3/(2*a**2*b-2*x))))
else:
  
  print((90 - math.degrees(math.atan(2*x/(a*b**2)))))
def main():
    l = input()
    n = len(l)
    mod = 10**9+7
    ans = 1
    for i in range(n-1):
        ans = ans*3
        ans = ans%mod
    a = 2
    for i in range(1,n):
        if l[i] == '1':
            j = n-i
            break
    for i in range(j):
        a = a*3
        a = a%mod
    print((ans+a)%mod)
    
if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    l = input()
    n = len(l)
    mod = 10**9+7
    dp1 = [0 for i in range(n)]
    dp2 = [0 for i in range(n)]
    dp1[0] = 1
    dp2[0] = 2
    for i in range(1,n):
        if l[i] == '1':
            dp2[i] = (2 * dp2[i-1])%mod
            dp1[i] = (3 * dp1[i-1] + dp2[i-1])%mod
        else:
            dp2[i] = dp2[i-1]
            dp1[i] = (3 * dp1[i-1]) % mod
    print((dp1[-1]+dp2[-1])%mod)

if __name__ == "__main__":
    main()
from collections import deque

n = int(input())
linked_list = deque([])

for i in range(n):
    line = input().split()
    cmd = line[0]

    if len(line) == 2:
        value = line[1]

    if cmd == "insert":
        linked_list.appendleft(value)
    elif cmd == "delete":
        linked_list.remove(value)
    elif cmd == "deleteFirst":
        linked_list.popleft()
    elif cmd == "deleteLast":
        linked_list.pop()

print(*linked_list)

### FIXED CODE ###


import sys
from collections import deque

n = int(sys.stdin.readline())

inputs = []

for i in range(n):
    inputs.append(sys.stdin.readline().split())

linked_list = deque([])

for line in inputs:
    cmd = line[0]

    if len(line) == 2:
        value = line[1]

    if cmd == "insert":
        linked_list.appendleft(value)
    elif cmd == "delete":
        if value in linked_list:
            linked_list.remove(value)
    elif cmd == "deleteFirst":
        linked_list.popleft()
    elif cmd == "deleteLast":
        linked_list.pop()

print(*linked_list)
N = int(input())
S = input()
e_count = S.count('E')
w_count = 0
ans = e_count

for s in S:
    if s == 'E':
        e_count -= 1
    else:
        w_count += 1
    if e_count + w_count < ans:
        e_count+w_count = ans

print(ans)

### FIXED CODE ###

N = int(input())
S = input()
e_count = S.count('E')
w_count = 0
ans = e_count

for s in S:
    if s == 'E':
        e_count -= 1
    else:
        w_count += 1
    if e_count + w_count < ans:
        ans = e_count+w_count

print(ans)
N = input()
a = N[0]
b = N[1]
c = N[2]
d = 'No'
for i in (a,b,c):
  if i % 7 == 0:
    d ='Yes'
    break
print(d)

### FIXED CODE ###

n = input()
if '7' in n :
  print('Yes')
else :
  print('No')
S=input()
length=len(S)
ans=[]
for i in range(S-2):
  num=int(S[i:i+3])
  ans.append(abs(num-753))
print(min(ans))

### FIXED CODE ###

S=input()
length=len(S)
ans=[]
for i in range(length-2):
  num=int(S[i:i+3])
  ans.append(abs(num-753))
print(min(ans))
def main():
    n = int(input())
    if n % 2 = 1:
        print(n // 2 + 1)
    else:
        print(n / 2)


if __name__ == "__main__":
    main()


### FIXED CODE ###


def main():
    n = int(input())
    if n % 2 == 1:
        print(n // 2 + 1)
    else:
        print(n // 2)


if __name__ == "__main__":
    main()
def get():
    return list(map(int, input().split()))


a = get()
b = a[0]
c = a[1]
if b < c:
    if abs(b - c) < b:
        print(abs(b - a))
    else:
        print(b)
else:
    if a[0] % a[1] == a[1] or a[0] % a[1] == 0:
        print(0)
    else:
        print(abs(a[0] % a[1] - a[1]))


### FIXED CODE ###

import sys
# 未解決(最後だけREになる)


def get():
    return list(map(int, input().split()))


a = get()
b = a[0]
c = a[1]
if b < c:
    if abs(b - c) < b:
        print(abs(b - c))
        sys.exit(0)
    else:
        print(b)
        sys.exit(0)
else:
    if a[0] % a[1] == a[1] or a[0] % a[1] == 0:
        print(0)
        sys.exit(0)
    else:
        if abs((a[0] % a[1]) - a[1]) < abs(((a[0] % a[1]) - a[1]) % a[1]):
            if abs(a[0] % a[1]) < abs((a[0] % a[1]) - a[1]):
                print(abs(a[0] % a[1]))
                sys.exit(0)
            else:
                print(abs((a[0] % a[1]) - a[1]))
                sys.exit(0)
        else:
            if abs(a[0] % a[1]) < abs(((a[0] % a[1]) - a[1]) % a[1]):
                print(abs(a[0] % a[1]))
                sys.exit(0)
            else:
                print(abs(((a[0] % a[1]) - a[1]) % a[1]))
                sys.exit(0)
N=input()
if N[0]="7" or N[1]="7" or N[2]="7":
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N=input()
if N[0]=="7" or N[1]=="7" or N[2]=="7":
    print("Yes")
else:
    print("No")
import math
n = int(input())
print(math.factorical(n) % (10**9 + 7))


### FIXED CODE ###

import math
n = int(input())
print(math.factorial(n) % (10**9 + 7))
A = int(input())
B = int(input())
if A <= 8 and B <= 8:
     print('Yay!')
else:
     print(':(')

### FIXED CODE ###

A, B = map(int, input().split())
if A <= 8 and B <= 8:
    print('Yay!')
else:
    print(':(')
N,K=map(int,input().split())

A=list(map(int,input().split()))
A.sort(reverse=True)

for _ in range(K):
    A.pop(0)


print(sum(A))

### FIXED CODE ###

from collections import deque

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

A=list(map(int,input().split()))
A.sort(reverse=True)
A=A[K:]

print(sum(A))
# C
from functools import reduce
from fractions import gcd
from functools import lru_cache

@lru_cache(None)
def lcm(a, b):
    return int(a*b/gcd(a, b))

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

result = 0
mod = reduce(lcm, a)-1

for i in range(len(a)):
    result += mod % a[i] 

print(int(result))

### FIXED CODE ###

from functools import reduce
from fractions import gcd
N, X = map(int, input().split())
x = list(map(int, input().split()))
new_list = list(map(lambda l: abs(l - X), x))
new_list.sort()
gcd = reduce(gcd, new_list)
print(gcd)
import math

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

def comb(n, r):
    if n == 0:
        return 0
    if r == 0:
        return 0

    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if N == 1 and M == 1:
    print(0)
else:
    ans = comb(N, 2) + comb(M, 2)
    print(ans)

### FIXED CODE ###

import math
 
N, M = map(int, input().split())
 
def comb(n, r):
    if n == 0:
        return 0
    if r == 0:
        return 0
    if n < 2:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
 
if N + M < 2:
    print(0)
elif N == 1 and M == 1:
    print(0)
else:
    ans = comb(N, 2) + comb(M, 2)
    print(ans)
D,T,S=map(int,input().spltit())
if D>T*S:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

d,t,s=map(int,input().split())
if s*t<d:
    print("No")
else:
    print("Yes")
A = list(map(int, open(0).read().split()))
A = [(a, a%10) for a in A]
zeros = list(filter((lambda x: x[1] == 0), A))
A = list(filter((lambda x: x[1] != 0), A))
m = min(A, key=(lambda x: x[1]))[0]
A = list(filter((lambda x: x[0] != m), A))

s = sum([z[0] for z in zeros])
for a in A:
    a = a[0]
    t = (a//10+1)*10
    s += t

print(s + m)

### FIXED CODE ###

I = ["{0:03d}".format(int(n)) for n in open(0).read().split()]
c = 0
min_z = 10
for i in I:
    x, y, z = map(int, i)
    if 0 < z < min_z:
        min_z = z
    if 0 < z:
        y +=1
    if 9 < y:
        x += 1
        y -= 10
    n = x * 100 + y * 10
    c += n

print(c+min_z-10)
s = int(input())
k = int(input())

print(s[0] if s[0] != 1 else s[1])

### FIXED CODE ###

S = input()
K = input()

#A = int(l[0])


length_1 = len(S)
K = int(K)

i =int(S)
v_1 = []
#cnt = []
while i > 0:
    v_1.append( i % 10 )
    #cnt.append(1)
    i //= 10 # 必須
v_1.reverse()

length_n = 0
target_v_num = 0

while length_n < K:
    V = v_1[target_v_num]
    length_n = length_n + 1
    if V > 1:
        length_n = length_n + K
    target_v_num = target_v_num + 1


print(V)
import sys

c={
    'S':[0]*13,
    'H':[0]*13,
    'C':[0]*13,
    'D':[0]*13
}
n=int(input())
for i in range(n):
    s,num=input().split()
    c[s][int(num)-1]=1
for i in['S','H','C','D']:
    for j in range(13):
        if c[i][j]==0:
            print(i,j+1)



### FIXED CODE ###

# -*- coding: utf-8 -*-
'import sys'
c={
    'S':[0]*13,
    'H':[0]*13,
    'C':[0]*13,
    'D':[0]*13
}
n=int(input())
for i in range(n):
    s,num=input().split()
    c[s][int(num)-1]=1
for i in["S","H","C","D"]:
    for j in range(13):
        if c[i][j]==0:
            print(i,j+1)
N, K = map(int, input().split())
A = list(map(int, input().split()))
M = 10**9 + 7

ans = 1
posA = sorted([a for a in A if a > 0])
negA = sorted([a for a in A if a < 0])
for _ in range(K // 2):
    if len(negA) < 2:
        ans = ans * posA[-1] * posA[-2] % M
        posA.pop()
        posA.pop()
        continue

    if len(posA) < 2:
        ans = ans * negA[-1] * negA[-2] % M
        negA.pop()
        negA.pop()
        continue

    p1 = negA[-1] * negA[-2]
    p2 = posA[-1] * posA[-2]
    if p1 > p2:
        ans = ans * p1 % M
        negA.pop()
        negA.pop()
    else:
        ans = ans * p2 % M
        posA.pop()
        posA.pop()

# print(ans)

if K % 2 == 1:
    if len(negA) == 0:
        ans = ans * posA[-1] % M
    elif len(posA) == 0:
        ans = ans * negA[-1] % M    
    else:
        if ans < 0:
            ans = ans * negA[-1] % M
        else:
            ans = ans * posA[-1] % M


print(ans)

### FIXED CODE ###

import numpy as np

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

def prod(X):
    ans = 1
    for x in X:
        ans = ans * x % M
    return ans

def solve():
    # Case 1: N == K
    if N == K:
        return prod(A)

    # Case 2: ans is negative
    if all(a < 0 for a in A) and K % 2 == 1:
        return prod(sorted(A)[-K:])

    # Case 3: ans is positive
    posA = np.int64(sorted([a for a in A if a >= 0]))
    negA = np.int64(sorted([a for a in A if a < 0]))

    ans = 1
    if K % 2 == 1: # Keep the largest positive
        ans = ans * posA[-1] % M
        posA = posA[:-1]
    
    # Construct largest value by pairing items
    if len(posA) % 2 == 1: # Discard the one with smallest absolute value
        posA = posA[1:]
    if len(negA) % 2 == 1: # Discard the one with smallest absolute value
        negA = negA[:-1]
    pos_pairs = posA[0::2] * posA[1::2]
    neg_pairs = negA[0::2] * negA[1::2]
    pairs = np.concatenate([pos_pairs, neg_pairs], axis=0).tolist()
    pairs = sorted(pairs, reverse=True)[:K//2]
    ans = ans * prod(pairs) % M

    return ans

print(solve())
from collections import *
def gcd(a,b):
    if a%b==0:return(b)
    else:return(gcd(b,a%b))

def soinsuu(n):
    visited=defaultdict(int)
    for i in range(2,round(n**.5)+1):
        while n%i==0:
            n//=i
            visited[i]+=1
    if n>1:
        visited[n]+=1
    return(visited)

N=int(input())
A=list(map(int,input().split()))
A=[soinsuu(a) for a in A]
visited=set()
flg=False
for a in A:
    for i in a:
        if i in visited:
            flg=True
            break
        else:
            visited.add(i)

    if flg:
        break
else:
    print("pairwise coprime")
    exit()

visited=soinsuu(A[0])
for a in A[1:]:
    for i in a:
        visited[i]-=data[i]

if [i for i in visited if visited[i]>0]:
    print("not coprime")
else:
    print("setwise coprime")


### FIXED CODE ###

from collections import *
def gcd(a,b):
    if a%b==0:return(b)
    else:return(gcd(b,a%b))

def soinsuu(n):
    visited=defaultdict(int)
    for i in range(2,round(n**.5)+1):
        while n%i==0:
            n//=i
            visited[i]+=1
    if n>1:
        visited[n]+=1
    return(visited)

N=int(input())
A=list(map(int,input().split()))
visited=set()
flg=False
for a in A:
    for i in soinsuu(a):
        if i in visited:
            flg=True
            break
        else:
            visited.add(i)

    if flg:
        break
else:
    print("pairwise coprime")
    exit()

n=A[0]
for a in A[1:]:
    n=gcd(n,a)



if n>1:
    print("not coprime")
else:
    print("setwise coprime")
n, m = map(int, input().split())
a = [list(input()) for _ in range(n)]
b = [list(input()) for _ in range(m)]

si, sj = 0, 0


while si < m:
    ni, nj = si, sj
    rest = m ** 2
    for i in range(m):
        nj = sj
        for j in range(m):
            # print(ni, nj, i, j)
            if a[ni][nj] != b[i][j]:
                break
            nj +=1
            rest -= 1
        ni += 1
    if rest == 0:
        print("Yes")
        exit()
    sj += 1
    if sj > n - m:
        si += 1
        sj = 0

print("No")
    

### FIXED CODE ###

n, m = map(int, input().split())
a = [list(input()) for _ in range(n)]
b = [list(input()) for _ in range(m)]

si, sj = 0, 0
c = 0
while si <= n - m:
    ni, nj = si, sj
    rest = m ** 2
    for i in range(m):
        nj = sj
        for j in range(m):
            # print(ni, nj, i, j)
            if a[ni][nj] != b[i][j]:
                break
            nj +=1
            rest -= 1
        ni += 1
        # print()
    if rest == 0:
        print("Yes")
        exit()
    sj += 1
    if sj > n - m:
        si += 1
        sj = 0

print("No")
n=int(raw_input())
a=[int(raw_input()) for _ in xrange(n)]
mxlba=0
for i in xrange(n):
    mxlba=max(mxlba,len(bin(a[i])[2:]))
cnt=[0]*(mxlba+5)
for i in xrange(n):
    bit=bin(a[i])[2:]
    lb=len(bit)
    for j in xrange(lb-1,-1,-1):
        if bit[j]=="1":
            cnt[lb-1-j]+=1
            break

axor=0
for i in xrange(n):
    axor^=a[i]
if axor==0:
    print(0)
    exit()
axor=bin(axor)[2:]
la=len(axor)
ans=0
i=-1
while i<la:
    i+=1
    if axor[i]=="1":
        if cnt[i]==0:
            print(-1)
            exit()
        else:
            ans+=1
            cnt[i]-=1
            if la-i-1==0:
                break
            tmp=int("1"*(la-i-1),2)
            axor=int(axor,2)^tmp
            axor=bin(axor)[2:]

print(ans)


### FIXED CODE ###

n=int(raw_input())
a=[int(raw_input()) for _ in xrange(n)]
mxlba=0
for i in xrange(n):
    mxlba=max(mxlba,len(bin(a[i])[2:]))

exist=[False]*(mxlba+1000)
for i in xrange(n):
    bit=bin(a[i])[2:]
    lb=len(bit)
    for j in xrange(lb-1,-1,-1):
        if bit[j]=="1":
            exist[lb-1-j]=True
            break

axor=0
for i in xrange(n):
    axor^=a[i]
if axor==0:
    print(0)
    exit()
axor=bin(axor)[2:]
la=len(axor)
ans=0
i=0
while i<la:
    if axor[i]=="1":
        if not exist[la-i-1]:
            print(-1)
            exit()
        else:
            ans+=1
            if la-i-1==0:
                break
            tmp=int("1"*(la-i-1),2)
            axor=int(axor,2)^tmp
            axor=bin(axor)[2:]
    i+=1

print(ans)
N = int(input())
if N<105:
    print(0)

else:
    ans = 0
    for i in range(105,N+1,2):
        temp = 0
        for j in range(1,i+1):
            if i%j == 0:
                temp +=1
        if temp == 8:
            ans += 1
print(ans)



### FIXED CODE ###

N = int(input())
if N<105:
    print(0)

else:
    ans = 0
    for i in range(105,N+1,2):
        temp = 0
        for j in range(1,i+1):
            if i%j == 0:
                temp +=1
        if temp == 8:
            ans += 1
    print(ans)
import heapq as hp
n = int(input())
a = list(map(int, input().split()))
hp.heapify(a)
b = a[-1]
che,re = [0 for i in range(b)],[]
for i in a:
    che[i-1] = 1
for i in a:
    if i in re:
        che[i-1] = 0
    else:
        re.append(i)
        c = b // i
        for j in range(2,c+1):
            che[i*j-1] = 0
print(che.count(1))


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = max(a)
che = [1 for i in range(b)]
for i in a:
    if che[i-1] == 1:
        c = b // i
        for j in range(2,c+1):
            che[i*j-1] = 0
        che[i-1] = 2
    elif che[i-1] == 2:
        che[i-1] = 0
ans = 0
for i in a:
    if che[i-1] == 2:
        ans += 1
print(ans)
S=list(input())
T=list('keyence')
A=[]
B=[]
C=[]
a=0
for i in range(len(S)):
    if S[i]==T[a]:
        A.append(i)
        a+=1
if len(A)!=7:
    print('NO')
elif len(A)==7:
    print('YES')
else:
    for i in range(0,A[len(A)-1]+1):
        B.append(i)
    for i in range(len(B)):
        if B[i] not in A:
            C.append(B[i])
    if C[len(C)-1]-C[0]==len(C)-1:
        print('YES')
    else:
        print('NO')

### FIXED CODE ###

u=str(input())
S=u.replace(' ','z')
A=[]
for i in range(len(S)+1):
    for j in range(len(S)+1):
        if i<=j:
            A.append(S.replace(S[i-1:j],'',1))
if 'keyence' in A:
    print('YES')
else:
    print('NO')
a, b, c, d = map(int, input().split())

if a<=c<=b<=d:
  print(b-c)
elif b<=a<=d<=c:
  print(d-a)
elif a<=c<=d<=b:
  print(d-c)
elif c<=a<=b<=d:
  print(b-a)
elif b=c or a=d:
  print(1)
else:
  print(0)

### FIXED CODE ###

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

t = min(b, d) - max(a, c)

print(max(0, t))
# coding:utf-8

n, y = [int(x) for x in input().split(' ')]

sen = y//1000

target = sen - n

if target < 0:
    print('-1 -1 -1')
else:
    if target % 9 % 4:
        print('-1 -1 -1')
    else:
    　iti_man = target // 9
    　go_sen = target % 9 // 4
        sen = sen - iti_man*10 - go_sen*5
        print('{} {} {}'.format(iti_man, go_sen, sen))






### FIXED CODE ###

# coding:utf-8

n, y = [int(x) for x in input().split(' ')]

max_iti_man = y // 10000

for iti_man in range(max_iti_man + 1):
    for go_sen in range(int(n) - iti_man + 1):
        itigo = 5000 * go_sen + 10000 * iti_man
        sen = n - iti_man - go_sen
        if 1000 * sen + itigo == y:
            print("{} {} {}".format(iti_man,go_sen,sen))
            exit()

print("-1 -1 -1")
#B failu
a=int(input())
b=list(map(int,input().split()))

if 0 in b:
  print(0)
  exit()
c=1
for i in b:
    c*=i
	if(c>10**18):
    	print(-1)
        exit()
     
print(c)


### FIXED CODE ###

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

if 0 in b:
  print(0)
  exit()
c=1
for i in b:
    c*=i
    if(c>10**18):
        print(-1)
        exit()
     
print(c)
s = input()

op_n = len(s) - 1

ans = 0

for i in range(1 << op_n):
  sign = [""] * op_n
  for j in range(op_n):
    if ((i>>j)&1):
      sign[j] = "+"
  formula = ""
  for k in range(op_n):
    formula += s[k] + sign[k]
  formula += s[op-n] 
  ans += eval(formula)
print(ans)  
    
      
       

### FIXED CODE ###

s = input()

op_n = len(s) - 1

ans = 0

for i in range(1 << op_n):
  sign = [""] * op_n
  for j in range(op_n):
    if ((i>>j)&1):
      sign[j] = "+"
  formula = ""
  for k in range(op_n):
    formula += s[k] + sign[k]
  formula += s[op_n] 
  ans += eval(formula)
print(ans)
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    N = int(input())

    alf = [chr(ord('a') + i) for i in range(26)]

    maxdigit = 1

    while N > 26 ** maxdigit:
        maxdigit += 1

    c = 26 ** (maxdigit - 1)

    res = ''

    for d in range(1,maxdigit+1):
        if d == maxdigit:
            res += alf[N-1]
            break
        for i in range(26):
            if N < c * (i+1):
                res += alf[i-1]
                N -= c * i
                c //= 26
                break

    print(res)



main()


### FIXED CODE ###

# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    N = int(input())

    alf = [chr(ord('a') + i) for i in range(26)]

    maxdigit = 1
    pre = 0

    while N - pre > 26 ** maxdigit:
        pre += 26 ** maxdigit
        maxdigit += 1


    # print(maxdigit,pre)

    N -= pre

    res = ''

    for d in range(1,maxdigit+1):
        for i in range(26):
            if N <= 26 ** (maxdigit - d) * (i + 1):
                res += alf[i]
                N -= 26 ** (maxdigit - d) * i
                break

    print(res)



main()
n,k=map(int,input().split())
x=list(map(int,input().split()))
for i in range(n):
  if x[i]>=0:
    zero=i
    break
if n-zero+1>k:
  mindis=x[zero+k-1]
else:
  mindis=max(x[n-1],abs(x[n-k]))+min(x[n-1],abs(x[n-k]))*2
for i in range(1,k):
  if zero+k-i-1>n:
    continue
  if zero-i<0:
    break
  under=abs(x[zero-i])
  up=x[zero+k-i-1]
  tmp=max(under,up)+min(under,up)*2
  if tmp<mindis:
    mindis=tmp
print(mindis)

### FIXED CODE ###

n,k=map(int,input().split())
x=list(map(int,input().split()))
mintime=abs(x[0])+abs(x[0]-x[n-1])
for i in range(n-k+1):
  r=abs(x[k+i-1])+abs(x[k+i-1]-x[i])
  l=abs(x[i])+abs(x[k+i-1]-x[i])
  if min(r,l)<mintime:
    mintime=min(r,l)
print(mintime)
X = int(input())
from sympy import nextprime
print(nextprime(X))

### FIXED CODE ###

import math
X = int(input())
if X ==2:
    print(2)
else:
    s = 0
    for i in range(X,10**7):
        for j in range(2,math.ceil(i ** 0.5)+1):
            if i % j ==0:
                s += 1
        if s == 0:
            print(i)
            break
        else:
            s = 0