Harryxun/stf_run huggingface dataset:
a,b,c,d,e,f=map(int,input().split())

DP=[[0,0] for _ in range(f+100)]
DP[a*100][0]=a*100
DP[b*100][0]=b*100

for i in range(f+1):
    if DP[i][0]==0:continue
    for j in a,b:
        if i+j*100<=f:
            j *=100
            if DP[i][1]*100/(i+j)>=DP[i+j][1]*100/(i+j):
                DP[i+j]=[i+j,DP[i][1]]
    for j in c,d:
        if i+j<=f:
            if 100*(DP[i][1]+j)/(i+j)<=100*e/(100+e):
                if 100*(DP[i][1]+j)/(i+j)>=100*(DP[i+j][1])/(i+j):
                    DP[i+j]=[i+j,DP[i][1]+j]

ans,water=0,[a*100,0]
for x,y in DP:
    if x==0:continue
    if 100*y/x>ans:
        ans=100*y/x
        water=[x,y]
print(*water)

### FIXED CODE ###

inf=10**8
a,b,c,d,e,f=map(int,input().split())
a,b=100*a,100*b
DP=[inf]*(f+max(a,b)+1)
DP[a],DP[b]=0,0

for i in range(f+1):
    if DP[i]!=inf:
        DP[i+a]=DP[i]
        DP[i+b]=DP[i]
        for j in c,d:
            if 100*(DP[i]+j)/(i+j)<=100*e/(100+e):
                DP[i+j]=max(DP[i],DP[i]+j)

ans,index=0,[a,0]
for i in range(f+1):
    if DP[i]!=inf:
        if ans<100*DP[i]/i:
            ans=100*DP[i]/i
            index=[i,DP[i]]

print(*index)
# -*- coding: utf-8 -*-

import sys

n = int(raw_input().split()[0])
tl = []
for i in range(n):
    e = [int(e) for e in raw_input().split()]
    tl.append(e)
#print tl

t = 0
x = 0
y = 0
ans = 'Yes'
for i in tl:
    ti, xi, yi = i
    dt = ti - t
    dx = abs(xi - x)
    dy = abs(yi - y)
    # print [t,x,y], i, [dt,dx,dy],
    if (dx + dy) > dt:
        # print '!',
        ans = 'No'
        break
    if (dt - (dx + dy)) & 1:
        # print '!!',
        ans = 'No'
        break
    # print
    t = ti
    x = xi
    y = yi
    
# print
sys.stdout.write('%s\n' % (ans))
sys.stdout.flush()


### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys

u"""
1023回全て check
"""

def ones(n):
    o = 0
    for i in xrange(0, 10):
        b = 1 << i
        if n & b:
            o += 1
    return o

n = int(raw_input().split()[0])
# print n

openL = []
for _ in xrange(0, n):
    fs = ''.join( [e for e in raw_input().split()] )
    openL.append( int(fs, base=2) )
    
profL = []
for _ in xrange(0, n):
    profL.append( [int(e) for e in raw_input().split()] )

# print n
# print [hex(e) for e in openL]
# print profL, len(profL[0])

# print ones(0), ones(0x3ff)

maxP = -sys.maxint - 1
for i in xrange(1, 1024):
    p = 0
    for x in xrange(0, len(openL)):
        ox = openL[x]
        px = profL[x]
        p += px[ ones(ox & i) ]

    if p > maxP:
        maxP = p
    
sys.stdout.write('%d\n' % maxP)
sys.stdout.flush()
from sys import stdin

b = int(stdin.readline().rstrip()))

if b == 'A':
    print('T')
if b == 'T':
    print('A')
if b == 'G':
    print('C')
if b == 'C':
    print('G')


### FIXED CODE ###

from sys import stdin

b = stdin.readline().rstrip()

if b == 'A':
    print('T')
if b == 'T':
    print('A')
if b == 'G':
    print('C')
if b == 'C':
    print('G')
N,M,K = list(map(int,input().split()))

# DFSテンプレ、計算量=O(N+M)
# N:頂点の数
# M:辺の数

G = [[] for _ in range(N)]
# print(G)
# graphの入力
for _ in range(M):
    a,b = list(map(int,input().split()))
    G[a-1].append(b-1)
    G[b-1].append(a-1)
# print(G)

KG = [[] for _ in range(N)]
# block graphの入力
for _ in range(K):
    a,b = list(map(int,input().split()))
    KG[a-1].append(b-1)
    KG[b-1].append(a-1)
# print(KG)

def dfs(G,v):
    global l
    # nを訪問済みにする
    seen[v] = 1
    l += 1
    # print(v+1)
    seenV.append(v)
    # vから行ける各頂点next_vについて
    for next_v in G[v]:
        if seen[next_v] == 1:
            continue
        else:
            dfs(G,next_v)

Adj_size = [0]*N
# 全頂点を未訪問に初期化。
Adj = [0]*N
seen = [0]*N
Y = []
for v in range(N):
    l = 0
    seenV = []
    if seen[v] == 0:
        dfs(G,v)
        # print("dfs done !!!")
    # print("v=",v+1,"seen:",seen)
    # print("l=",l)
    # print(seenV)
    for v in seenV:
        Adj_size[v] = l
        Adj[v] = seenV
    # print(Adj_size)
    
    # 出力
    y = Adj_size[v] - len(G[v])-1
    for k in KG[v]:
        if k in Adj[v]:
            y += -1
    # print("v=",v+1,"y=",y)
    Y.append(str(y))
"""
print(Adj)
print("Y",Y)
print("G",G)
"""
print(" ".join(Y))



### FIXED CODE ###

def find(x):
    if par[x]<0:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
 
def unite(x,y):
  x,y=find(x),find(y)
  if x!=y:
    if x>y:
        x,y=y,x
    par[x]+=par[y]
    par[y]=x
    
def same(x,y):
  return find(x)==find(y)
 
def size(x):
  return-par[find(x)]
 
N,M,K = map(int,input().split())
par=[-1]*N
B = [set() for _ in range(N)]
FF = [0]*N
for _ in range(M):
    a,b = map(int,input().split())
    unite(a-1,b-1)
    FF[a-1] += 1
    FF[b-1] += 1
# print(F)
for j in range(K):
    a,b = map(int,input().split())
    B[a-1].add(b-1)
    B[b-1].add(a-1)

Y = []
for i in range(N):
    y = size(i) - FF[i] -1
    for b in B[i]:
        if same(i,b):
            y += -1
    Y.append(str(y))
print(" ".join(Y))
a,b,c,d=map(int,input().split())
print("Left" if a+b>c+d else "Balanced" if a+b=c+d else "Right")

### FIXED CODE ###

a,b,c,d=map(int,input().split())
print("Left" if a+b>c+d else "Balanced" if a+b==c+d else "Right")
from math import factorial as f
f_1,f_2=0,0
if N>1:
    f_1=f(N)/(f(2)*f(N-2))
if M>1:
    f_2=f(M)/(f(2)*f(M-2))
print(int(f_1+f_2))

### FIXED CODE ###

N,M=list(map(int,input().split()))
from math import factorial as f
f_1,f_2=0,0
if N>1:
    f_1=f(N)/(f(2)*f(N-2))
if M>1:
    f_2=f(M)/(f(2)*f(M-2))
print(int(f_1+f_2))
def main():
    N,M = map(int, input().split())
    x = ["0"]*N
    for _ in range(M):
        s,c = input().split()
        # 左からsけた目がc
        x[int(s)-1] = c
        if s==1 and c==0:
            hfixed=True
    if N==1:
        print("".join(x))
    else:
        if x[0]=="0":
            if hfixed:
                print("-1")
            else:
                x[0] = "0"
                print("".join(x))
        else:
            print("".join(x))

main()


### FIXED CODE ###

def main():
    N,M = map(int, input().split())
    x = ["0"]*N
    hfixed = [False]*N
    flag = False
    for _ in range(M):
        s,c = input().split()
        # 左からsけた目がc
        idx = int(s)-1
        if hfixed[idx] and x[idx]!=c:
            flag = True
            break
        else:
            hfixed[idx] = True
            x[idx] = c

    if flag:
        print("-1")
    else:
        if N==1:
            print("".join(x))
        else:
            if x[0]=="0":
                if hfixed[0]:
                    print("-1")
                else:
                    x[0] = "1"
                    print("".join(x))
            else:
                print("".join(x))

main()
n=int(input())
dict={}
a=list(map(int,input().split()))
for i in a:
  if i not in dict:
    dict[i]=1
  else:
    dict[i]+=1
q=int(input())
for i in range(q):
  b,c=map(int,input().split())
  ans=0
  if c in dict:
    dict[c]+=dict[b]
  else:
    dict[c]=dict[b]
  dict[b]=0
  ans=0
  for j in dict:
    ans+=dict[j]*j
  print(ans)

### FIXED CODE ###

import collections
n = int(input())
a = list(map(int, input().split()))
count = collections.Counter(a)
q = int(input())
s = sum(a)

for i in range(q):
  b, c = map(int, input().split())
  s = s - (b - c) * count[b]
  
  count[c] += count[b]
  count[b] = 0
  print(s)
N, M = map(int, input().split())
from collections import defaultdict, Counter
dd=defaultdict(int)
dd_count=defaultdict(int)
Flag=False #s=1 and c=0となる値があるかどうか
for _ in range(M):
	s, c = map(int, input().split())

	if N>=2 and s==1 and c==0:
		Flag=Trye

	#異なるものが2個以上ある
	if dd_count[s-1]>=1 and dd[s-1]!=c:
		exit(print(-1))
	else:
		dd[s-1]=c
		dd_count[s-1]+=1
	
if N>=2 and not Flag:
	ans=10**(N-1)
	for i in range(1,N):
		ans+=dd[i]*10**(N-i-1)
	print(int(ans))

elif N>=2 and dd[0]==0:
	exit(print(-1))
else:
	ans=0
	for i in range(N):
		ans+=dd[i]*10**(N-i-1)
	print(int(ans))


### FIXED CODE ###

N, M = map(int, input().split())
from collections import defaultdict, Counter
dd=defaultdict(int)
dd_count=defaultdict(int)
Flag=False #s=1 and c=0となる値があるかどうか
for _ in range(M):
	s, c = map(int, input().split())

	if N>=2 and s==1 and c==0:
		Flag=True

	#異なるものが2個以上ある
	if dd_count[s-1]>=1 and dd[s-1]!=c:
		exit(print(-1))
	else:
		dd[s-1]=c
		dd_count[s-1]+=1
	
if N>=2 and dd[0]==0 and not Flag:
	ans=10**(N-1)
	for i in range(1,N):
		ans+=dd[i]*10**(N-i-1)
	exit(print(ans))

if N>=2 and Flag:
	exit(print(-1))
else:
	ans=0
	for i in range(N):
		ans+=dd[i]*10**(N-i-1)
	print(int(ans))
# from scipy.special import comb
from scipy.misc import comb
n, k = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
a = sorted(a)
max_a = 0
for i in range(k - 1, n):
    max_a += a[i] * comb(i, k - 1)
min_a = 0
for i in range(n - k + 1):
    min_a += a[i] * comb(n - i - 1, k - 1)
print(int((max_a - min_a) % 1000000007))

### FIXED CODE ###

n, k = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
a = sorted(a)
fact = [1]
for i in range(1, n + 1):
    fact.append(fact[-1] * i % 1000000007)
max_a = 0
for i in range(k - 1, n):
    max_a += a[i] * fact[i] * pow(fact[i - k + 1], 1000000005, 1000000007) * pow(fact[k - 1], 1000000005, 1000000007) % 1000000007
a = a[::-1]
min_a = 0
for i in range(k - 1, n):
    min_a += a[i] * fact[i] * pow(fact[i - k + 1], 1000000005, 1000000007) * pow(fact[k - 1], 1000000005, 1000000007) % 1000000007
print(int((max_a - min_a) % 1000000007))
from collections import deque 
import math
n, d, a = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
l.sort(key = lambda x:x[0])
cnt = 0
queue = deque()
sum_bomb = 0
for i in range(n):
    while len(queue) != 0 and queue[0][0]<l[i][0]:
        sum_bomb -= queue[0][1] * a
        queue.popleft()
    l[i][1] -= sum_bomb
    if l[i][1] <= 0 :
        continue
    num = math.ceil(l[i][1]/a)
    right = l[i][0] + 2 * d
    queue.append([right, num])
    cnt += num
    sum_bomb += num * a
print(cnt)


### FIXED CODE ###

h, a = map(int, input().split())
print(h//a+1 if h%a!=0 else h//a)
N = input()
num = [int(i) for i in input().split()]

count = 0
end=False
while(True):
	div = []
	for i in num:
		if(i % 2 == 0):
			div.append(i/2)
		else:
			print(count)
			end = True
            break
	if(end == True):
		break
	num = div
	count = count + 1


### FIXED CODE ###

n = input()
num = [int(i) for i in input().split()]
count = 0
end=False
while(True):
	div = []
	for i in num:
		if(i % 2 == 0):
			div.append(i/2)
		else:
			print(count)
			end = True
			break
	if(end == True):
		break
	num = div
	count = count + 1
n = int(input())
base = 10
ans = 0
if n%2 != 0:
  print(0)
else:
  for i in range(1,10000)
    ans += n//base
    base *= 5   
  print(ans)

### FIXED CODE ###

n = int(input())
base = 10
ans = 0
 
if n%2 == 1:
  print(0)
else:
  for i in range(1,100):
    ans += n//base    
    base *= 5   
  print(ans)
a, b, k = map(int, input().split())
da = []
db = []
dc = []
for i in range(1,a+1):
    if a%i == 0:
    	da.append(i)

for j in range(1, b+1):
    if b%j == 0:
    	db.append(j)

for k in da:
    if k in db:
    	dc.append(k)

if dc:
    dc.sort(reverse = True)
    print(dc[k-1])

else:
    print(0)

### FIXED CODE ###

a, b, k = map(int, input().split())
da = []
db = []
dc = []
for i in range(1,a+1):
    if a%i == 0:
    	da.append(i)

for j in range(1, b+1):
    if b%j == 0:
    	db.append(j)

for l in da:
    if l in db:
    	dc.append(l)

dc.sort(reverse = True)
print(dc[k-1])
n = int(input())
lst = list()

while True:
  a, b = divmod(n, 26)
  n = a
  lst.append(b)
  if a == 0:
    break

for i in range(len(lst)):
  if lst[i] <= 0:
    lst[i] += 26
    lst[i + 1] -= 1

if lst[-1] == 0:
  lst.pop()

for i in range(len(lst)):
  lst[i] = chr(lst[i] + 96)

print("".join(lst[::-1]))

### FIXED CODE ###

n = int(input())
lst = list()
 
while True:
  a, b = divmod(n, 26)
  n = a
  lst.append(b)
  if a == 0:
    break
 
for i in range(len(lst) - 1):
  if lst[i] <= 0:
    lst[i] += 26
    lst[i + 1] -= 1
 
if lst[-1] == 0:
  lst.pop()
 
for i in range(len(lst)):
  lst[i] = chr(lst[i] + 96)
 
print("".join(lst[::-1]))
import numpy as np

s = list(input())
t = list(input())

i = 0
if len(s) != len(t):
    print("No")
else:
    while True:
        s = np.roll(s,-1)
        i += 1
        if s == t:
            print("Yes")
            break
        elif i >= len(s):
            print("No")
            break


### FIXED CODE ###

import numpy as np

s = list(input())
t = list(input())

i = 0
while True:
    s = list(np.roll(s,-1))
    i += 1
    if s == t:
        print("Yes")
        break
    elif i >= len(s):
        print("No")
        break
N, M = map(int, input().split(" "))
AB = [list(map(int, input().split(" "))) for _ in range(M)]


class UnionFind:
    def __init__(self, n):
        self.n = n
        self.per = list(range(n))
        self.point = n*(n-1) // 2
        self.counts = [1]*n

    def root(self, x):
        if self.per[x] == x:
            return x
        return self.root(self.per[x])

    def union(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return False
        self.per[rx] = ry
        self.point -= self.counts[ry] * self.counts[rx]
        self.counts[ry] += self.counts[rx]
        self.counts[rx] = 0

    def is_same(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        return rx == ry


u = UnionFind(N)
results = []
for a, b in AB[::-1]:
    results.append(u.point)
    x, y = a-1, b-1
    u.union(x, y)

print(*results[::-1])
# for r in results[::-1]:
#     print(r)


### FIXED CODE ###

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


class UnionFind:
    def __init__(self, n):
        self.par = [-1]*n
        self.size = [1]*n
        self.point = n*(n-1) // 2

    def root(self, x):
        if self.par[x] < 0:
            return x
        self.par[x] = self.root(self.par[x])
        return self.par[x]

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return False
        if self.size[rx] < self.size[ry]:
            rx, ry = ry, rx
        self.point -= self.size[rx]*self.size[ry]
        self.size[rx] += self.size[ry]
        self.par[ry] = rx
        return True

    def is_same(self, x, y):
        rx, ry = self.root(x), self.root(y)
        return rx == ry

    def get_size(self, x):
        return self.size[self.root(x)]


uf = UnionFind(N)
results = []
for a, b in AB[::-1]:
    results.append(uf.point)
    x, y = a-1, b-1
    uf.unite(x, y)

print(*results[::-1], sep="\n")
N,K = map(int,input().split())
para = [[i for i in map(int,input().split())] for j in range(N)]
ans= []
size = 0
for i in range(N) :
    if size > K :
        break
    else: 
        ans += para[i]
        size = len(ans)
print("{}".format(ans[K]))

### FIXED CODE ###


def list_pos(cnt,a,b,ans):
    if ans  >= b :
        return cnt-1
    else :

        ans += a[cnt][1]
        cnt += 1
        return list_pos(cnt,a,b,ans)
import sys
sys.setrecursionlimit(100000)
N,K = map(int,input().split())
para = {}
for i in range(N):
    a,b  = map(int,input().split())
    if not a in para.keys():
        para[a] = b
    else : para[a] += b

para = sorted(para.items(),key =lambda x:x[0])

p = list_pos(0,para,K,0)
print("{}".format(para[p][0]))
s = list(map(int, input().split()))
if (s[1] == 1:
    ans = s[0] - s[1]
    print(ans)
else:
    print(0)

### FIXED CODE ###

s = list(map(int, input().split()))
if (s[1] != 1):
    ans = s[0] - s[1]
    print(ans)
else:
    print(0)
a=list(map(int, input().split()))
if a[0]+a[1]>=a[2]＊2:
    if a[3]>=a[4]:
        print (min(2＊a[3]＊a[2], (a[2]＊a[4]＊2+a[0]＊(a[3]-a[4]))))
    else:
        print (min(2＊a[4]＊a[2], (a[2]＊a[3]＊2+a[1]＊(a[4]-a[3]))))
else:
    print (a[0]＊a[3]+a[1]＊a[4])


### FIXED CODE ###

a, b, c, x, y = map(int, input().split())
res = 0
if a+b > c*2:
    mi = min(x, y)
    res += c*2 * mi
    x -= mi
    y -= mi
res += x * min(a, c*2)
res += y * min(b, c*2)
print(res)
print(r * r)

### FIXED CODE ###

r = int(input())
print(r * r)
import numpy as np

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

pcm=(p+1).cumsum()

print((pcm[K:]-pcm[0:-K]).max() /2)

### FIXED CODE ###

import numpy as np

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

pcm=np.concatenate([np.array([0]),(p+1).cumsum()],0)

print((pcm[K:]-pcm[0:-K]).max() /2)
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))

ans=[INF,INF]

for i in range(N):
    if ans[1]> abs(A-(T-H[i]*0.006)):
        ans[0]=i+1
        ans[1]=abs(A-(T-H[i]*0.006))
        
print(ans[0])

### FIXED CODE ###

N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
INF=float('inf')
ans=[INF,INF]

for i in range(N):
    if ans[1]> abs(A-(T-H[i]*0.006)):
        ans[0]=i+1
        ans[1]=abs(A-(T-H[i]*0.006))
        
print(ans[0])
from collections import Counter
N = int(input())
SS = [input() for _ in range(N)]

STR_IN_S = [[[] for _ in range(11)] for _ in range(26)]

for i in range(N):
  S = SS[i]
  c = Counter(S)
  for j in range(26):
    s = chr(97+j)
    STR_IN_S[j][c[s]].append(i)
    
SAME = [set(range(N)) for _ in range(N)]

for i in range(26):
  for j in range(11):
    l = STR_IN_S[i][j]
    for x in l:
      SAME[x] &= l
  
ans = 0
for i in range(N):
  ans += len(SAME[i]) - 1
  
print(ans)

### FIXED CODE ###

N = int(input())

SS = []
for i in range(N):
  s = list(input())
  s.sort()
  SS.append(s)
  
SS.sort()

ans = 0
prev = None
cnt = 0
for i in range(N):
  s = SS[i]
  if s == prev:
    if not cnt:
      cnt = 2
    else:
      cnt += 1
  else:
    ans += cnt * (cnt - 1) // 2
    cnt = 0
  prev = s
  
ans += cnt * (cnt - 1) // 2
print(ans)
N, K = input().split()
p = [int(i) for i in input().split()]
p_ascending = p.sort()
total = 0
for i in p_ascending[0,int(K)]:
  total += i
  
print(total)
  

### FIXED CODE ###

N, K = map(int, input().split())
p = [int(i) for i in input().split()]
p.sort()
total = 0
for i in p[:int(K)]:
  total += i
  
print(total)
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [0] * n
dp[1] = abs(h[1]-h[0])
for i in range(2, n):
  a = [0] * min(i,k)
  for j in range(1, min(i,k)): 
    a[i-1] = dp[i-j]+abs(h[i]-h[i-j])
  dp[i] = min(a)

print(dp[-1])


### FIXED CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [0] * n
dp[1] = abs(h[1]-h[0])
for i in range(2, n):
  a = [0] * min(i,k)
  for j in range(1, min(i,k)+1): 
    a[j-1] = dp[i-j]+abs(h[i]-h[i-j])
  dp[i] = min(a)

print(dp[-1])
import sys
input = sys.stdin.readline
A, B = map(int, input().split())
li = [A+B, A-B, A*B]
print(max(li))

### FIXED CODE ###

import sys
input = sys.stdin.readline
a, b, c, d = map(int, input().split())
ab = abs(a-b)
bc = abs(b-c)
ac = abs(a-c)
if (ab <= d and bc <= d) or ac <= d:
    print("Yes")
else:
    print("No")
N=int(input())
a_list=list(map(int,input().split()))
if N%3!=0:
  print("No")
else:
    a=set(a_list)
    a=list(a)
        if 0 in a:
            if len(a) ==2:
                b=a_list.pop(0)
                if len(b)==len(a_list)*2//3:
                    print("Yes")
                else:
                    print("No")
            else:
                print("No")
        else:
            if len(a)==3:
                a1=a[0]
                a2=a[1]
                a3=a[2]
                if a1 ^ a2 ==a3 and a1^a3==a2:
                    if a_list.count(a1) ==a_list.count(a2) ==a_list.count(a3):
                        print("Yes")
                    else:
                        print("No")
                else:
                    print("No")
            else:
                print("No")


### FIXED CODE ###

import copy
N=int(input())
a_list=list(map(int,input().split()))
a=set(a_list)
a=list(a)
if 0 in a:
        if len(a) ==2:
            if a_list.count(0)==len(a_list)//3 or a_list.count(0)==len(a_list)//2:
                    print("Yes")
            else:
                    print("No")
        elif len(a)==1:
            print("Yes")
        else:
                print("No")
else:
        if len(a)==3:
            a1=a[0]
            a2=a[1]
            a3=a[2]
            if a1 ^ a2 ==a3 and a1^a3==a2 and a2^a3==a1:
                if a_list.count(a1) == a_list.count(a2) == a_list.count(a3):
                        print("Yes")
                else:
                        print("No")
            else:
                print("No")
        else:
            print("No")
import numpy as np
from collections import deque
from heapq import *
#from numba import jit

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
maze = np.array([input() for i in range(H)])

walk_move = [[-1, 0], [0, -1], [0, 1], [1, 0]]
magic_move = []
for i in range(-2, 3):
  for j in range(-2, 3):
    if not i and not j:
      continue
    else:
      magic_move.append([i ,j])
inf = float("inf")
table = np.array([[inf for i in range(W)] for i in range(H)])
table[Ch-1, Cw-1] = 0
queue = [(Ch-1, Cw-1, 0)]

def main():
  while queue:
    x, y, cost = heappop(queue)
    for i, j in walk_move:
      dx = x+i
      dy = y+j
      if 0 <= dx <= H-1 and 0 <= dy <= W-1 and maze[dx][dy] == "." and table[dx][dy] > cost:
        table[dx][dy] = cost
        heappush(queue, (dx, dy, cost))
    for k, l in magic_move:
      dx = x+k
      dy = y+l
      if 0 <= dx <= H-1 and 0 <= dy <= W-1 and maze[dx][dy] == "." and table[dx][dy] > cost+1:
        table[dx][dy] = cost+1
        heappush(queue, (dx, dy, cost+1))
  return table[Dh-1][Dw-1]
        
ans = main()
if ans == inf:
  print("-1")
else:
  print(int(ans))

### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
maze = [input() for i in range(H)]

queue = deque()
queue.append((Ch-1, Cw-1, 0))
inf = float("inf")
table = [[inf] * W for i in range(H)]
table[Ch-1][Cw-1] = 0
walk_move = ((-1, 0), (0, -1), (1, 0), (0, 1))
magic_move = []
for i in range(-2, 3):
  for j in range(-2, 3):
    if not i and not j:
      continue
    else:
      magic_move.append([i, j])

while queue:
  x, y, cost = queue.popleft()
  for i,j in walk_move:
    dx = x+i
    dy = y+j
    if 0 <= dx <= H-1 and 0 <= dy <= W-1 and maze[dx][dy] == "." and table[dx][dy] > cost:
      queue.appendleft((dx, dy, cost))
      table[dx][dy] = cost
  for k,l in magic_move:
    dx = x+k
    dy = y+l
    if 0 <= dx <= H-1 and 0 <= dy <= W-1 and maze[dx][dy] == "." and table[dx][dy] > cost+1:
      queue.append((dx, dy, cost+1))
      table[dx][dy] = cost+1

ans = table[Dh-1][Dw-1]
if ans == inf:
  print("-1")
else:
  print(table[Dh-1][Dw-1])
s = input()
for i in range(int(len(s) + 1) / 2):
  if s[i] != s[int(len(s) + 1) / 2]:
    del[len(s) - 1]
print(len(s) + 1)

### FIXED CODE ###

import sys
S = input()

for i in range(1, len(S)):
  s = S[:-i]
  l = len(s) // 2
  if s[:l] == s[l:]:
    print(len(s))
    sys.exit()
a,b = map(int,input().split(“ “))
print((a - 1) * (b - 1))

### FIXED CODE ###

a,b = map(int,input().split(' '))
print((a - 1) * (b - 1))
import sys

N = int(input())

NList = list(map(int, input().split()))

result = 1
for i in range(N):
    result *= NList[i]
    
    if result > 10 ** 18:
        print('-1')
        sys.exit(1)

if result > 10 ** 18:
    print('-1')
    sys.exit(1)
else:
    print(result)

### FIXED CODE ###

N = int(input())

NList = list(map(int, input().split()))

NList.sort()
result = 1
for i in range(N):
    result *= NList[i]

    if result > 10 ** 18:
        break

if result > 10 ** 18:
    print('-1')
else:
    print(result)