Harryxun/stf_run huggingface dataset:
s = input()
if s == "SUN":
    print(7)
elif s == "MON":
    pritn(6)
elif s == "TUE":
    print(5)
elif s == "WEd":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
else:
    print(1)


### FIXED CODE ###

s = input()
ans = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
print(ans[s])
import sys
S = list(input()) 
#judge =1
if S[0] != "A":
    S.insert(0,"A")
#if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4] !="A":
if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H":
    if len (S) == 4:
        S.insert(4,"A")
    elif S[4] != "A":
        S.insert(4,"A")    
else:
    print("NO")
    sys.exit()
if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4] =="A" and S[5] =="B":
    if len (S) == 6:
        S.insert(6,"A")
    elif S[6] != "A":
        S.insert(6,"A")
else:
    print("NO")
    sys.exit()
if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4] =="A" and S[5] =="B" and S[6] == "A" and S[7] == "R":
    if len (S) == 8:
        S.insert(8,"A")
    elif S[8] != "A":
        S.insert(8,"A")
else:
    print("NO")
    sys.exit()
if   S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4] =="A" and S[5] =="B" and S[6] == "A" and S[7] == "R" and S[8] == "A" and len(S) ==9:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

import sys
S = list(input()) 
#judge =1
if S[0] != "A":
    S.insert(0,"A")
#if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4] !="A":
if len(S) < 4:
    print("NO")
    sys.exit()
elif S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H":
    if len (S) == 4:
        S.insert(4,"A")
    elif S[4] != "A":
        S.insert(4,"A")    
else:
    print("NO")
    sys.exit()
if len(S) <6:
    print("NO")
    sys.exit()
elif S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4] =="A" and S[5] =="B":
    if len (S) == 6:
        S.insert(6,"A")
    elif S[6] != "A":
        S.insert(6,"A")
else:
    print("NO")
    sys.exit()
if len(S) < 8:
    print("NO")
    sys.exit()
elif S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4] =="A" and S[5] =="B" and S[6] == "A" and S[7] == "R":
    if len (S) == 8:
        S.insert(8,"A")
    elif S[8] != "A":
        S.insert(8,"A")
else:
    print("NO")
    sys.exit()
if   S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4] =="A" and S[5] =="B" and S[6] == "A" and S[7] == "R" and S[8] == "A" and len(S) ==9:
    print("YES")
else:
    print("NO")
n,m=map(int,input().split())
if abs(n-m)>=2
  ans=0
elif abs(n-m)==1:
  ans=1
  for i in range(1,n+1):
    ans=(ans*i)%(10**9+7)
  for j in range(1,m+1):
    ans=(ans*i)%(10**9+7)
else:
  ans=1
  for i in range(1,n+1):
    ans=(ans*i)%(10**9+7)
  ans=(ans**2)%(10**9+7)
print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
if abs(n-m)>=2:
  ans=0
elif abs(n-m)==1:
  ans=1
  for i in range(1,n+1):
    ans=(ans*i)%(10**9+7)
  for j in range(1,m+1):
    ans=(ans*j)%(10**9+7)
else:
  ans=1
  for i in range(1,n+1):
    ans=(ans*i)%(10**9+7)
  ans=(2*ans**2)%(10**9+7)
print(ans)
w,h,x,y=map(int,input().split())
flg=0
if w//2==x: flg+=1
if h//2==y: flg+=1
if h/w==y/x: flg+=1
if w*(y-h)==-h*x: flg+=1
print(str(w*h/2)+" "+str(1-flg%2))

### FIXED CODE ###

w,h,x,y=map(int,input().split())
flg=0
if w/2==x and h/2==y: flg=1
print(str(w*h/2)+" "+str(flg))
from math import gcd
from itertools import accumulate
def GCD(*args):
    return list(accumulate(*args,gcd))[-1]
N = int(input())
T = [int(input()) for _ in range(N)]
g = GCD(T)
ans = g
for t in T:
    ans *= t//g
print(ans)

### FIXED CODE ###

def gcd(n,m):
    if n < m:
        t = n
        n = m
        m = t
    r = n % m
    while r > 0:
        n, m = m, r
        r = n % m
    return m
N = int(input())
T = [int(input()) for _ in range(N)]
ans = T[0]
for i in range(1,N):
    g = gcd(ans,T[i])
    ans = ans*T[i]//g
print(ans)
num=input().split(" ")
a=num[0]
b=num[1]
if a+b>=24:
	print(a+b-24)
else:
	print(a+b)

### FIXED CODE ###

num=input().split(" ")
a=int(num[0])
b=int(num[1])
if a+b>=24:
	print(a+b-24)
else:
	print(a+b)
s = list(input())
s.reverse()
s = "".join(s)
before_s = s
for _ in range(10**5):
    if s[:5]=="maerd" or s[:5] =="esare":
        s = s[5:]
    elif s[:7]=="remaerd" :
        s = s[7:]
    elif s[:6] == "resare":
        s = s[6:]
    if s == "":
        ans = "YES"
        break
    if s == before_s:
        ans ="NO"
        break
print(ans)

### FIXED CODE ###

s = list(input())
s.reverse()
s = "".join(s)

for _ in range(10**5):
    before_s = s
    if s[:5]=="maerd" or s[:5] =="esare":
        s = s[5:]
    elif s[:7]=="remaerd" :
        s = s[7:]
    elif s[:6] == "resare":
        s = s[6:]
    if s == "":
        ans = "YES"
        break
    if s == before_s:
        ans ="NO"
        break
print(ans)
N = int(input())
print(0)
now = input()
old = now
che = N//2+1
nowi = 0
print(nowi+che)
nowi = N//2+1
first = True
ische = (che%2==0)
for i in range(18):
    now = input()
    if now==old:
        if che%2==0:
            pass
        elif che%2==1:
            first = not first
    elif now!=old:
        if che%2==0:
            first = not first
        elif che%2==1:
            pass
        che-=che//2+1
        nowi = nowi+che
    if first:
        print(nowi+che)
        nowi+=che
    else:
        print(nowi-che)
        nowi-=che
    old = now


### FIXED CODE ###

x,y=map(int,input().split())
if x%y==0:
    print(-1)
    exit()
print(x)
ans = "No"
foots = 2*X
for tsuru in range(X+1):
    if foots == Y:
        ans = "Yes"
    foots += 2
    
    
print(ans)

### FIXED CODE ###

X,Y = map(int, input().split())
ans = "No"
foots = 2*X
for tsuru in range(X+1):
    if foots == Y:
        ans = "Yes"
    foots += 2
    
    
print(ans)
n, k = [int(x) for x in input().split(' ')]
ab = [(input().split(' ')) for _ in range(n)]
index = 0

for a, b  in ab:
    index += int(b)
    if index >= k:
        print(a)
        breaka

### FIXED CODE ###

n, k = [int(x) for x in input().split(' ')]
ab = sorted([[int(x) for x in input().split(' ')]  for _ in range(n)])
index = 0

for a in ab:
    index += int(a[1])
    if index >= k:
        print(a[0])
        break
N = int(input())
vector_list = ([int(x) for x in input().split()])
cost_list = ([int(x) for x in input().split()])
ans = 0
for i in range(N):
  if vector_list[i]-cost_list[i]>0:
    ans += vector_list[i]-cost_list[i]

print(ans)

### FIXED CODE ###

#スペース区切りの整数の入力
A, B, T= map(int, input().split())
ans = (int(T/A))*B
print("{}".format(ans))
A = int(input())
B = int(input())
C = int(input())
T = A
A = B
B = T
print(A,B,C)
T1 = A
A = C
C = T1
print(A,B,C)

### FIXED CODE ###

a,b,c = map(int, input().split())
print(c,a,b)
from collections import deque
s = deque(input())
q = int(input())
r = 0
z = 0
to = 0
for i in range(q):
    
    try:
        t,f,c = input().split()
        if (r + int(f)) % 2 == 1:
            s.appendleft(c)
    
        else:
            s.append(c)
        r = 0
        z = 1
    except:
        if z == 0:
            pass
        else:
            r += 1
        z = 1
        to += 1
    print(s)
if to % 2 == 1:
    s = reversed(s)
print("".join(s))

### FIXED CODE ###

from collections import deque
s = deque(input())
q = int(input())
lis = [list(input().split()) for _ in range(q)]
rev = 0
z = 0

for i in lis:
    if i[0] == "2":
        if (rev + int(i[1])) % 2 == 1:
            s.appendleft(i[2])
        else:
            s.append(i[2])
        z = 1
    else:
        if z == 1:
            rev += 1
        
if rev % 2 == 1:
    s = reversed(s)
print("".join(s))
def main():
    result = 'Yes'
    S = str(input())
    for i in range(len(S)):
        if(i%2==0):#index=0は1文字目なので奇数ルール
            if(S[i]=='L'):
                result = 'No'
                break
        else:#偶数ルール
            if(S[i]=='R'):
                result = 'No'
                breakpoint
    print(result)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    result = 'Yes'
    S = str(input())
    for i in range(len(S)):
        if i % 2 == 0:
            if S[i] == 'L':
                result = 'No'
                break
        else:
            if S[i] == 'R':
                result = 'No'
                break
    print(result)

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

def getlist():
	return list(map(int, input().split()))
D = defaultdict(int)
V = []

N, K = getlist()
for i in range(N):
	t, d = getlist()
	V.append([d, t])

V = sorted(V)

ans = []
ex = []
k = 0
for i in range(N):
	x = V[-1 - i][1]
	if k < K:
		if D[x] == 0:
			ans.append(V[-1 - i])
			D[x] += 1
			k += 1
	else:
		ex.append(V[-1 - i])


if k < K:
	for i in range(K - k):
		ans.append(ex[i])
	eex = []
	for i in range(K - k, len(ex)):
		eex.append(ex[i])
else:
	eex = ex
ans = sorted(ans)
eex = sorted(eex)


A = 0
for i in range(K):
	A += ans[i][0]
A += k * k
n = min(k, N - K)
for i in range(n):
	if ans[i][0] + ((k - i) ** 2) - ((k - i - 1) ** 2) < eex[-1 - i][0]:
		A += eex[-1 - i][0] - ans[i][0] - ((k - i) ** 2) + ((k - i - 1) ** 2)
	else:
		break

print(A)

### FIXED CODE ###

from collections import defaultdict

def getlist():
	return list(map(int, input().split()))
D = defaultdict(int)
V = []

N, K = getlist()
for i in range(N):
	t, d = getlist()
	V.append([d, t])

V = sorted(V)

ans = []
ex = []
k = 0
for i in range(N):
	x = V[-1 - i][1]
	if k < K:
		if D[x] == 0:
			ans.append(V[-1 - i])
			D[x] += 1
			k += 1
		else:
			ex.append(V[-1 - i])
	else:
		ex.append(V[-1 - i])


if k < K:
	for i in range(K - k):
		ans.append(ex[i])
	eex = []
	for i in range(K - k, len(ex)):
		eex.append(ex[i])
else:
	eex = ex
ans = sorted(ans)
eex = sorted(eex)


A = 0
for i in range(K):
	A += ans[i][0]
A += k * k
n = min(k, N - K)
for i in range(n):
	if ans[i][0] + ((k - i) ** 2) - ((k - i - 1) ** 2) < eex[-1 - i][0]:
		A += eex[-1 - i][0] - ans[i][0] - ((k - i) ** 2) + ((k - i - 1) ** 2)
	else:
		break

print(A)
D = list(input().strip().split())
cons = 0
if D.count("R") >= 1:
  for i in range(3):
    if D[i] != 'R':
      cons = cons
      continue
    elif D[i] == 'R':
      cons += 1
      if D[i] == D[i + 1]:
        cons += 1
      else:
        cons = cons
      if i < 1:
        if D[i + 1] == D[i + 2]:
        cons += 1
      else:
        print(cons)
        break
elif D.count("R") < 1:
  print(0)

### FIXED CODE ###

D = input()
ans = 0
ans_list = []
if D.count("R") >= 1:
  for i in range(3):
    if D[i] == 'R':
      ans += 1
      ans_list.append(ans)
    elif D[i] == 'S':
      ss = 0
      ans_list.append(ss)
      if i > 0:
        ans = 0
  print(max(ans_list))
elif D.count("R") < 1:
  print(0)
s=input()
for i in range(len(s)):
  if i == len(s)-1:
    print('No')
    break
  if s[i]=='h':
    if s[i+1]=='i':
      if i == len(s):
        print('Yes')
        break
      else:
        if s[i+2]!='a' and s[i+2]!='i' and s[i+2]!='u' and s[i+2]!='e' and s[i+2]!='o':
              print('Yes')
              break
              

### FIXED CODE ###

s=input()
if s.count('hi')*2==len(s):
  print('Yes')
else:
  print('No')
N = int(input())

for i in 11:
    x = 1000 * i - N
    if x < 0:
        continue
    else:
        exit()
ans = x % 1000
print(ans)

### FIXED CODE ###

N = int(input())

for i in range(1,11):
    x = 1000 * i - N
    if x < 0:
        continue
    else:
        print(x)
        exit()
import math
N = int(input())
lst = []
for _ in range(N):
    lst.append(int(input()))

ans = lst[0]
for i in range(1, N):
    ans = ans * lst[i] // math.gcd(ans, lst[i])
print(ans)

### FIXED CODE ###

import fractions
N = int(input())
lst = []
for _ in range(N):
    lst.append(int(input()))

ans = lst[0]
for i in range(1, N):
    ans = ans * lst[i] // fractions.gcd(ans, lst[i])
print(ans)
m,k = list(map(int, input().split()))
a = list(map(int, input().split()))

a.sort()
ans1 = 0
ans2 = 0
for h in range(m-k+1):
    mod = 10**9+7 #出力の制限
    N = 10**4
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル

    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )

    n = (m-h-1)
    r = (k-1)
    cmb1 = cmb(n, r, mod)
    ans1 += (a[m - h - 1]) * cmb1 % mod
    ans2 += (a[h]) * cmb1 % mod

ans = (ans1 - ans2) % mod

print(ans)

### FIXED CODE ###


def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

m,k = list(map(int, input().split()))
a = list(map(int, input().split()))

a.sort()
ans1 = 0
ans2 = 0
for h in range(m-k+1):

    n = (m-h-1)
    r = (k-1)
    cmb1 = cmb(n, r, mod)
    ans1 += (a[m - h - 1]) * cmb1 % mod
    ans2 += (a[h]) * cmb1 % mod

ans = (ans1 - ans2) % mod

print(ans)
n = int(input())

c = n // 4

ans = 0

for i in range(c+1):
    d = (n - i*4) // 7
    for v in range(d+1):
        buy = i*4 + v*7
        check = buy - n
        
        if check == 0:
            ans = "Yes"
        
if ans == "Yes":
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n, k = list(map(int, input().split(" ")))
ans = n % k
if ans > 0:
    print(1)
else:
    print(0)
import numpy as a;B=a.searchsorted;a,b=loadtxt(open(0),'i',skiprows=1);c=0;l=2**29
while l:h=l;l//=2;y=sort(hstack((b%h-h,b%h)));c+=sum(B(y,h-a%h)-B(y,l-a%h))%2*l
print(c)


### FIXED CODE ###

from numpy import*;B=searchsorted;a,b=loadtxt(open(0),'i',skiprows=1);c=0;l=1<<29
while l:h,l=l,l>>1;y=sort(hstack((b%h-h,b%h)));c+=sum(B(y,h-a%h)-B(y,l-a%h))%2*l
print(c)
S=input()
K=int(input())
if len(S)<=K:
    print(S)
else:
    print(S[:K]+"...")

### FIXED CODE ###

K=int(input())
S=input()
if len(S)<=K:
    print(S)
else:
    print(S[:K]+"...")
N, M = map(int, input().split())
L, R = 1, N

import math

def merge_list(list):
    return (list[-1][0], min(map(lambda x: x[1], list)))

data = []
for i in range(0, M):
    l, r = input().split()
    data.append((int(l), int(r)))
data = sorted(data, key=lambda x: x[0])

def saiki(totyuu):
    mid = int(math.floor(len(totyuu)/2))
    if len(totyuu) < 10000:
        m1 = merge_list(totyuu[:mid])
        m2 = merge_list(totyuu[mid:])
        return merge_list(totyuu)
    else:
        return merge_list([saiki(totyuu[:mid]), saiki(totyuu[mid:])])

data = saiki(data)

print(max(0, data[1]-data[0]+1))

### FIXED CODE ###

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

Ls = []
Rs = []
for i in range(0, M):
    l, r = input().split()
    Ls.append(int(l))
    Rs.append(int(r))

maxL = max(Ls)
minR = min(Rs)
result = max(0, minR-maxL+1)

print(result)
N=int(input())
print(n*(n+1)/2)

### FIXED CODE ###

N=int(input())
print(N*(N+1)//2)
N,M=map(int,input().split())
s=0
a = [list(input().split())for i in range(N)]
for i in range(N):
    del a[i][0]
b=set(a)
print(len(b))

### FIXED CODE ###

N,M=map(int,input().split())
s=0
a = [list(input().split())for i in range(N)]
for i in range(N):
    del a[i][0]
    a[i]=set(a[i])
c=a[0]
for i in range(N):
    c=c&a[i]
print(len(c))
Sa=list(input())
Sb=list(input())
Sc=list(input())
S=Sa.pop(0)
Win=""
while(S):
  if(S=="a"):
    S=Sa.pop(0)
    Win="A"
  elif(S=="b"):
    S=Sb.pop(0)
  	Win="B"
  elif(S=="c"):
    S=Sc.pop(0)
  	Win="C"
print(Win)

### FIXED CODE ###

Sa=list(input())
Sb=list(input())
Sc=list(input())
S=Sa.pop(0)
Win="A"
while(S!=""):
  if(S=="a"):
    S=""
    if(len(Sa)!=0):
    	S=Sa.pop(0)
    Win="A"
  elif(S=="b"):
    S=""
    if(len(Sb)!=0):
	    S=Sb.pop(0)
    Win="B"
  elif(S=="c"):
    S=""
    if(len(Sc)!=0):
    	S=Sc.pop(0)
    Win="C"
print(Win)
n = int(input())
ans = [0 for i in range(1010)]
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            if x*x+y*y+z*z+x*y+y*z+z*x < 1000:
                ans[x*x+y*y+z*z+x*y+y*z+z*x-1] += 1

for i in range(n):
    print(ans[i])


### FIXED CODE ###

n = int(input())
ans = [0 for i in range(10100)]
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            if x*x+y*y+z*z+x*y+y*z+z*x < 10001:
                ans[x*x+y*y+z*z+x*y+y*z+z*x-1] += 1

for i in range(n):
    print(ans[i])
#ABC056.A
a,b = input().split()
if a == b:
    print('H')
else:
    prind('D')

### FIXED CODE ###

#ABC056.A
a,b = input().split()
if a == b:
    print('H')
else:
    print('D')
def main():
            goats =3
            n = input()
            list = [int(i) for i in input().split()]
            if (list[0]%3==0 or list[1] %3==0  or (list[0]+list[1])%3==0):
               print('Possible')
            else:
               print("Impossible")
         
         
        if __name__ == "__main__":
            main()

### FIXED CODE ###

def main():
    a, b = map(int, input().split())
    goats = 3
    if a%goats == 0 or b%goats == 0 or (a+b)%goats == 0:
        print("Possible")
    else:
        print("Impossible")


if __name__ == "__main__":
        main()
import sys
sys.setrecursionlimit(10**7)
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
S=[0 for i in range(n+1)]
for i in range(1,n+1):
    S[i]=S[i-1]+a[i-1]
List=[]
for i in range(n+1):
    for j in range(i):
        List.append(S[i]-S[j])
List.sort(reverse=True)
def program(N,K,L):
    #print(N,K,L)
    M=len(L)
    b=[bin(i)[2:][::-1] for i in L]
    X=[[] for i in range(35)]
    for i in b:
        for j in range(len(i)):
            if i[j]=="1":
                X[j].append(i)
    l=35
    for i in range(34,-1,-1):
        if len(X[i])>=K:
            l=i
            break
    if l==35:
        return 0
    #print(X[l])
    R=[]
    for i in X[l]:
        if i[:-1]=="":
            R.append(0)
            continue
        R.append(int(i[:-1][::-1],2))
    return program(len(R),K,R)+2**l
print(program(n,k,List))

### FIXED CODE ###

N,K=map(int,input().split())
a=[int(i) for i in input().split()]
S=[0 for i in range(N+1)]
for i in range(1,N+1):
    S[i]=S[i-1]+a[i-1]
List=[]
for i in range(N+1):
    for j in range(i):
        List.append(S[i]-S[j])
List.sort(reverse=True)
def program(Y,L):
    #print(L)
    M=len(L)
    t=[bin(i)[2:][::-1] for i in L]
    b=[i+"0"*(Y-len(i)) for i in t]
    X=[[] for i in range(Y)]
    for i in b:
        for j in range(Y):
            if i[j]=="1":
                X[j].append(i)
    #print("X",X)
    l=Y
    for i in range(Y-1,-1,-1):
        if len(X[i])>=K:
            l=i
            break
    if l==Y:
        return 0
    #print(X[l])
    R=[]
    for i in X[l]:
        if i[:l]=="":
            R.append(0)
            continue
        R.append(int(i[:l][::-1],2))
    R.sort(reverse=True)
    return program(l,R)+2**l
#print(K,N)
print(program(42,List))
A,B,C = map(int, input().split())

if A+B+C>=22:
  print("bust")
else:
  prit("win")

### FIXED CODE ###

A,B,C = map(int, input().split())
 
if A+B+C>=22:
      print("bust")
else:
      print("win")
n = int(input())
a = []
for i in range(n):
	x, y = map(int, input().split())
	a.append((x, y))
d = {}
if n == 1:
	print(1)
	exit()
a = sorted(a)
for i in range(n):
	tc = a[i]
	for j in range(i + 1, n):
		nd = a[j]
		x1, y1, = tc[0], tc[1]
		x2, y2, = nd[0], nd[1]
		rz1 = x1 - x2
		rz2 = y1 - y2
		d[(rz1, rz2)] = d.get((rz1,rz2), 0) + 1
print(n - max(d.values()))


### FIXED CODE ###

n, k = map(int, input().split())
if k == 1:
	print(0)
else:
	s1 = n - k
	print(s1)
H, W = map(int, input().split())
a = ["#" * (W+2), *["#" + input() + "#" for _ in range(H)], "#" * (W+2)]
print("\n".join(a))


### FIXED CODE ###

H, W = map(int, input().split())
print("#" * (W+2))
for _ in range(H):
    print("#" + input() + "#")
print("#" * (W+2))
x=range(int(input()))
f=lambda a,b,c,d : a*d - b*c 
P=[]
for _ in x:P+=[[int(i) for i in input().split()]]
_=0
P+=[P[0]]
for j in x:_+=f(P[j][0],P[j][1],,P[j+1][0]P[j+1][1])
print(_*0.5)

### FIXED CODE ###

x=range(int(input())-1,-1,-1)
P=[]
for _ in x:P+=[[int(i) for i in input().split()]]
P+=[P[0]]
for j in x:_+=P[j+1][1]*P[j][0]-P[j][1]*P[j+1][0]
print(_*0.5)
# s = input()
n = int(input())

a = list(map(int,input().split()))
a.append(10**10)
counter = 1
ans = 0
for i in range(n):
    if a[i] == a[i+1]:
        counter += 1
    else:
        if counter %2 == 0 and counter != 1 :
            ans += counter/2
        elif counte %2 != 0 and counter != 1:
            ans += int(counter/2)
        counter = 1
print(int(ans))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.append(10**10)
counter = 1
ans = 0
for i in range(n):
    if a[i] == a[i+1]:
        counter += 1
    else:
        if counter %2 == 0 and counter != 1 :
            ans += counter/2
        elif counter %2 != 0 and counter != 1:
            ans += int(counter/2)
        counter = 1
print(int(ans))
from functools import lru_cache

@lru_cache(maxsize=4092)
def get_verteces_in_subtree(vertex):
    children = tree_dictionary[vertex]
    if len(children) == 0:
        return [vertex]
    return [vertex] + sum([get_verteces_in_subtree(child) for child in children], [])

N, Q = list(map(int, input().split()))
edges = [list(map(int, input().split())) for _ in range(N-1)]
operations = [list(map(int, input().split())) for _ in range(Q)]

tree_dictionary = {i: [] for i in range(1, N+1)}
for edge in edges:
    tree_dictionary[edge[0]].append(edge[1])

counts = [0] * N
for op in operations:
    top_vertex, value = op
    added_verteces = get_verteces_in_subtree(top_vertex)
    for v in added_verteces:
        counts[v-1] += value

output = ""
for c in counts:
    output += (str(c) + " ")
output = output[:-1]
print(output)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6) #for deep recursion

N, Q = list(map(int, input().split()))
edges = [list(map(int, input().split())) for _ in range(N-1)]
operations = [list(map(int, input().split())) for _ in range(Q)]

counts = [0] * N
for op in operations:
    p, x = op
    counts[p-1] += x
    
all_connected_vertices = {i: [] for i in range(1, 1+N)}
for a, b in edges:
    all_connected_vertices[a].append(b)
    all_connected_vertices[b].append(a)
    
def dfs(point, pre):
    connected_vertices = all_connected_vertices[point]
    for c in connected_vertices:
        if c == pre:
            continue
        counts[c-1] += counts[point-1]
        dfs(c, point)
    
dfs(1, -1)
    
print(*counts)
n,k = map(int,input().split())
s = []
for i in range(k):
  l,r = map(int,input().split())
  s.append((l,r))
MOD = 998244353

memo = [-1 for _ in range(n+1)]

def f(x):
  if x < 1:
    return 0
  if x == 1:
    return 1
  if memo[x] != -1:
    return memo[x]
  res = 0
  for l,r in s:
    for i in range(l,r+1):
      res += f(x-i)
      res %= MOD
  memo[x] = res
  return res

print(f(n))


### FIXED CODE ###

# D - Leaping Tak
n,k = map(int,input().split())
lr = [tuple(map(int,input().split())) for _ in range(k)]
MOD = 998244353

# 累積和を使ってもらうdpを効率よく実現する。

dp = [0 for _ in range(n+1)]
dpsum = [0 for _ in range(n+1)]
dp[1] = 1
dpsum[1] = 1
for i in range(2,n+1):
  for li,ri in lr:
    r = i-li
    if r < 1:
      continue
    l = max(i-ri-1,0)
    dp[i] += dpsum[r]-dpsum[l]
    dp[i] %= MOD
  dpsum[i] += dpsum[i-1]+dp[i]
  dpsum[i] %= MOD
print(dp[n])
A = [input() for i in range(6)]
X = map(int, A)
a = X[0]
e = X[4]
k = X[5]
if e-a > k:
    print(":(")
else:
    print("Yay!")

### FIXED CODE ###

A = [input() for i in range(6)]
X = list(map(int, A))
a = X[0]
e = X[4]
k = X[5]
if e-a > k:
    print(":(")
else:
    print("Yay!")
n = int(input())
a = list(map(int, input().split()))
s = 1
    if 0 in a:
      print(0)
      exit()
    for i in a:
      if i >= 10 ** 8:
        print(-1)
        break
      s *= i
      if s >= 10 ** 8:
        print(-1)
        break
    else:
      print(s)


### FIXED CODE ###

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

ans = 1
for i in a :
  ans *= i
  if ans > 10**18 :
    ans = -1
    break
if 0 in a :
  ans = 0

print(ans)