Harryxun/stf_run huggingface dataset:
def main():
  
	n = int(input())
	a = list(map(int,input().split()))
	uppest = pow(10 , 18)

	ans = 1

	if 0 in a:
  		print (0)
  		return

	for s in a:
	  	ans *= s
  		if ans > uppest:
    			print(-1)
    			return
  
	print(ans)

main()

### FIXED CODE ###

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

print(a*b)
num=input().rstrip().split(" ")
N=int(num[0])
M=int(num[1])
date=input().rstrip().split(" ")
sum=0
for i in range(N):
  sum+=int(date[N])
date=sorted(date,reverse=True)
if (sum/4)/M<=date[M-1]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

num=input().rstrip().split(" ")
N=int(num[0])
M=int(num[1])
date=input().rstrip().split(" ")
sum=0
for i in range(N):
  sum+=int(date[i])
for j in range(len(date)):
  date[j]=int(date[j])
date=sorted(date,reverse=True)
if (sum/4)/M<=int(date[M-1]):
  print("Yes")
else:
  print("No")
# -*- coding: utf-8 -*-

def main():
    input_num = int(input())
    flag = True
    sum_num = 0

    while flag:
        chushutsu = input_num % 10
        sum_num += chushutsu
        input_num = int((input_num - chushutsu) / 10)
        if input_num == 0:
            flag = False

    if sum_num % 9 == 0:
        print('Yes')

    else:
        print('No')

if __name__ == '__main__':
    main()

### FIXED CODE ###

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

def main():
    input_num = input()
    sum_num = 0

    for i in range(len(input_num)):
        chushutsu = int(input_num[i])
        sum_num += chushutsu
    
    if sum_num % 9 == 0:
        print('Yes')

    else:
        print('No')

if __name__ == '__main__':
    main()
import unittest
from io import StringIO
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    n, m = map(int, input().split())
    A = list(map(int, input().split()))
    B = [0]*n
    for i in range(n):
        B[i] = A[i]//2
    
    for i in range(n):
        cnt=0
        val=B[i]
        while val%2==0:
            val//=2
            cnt+=1
        if i==0:
            temp=cnt
        else:
            if cnt!=temp:
                ok=False
                break
            if i==n-1:
                ok=True

    if ok:
        from functools import reduce
        from fractions import gcd

        def lcm(A, B):
            return A * B // gcd(A, B)

        # リストを引数にとる
        l = reduce(lcm, B)
        print(-(-(m//l) // 2))
        
    else:
        print(0)


resolve()

### FIXED CODE ###

import unittest
from io import StringIO
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    n, m = map(int, input().split())
    if n==1:
        a=int(input())
        print(-(-(m//(a//2)) // 2))

    else:
        A = list(map(int, input().split()))
        B = [0]*n
        for i in range(n):
            B[i] = A[i]//2

        for i in range(n):
            cnt = 0
            val = B[i]
            while val % 2 == 0:
                val //= 2
                cnt += 1
            if i == 0:
                temp = cnt
            else:
                if cnt != temp:
                    ok = False
                    break
                if i == n-1:
                    ok = True

        if ok:
            from functools import reduce
            from fractions import gcd

            def lcm(A, B):
                return A * B // gcd(A, B)

            # リストを引数にとる
            l = reduce(lcm, B)
            print(-(-(m//l) // 2))

        else:
            print(0)


resolve()
import sys
import math

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b = map(int, readline().split())
print(a * b // math.gcd(a,b))

### FIXED CODE ###

import sys
import fractions

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b = map(int, readline().split())
print(a * b // fractions.gcd(a,b))
import sys
from collections import deque

input = sys.stdin.readline
n, u, v = map(int, input().split())

E = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)

memo = [[0, 0] for i in range(n)]

def dfs(cur, pre, dep, p):
    stack = deque([[cur, pre]])
    memo[cur][p] = dep
    while stack:
        cur, pre = stack.pop()
        for e in E[cur]:
            if e != pre:
                dfs(e, cur, dep + 1, p)

dfs(u - 1, - 1, 0, 0)
dfs(v - 1, -1, 0, 1)

# print(memo)
ans = 0
for a, b in memo:
    ans = max(ans, b - 1)
print(ans)


### FIXED CODE ###

import sys
from collections import deque

input = sys.stdin.readline
n, u, v = map(int, input().split())

E = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)

memo = [[0, 0] for i in range(n)]

def dfs(cur, pre, p):
    stack = deque([[cur, pre]])
    while stack:
        cur, pre = stack.pop()
        if pre != -1:
            memo[cur][p] = memo[pre][p] + 1
        for e in E[cur]:
            if e != pre:
                stack.append([e, cur])

dfs(u - 1, - 1, 0)
dfs(v - 1, -1, 1)

# print(memo)
ans = 0
for a, b in memo:
    if a <= b:
        ans = max(ans, b - 1)
print(ans)
N, Q = map(int, input().split())
root = [[] for i in range(N)]
ans = [0]*N

for i in range(N-1):
  a, b = map(int, input().split())
  a, b = a-1, b-1
  root[a].append(b)
  root[b].append(a)
  
for i in range(Q):
  p, x = map(int, input().split())
  ans[p-1] += x
  
visit = [False]*N
def dfs(n):
  visit[n] = True
  for go in root[n]:
    if visit[go]:
      continue
    ans[go] += ans[n]
    dfs(go)
    
dfs(0)
print(*ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
inf = 10**17
mod = 10**9+7


n, q = map(int, input().split())
g = [[] for _ in range(n)]
val = [0] * n

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

for _ in range(q):
    p, x = map(int, input().split())
    val[p - 1] += x

seen = [False] * n
def dfs(v):
    seen[v] = True
    for nv in g[v]:
        if seen[nv]:
            continue
        val[nv] += val[v]
        dfs(nv)

dfs(0)
print(*val)
import math
a,b = map(int, input().split())
A = int(math.floor(a * (100/8)))
B = int(math.floor(b * (100/10)))
X = []
while True:
  if int(math.floor(A*(8/100))) == a:
    X.append(A)
    break
  else:
    A += 1
 
while True:
  if int(math.floor(B*(8/100))) == b:
    X.append(B)
    break
  else:
    B += 1
    
if set(A)&set(B) == set():
  print(-1)
else:
  C = list(set(A)&set(B))
  C.sort()
  print(C[0])

### FIXED CODE ###

import math
a,b = map(int, input().split())
A = int(math.floor(a * (100/8)))
A1 = int(math.ceil((a+1)*(100/8)))
B = int(math.floor(b * (100/10)))
B1 = int(math.ceil((b+1) * (100/10)))
X = []
Y = []
for i in range(A,A1+1):
  if int(math.floor(i*(8/100))) == a:
    X.append(i)
  else:
    pass
  
for i in range(B,B1+1):
  if int(math.floor(i*(10/100))) == b:
    Y.append(i)
  else:
    pass
    
if set(X)&set(Y) == set():
  print(-1)
else:
  Z = list(set(X)&set(Y))
  Z.sort()
  print(Z[0])
N = int(input())
cs = [i for i in input()]
cur = len(cs)-1
ans = 0
for i in range(len(cs)):
    if cs[i] == 'W':
        while(cs[cur] != 'R' or cur == i):
            cur -= 1
        ans += 1
        cur -= 1
    if i >= cur:
        break
print(ans)


### FIXED CODE ###

N = int(input())
cs = [i for i in input()]
n_R = 0
for c in cs:
    if c == 'R':
        n_R += 1
n_n_R = 0
for i in range(n_R):
    if cs[i] == 'R':
        n_n_R += 1
print(n_R - n_n_R)
N, K = map(int, input().split())
A = list(map(int, input().split()))
p = 10**9 + 7
ans = 1

is_all_neg = 1
for i in range(N):
    if A[i] > 0:
        is_all_neg = 0
        
if is_all_neg:
    if K%2 == 1:
        A_1 = sorted(A, reverse=True)
        for i in range(K):
            ans *= A_1[i]
        print(ans % p)
    else:
        A_1 = sorted(A)
        for i in range(K):
            ans *= A_1[i]
        print(ans % p)
else:
    A_1 = sorted(A, key=lambda x: abs(x), reverse=True)
    is_pos = 1
    ans = 1
    minus = []
    for i in range(K):
        ans *= A_1[i]
        if A_1[i] < 0:
            minus.append(i)
        if ans > 0:
            is_pos = 1
        else:
            is_pos = 0
        if i == K-1:
            if is_pos:
                
                break
            else:
                
                idx = minus.pop()
                ans /= A_1[idx]
                for j in range(K-1, N):
                    if A_1[j] > 0:
                        ans *= A_1[j]
                        break
    print(int(ans)%p)

### FIXED CODE ###

N, K = map(int, input().split())
X = list(map(int, input().split()))
MOD = 10 ** 9 + 7
 
pos = sorted(v for v in X if v >= 0)
neg = sorted(-v for v in X if v < 0)
if N == K:
    ans = 1
    for x in X:
        ans *= x
        ans %= MOD
    print(ans % MOD)
    exit()
ok = False  # True: ans>=0, False: ans<0
if pos:
    #正の数があるとき
    ok = True
else:
    #全部負-> Kが奇数なら負にならざるをえない。
    ok = (K % 2 == 0)
 
ans = 1
if ok:
    # ans >= 0
    if K % 2 == 1:
        #Kが奇数の場合初めに1つ正の数を掛けておく
        #こうすれば後に非負でも負でも2つずつのペアで
        #考えられる
        ans = ans * pos.pop() % MOD
 
    # 答えは非負になる→二つの数の積は必ず非負になる．
    cand = []
    while len(pos) >= 2:
        x = pos.pop() * pos.pop()
        cand.append(x)
 
    while len(neg) >= 2:
        x = neg.pop() * neg.pop()
        cand.append(x)
 
    cand.sort(reverse=True) # ペアの積が格納されているので必ず非負
    # ペア毎に掛けていく
    for i in range(K // 2):
        ans = ans * cand[i] % MOD
else:
    # ans <= 0
    cand = sorted(X, key=lambda x: abs(x))
    for i in range(K):
        ans = ans * cand[i] % MOD
 
print(ans)
from collections import deque

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

order = n%2
ans = deque([])
for i in range(n):
    if i%2 == order:
        ans.append(a[i])
    else:
        ans.appendleft(a[i])
print(' '.join(ans))

### FIXED CODE ###

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

forward = True
sec, first = [], []
for i in range(n):
    if i%2:
        first.append(a[i])
    else:
        sec.append(a[i])
arr = first[::-1] + sec
if len(first) != len(sec):
    arr = arr[::-1]

for el in arr:
    print(el, end=' ')
import math 
n,m = map(int.input().split())
nm_abs = abs(n-m)
n_lad = math.factorial(n)
m_lad = math.factorial(m)
if nm_abs >= 2:
  print(0)
elif nm_abs == 1:
  print((n_lad * m_lad) % (10**9+7))
else:
  print((n_lad * m_lad*2) % (10**9+7))

### FIXED CODE ###

import math 
n,m = map(int,input().split())
nm_abs = abs(n-m)
n_lad = math.factorial(n)
m_lad = math.factorial(m)
if nm_abs >= 2:
  print(0)
elif nm_abs == 1:
  print((n_lad * m_lad) % (10**9+7))
else:
  print((n_lad * m_lad*2) % (10**9+7))
N, A,B = map(int, input().split())
str = []
for j in range(N//(A+B)+1):
    for i in range(A):
        if i==N+1:
            break
        str.append('b')

    for i in range(B):
        if i==N+1:
            break
        str.append('r')
print(str)
count = 0
for k in range(N):
    if str[k] == 'b':
        count+=1
print(count)


### FIXED CODE ###

s = input()
if s[0]=='A' and s[1]=='A' and s[2]=='A':
    print("No")
elif s[0]=='B' and s[1]=='B' and s[2]=='B':
    print("No")
else:
    print("Yes")
S = input()

def rec(s):
    print(s)
    leng = len(s)
    if leng==0:
        print('YES')
    else:
        if s[0:5]=="dream":
            if leng==5:
                rec(s[5:])
            else:
                if s[5:7]=="er":
                    if s[5:10]=="erase":
                        if s[10]=="r":
                            rec(s[11:])
                        else:
                            rec(s[10:])
                    else:
                        rec(s[7:])
                else:
                    print("s:")
                    print(s)
                    rec(s[5:])
        elif s[0:5]=="erase":
            if leng==5:
                rec(s[5:])
            else:
                if s[5]=="r":
                    rec(s[6:])
                else:
                    rec(s[5:])
        else:
            print('NO')
rec(S)

### FIXED CODE ###

S = input()
S = S[::-1]
l = ['dream','dreamer','erase','eraser']
L = []
pos = 0
f=True

for i in l:
    L.append(i[::-1])

while pos < len(S):
    no_match = True
    for candidate in L:
        if S[pos:pos+len(candidate)]==candidate:
            pos+=len(candidate)
            no_match =False
            break
    if no_match:
        f =False
        break


if f:
    print('YES')
else:
    print('NO')
n = int(input())
a = list(map(float, input().split()))
 
result = 0
les = 0
while les == 0:
  for i in range(n):
    les += a[i] % 2
    a[i] = a[i]/2
  result += 1
  
result -= 1
print(result)

### FIXED CODE ###

print(input().count("1"))
i=0
while True :
 x=input()
 i+=1
 print "Case "+str(i)+": "+str(x)
 

### FIXED CODE ###

i=0
while True :
 x=input()
 if x==0:break
 i+=1
 print "Case "+str(i)+": "+str(x)
i=1
while s=int(input)!=0:
 print(f'Case {i}: {s}')

### FIXED CODE ###

import sys
i=1
for e in sys.stdin:
 if'0\n'==e:break
 print(f'Case {i}: {e[:-1]}');i+=1
#!/usr/bin/env python3
import sys, math, fractions, itertools

def solve(N: int, A: int, x: "List[int]"):
    X = max(x)
    dp = [[[0 for _ in range(max(N*X+1, N*A+1))] for _ in range(N+1) ] for _ in range(N+1)]
    dp[0][0][0] = 1
    for n in range(N+1):
        for m in range(N+1):
            for k in range(N*X+1):
                if n >= 1 and k < x[n-1]:
                    dp[n][m][k] = dp[n-1][m][k]
                elif n >= 1 and m >= 1 and k >= x[n-1]:
                    dp[n][m][k] = dp[n-1][m][k] + dp[n-1][m-1][k-x[n-1]]
    s = 0
    for i in range(1, N+1):
        s += dp[N][i][i*A]
    print(s)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    x = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A, x)

if __name__ == '__main__':
    main()


### FIXED CODE ###

n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n <= k:
  print(n * x)
else:
  print(k * x + (n-k) * y)
a,b = map(int,input().split())
print(math.floor((a+b)/2))

### FIXED CODE ###

import math
a,b = map(int,input().split())
print(math.ceil((a+b)/2))
N = int(input())
s = set(map(str,input().split()))
if(len(s) == 3):
  print("Three")
else:
  print("Four")


### FIXED CODE ###

n = int(input())
print(n // 3)
N = int(input())
list = [int(i) for i in input().split()]
score == 0
for i in range(N):
    if list[i] != i+1:
        score =+ 1
if score == 0 or 2:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

N = int(input())
l = list(map(int, input().split()))
score = 0
for i in range(N):
  if not l[i] == i+1:
    score += 1
if score  ==0 or score ==2:
  print("YES")
else:
  print("NO")
b=False
while True:
    n = int(input())
    if n==0:break
    d=dict()
    if b:print()
    b=True
    for _ in range(n):
        line = input().split()
        tmp = int(line[1])*3+int(line[3]*1)
        if tmp in d:
            d[tmp].append(line[0])
        else:
            d[tmp] = []
            d[tmp].append(line[0])
    for k, vs in sorted(d.items(), key=lambda x: x[0])[::-1]:
        for v in vs:
            print('%s,%d'%(k, v))

### FIXED CODE ###

b = False
while True:
    n = int(input())
    if n == 0:
        break
    dataset = []
    if b:
        print()
    b = True
    for _ in range(n):
        name, w, l, d = input().split()
        dataset.append((name, 3*int(w) + int(d), n-len(dataset)))
    for name, score, _ in sorted(dataset, key=lambda x: (x[1], x[2]))[::-1]:
        print(name + "," + str(score))
import sys
from collections import deque
N,K = map(int,input().split())
A = [0] + list(map(int,input().split()))
G = dict([(i,[]) for i in range(1,N+1)])
for i in range(1,N+1):
  G[i].append(A[i])

l = deque([A[1]])
seen = [False for i in range(N+1)]
seen[1] = True
d = [0 for i in range(N+1)]
d[A[1]] = 1
if A[1] == 1:
  print(1)
  sys.exit()
  
for i in range(K):
  v = l.popleft()
  if seen[v] != True:
    seen[v] = True
    l.append(A[v])
    if seen[A[v]] == True: 
      a = d[A[v]]
      b = d[v] + 1 - a
    else:  
      d[A[v]] = d[v] + 1
  else:  
    start = v
    break

kaisu = (K-a)%b
p = start
for i in range(kaisu):
  p = A[p]
print(p)  

### FIXED CODE ###

import sys
from collections import deque
N,K = map(int,input().split())
A = [0] + list(map(int,input().split()))
G = dict([(i,[]) for i in range(1,N+1)])
for i in range(1,N+1):
  G[i].append(A[i])

l = deque([A[1]])
seen = [False for i in range(N+1)]
seen[1] = True
d = [0 for i in range(N+1)]
d[A[1]] = 1
if A[1] == 1:
  print(1)
  sys.exit()

for i in range(K):
  v = l.popleft()
  if seen[v] == False:
    seen[v] = True
    l.append(A[v])
    if seen[A[v]] == True: 
      a = d[A[v]]
      b = d[v] + 1 - a
    else:  
      d[A[v]] = d[v] + 1
  else:  
    start = v
    break  
  if i == K-1:
    print(v)
    sys.exit()

kaisu = (K-a)%b
p = start
for i in range(kaisu):
  p = A[p]
print(p)
r1,c1,r2,c2=map(int,input().split())
r2+=1
c2+=1
N=2*(10**6)
mod=10**9+7
fac=[1]*(N+2)
inv=[1]*(N+2)
t=1
for i in range(1,N+2):
    t*=i
    t%=mod
    fac[i]=t
t=pow(fac[N+1],mod-2,mod)
for i in range(N+1,0,-1):
    inv[i]=t
    t*=i
    t%=mod
def comb(n,r):
    return fac[n]*inv[n-r]*inv[r]%mod
print(comb(r2+c2,c2)-comb(r2+c1,c1)-comb(r1+c2,c2)+comb(r1+c1,c1))

### FIXED CODE ###

r1,c1,r2,c2=map(int,input().split())
r2+=1
c2+=1
N=2*(10**6)+2
mod=10**9+7
fac=[1]*(N+2)
inv=[1]*(N+2)
t=1
for i in range(1,N+2):
    t*=i
    t%=mod
    fac[i]=t
t=pow(fac[N+1],mod-2,mod)
for i in range(N+1,0,-1):
    inv[i]=t
    t*=i
    t%=mod
def comb(n,r):
    return fac[n]*inv[n-r]*inv[r]%mod
print((comb(r2+c2,c2)-comb(r2+c1,c1)-comb(r1+c2,c2)+comb(r1+c1,c1))%mod)
N = input()

prob_odd = (N //2 + N % 2) / N

print(prob_odd)

### FIXED CODE ###

N = int(input())

prob_odd = (N //2 + N % 2) / N

print(prob_odd)
N = int(input())
list = [int(i) for i in input().split()]

ans = 0
min = 0

for j in rainge(N):
    if (min  >= list[j]):
        abs += 1
        min = list[j]
    else:
        continue

print(ans)


### FIXED CODE ###

N = int(input())
list = [int(i) for i in input().split()]

ans = 0
min = list[0]

for j in range(N):
    if (min  >= list[j]):
        ans += 1
        min = list[j]
    else:
        continue

print(ans)
#coding:utf-8

import math

datas = [int(x) for x in input().split()]
p1 = (datas[0], datas[1])
p2 = (datas[2], datas[3])

print(math.sqrt(math.pow(p1[0]-p2[0], 2)+math.pow(p1[1]-p2[1],2)))

### FIXED CODE ###

#coding:utf-8

import math

datas = [float(x) for x in input().split()]
p1 = (datas[0], datas[1])
p2 = (datas[2], datas[3])

print(math.sqrt(math.pow(p1[0]-p2[0], 2)+math.pow(p1[1]-p2[1],2)))
r, g, b, n = map(int, raw_input().split())
count = 0
for i in xrange(3000):
  if i*r > n:
    break
  for j in xrange(3000):
    if i*r + j*g > n:
      break
	if (n-i*r - j*g)% b == 0:
      count += 1
print count

### FIXED CODE ###

r, g, b, n = map(int, raw_input().split())
count = 0
for i in xrange(n+1):
    if i*r > n:
        break	
    for j in xrange(n+1):
        if i*r + j*g > n:
            break
        if (n- i*r - j*g) % b == 0:
      		count += 1
print count
S = raw_input()

s = S % 60
h = (S - S % 3600) / 3600
m = (S - s - h * 3600) / 60

print "%d:%d:%d", (h,m,s)

### FIXED CODE ###

S = input()
h = S / 3600
s = S % 60
m = (S - h * 3600 - s) / 60

print "%d:%d:%d" %(h,m,s)
N = int(input())
a = map(int,input().split())
heap.heapify(a)
for i in range(N-1):
  x = heap.heappop(a)
  y = heap.heappop(a)
  z = (x+y)/2
  heap.heappush(a,z)
answer = heap.heappop(a)
print(answer)

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
import heapq
heapq.heapify(a)
for i in range(N-1):
  x = heapq.heappop(a)
  y = heapq.heappop(a)
  z = (x+y)/2
  heapq.heappush(a,z)
answer = heapq.heappop(a)
print(answer)
N = int(input())
lst_A = list(map(int, input().split()))
lst_rod_num = [0] * (N + 1)
a, b = 0, 0
lst_ans = []


for a in lst_A:
    lst_rod_num[a] += 1


cnt = 0
for i in range(N, -1, -1):
    if lst_rod_num[i] >= 2:
        lst_ans.append(i)
        cnt += 1
    if cnt == 2:
        a = lst_ans[0]
        b = lst_ans[1]
        break
ans = a * b


print(ans)

### FIXED CODE ###

N = int(input())
lst_A = list(map(int, input().split()))
lst_A.sort(reverse=True)
cur_a = -1
lst_ans = []


for i, a in enumerate(lst_A):
    if cur_a == a:
        lst_ans.append(a)
        cur_a = -1
        if len(lst_ans) == 2:
            break
    else:
        cur_a = a


ans = lst_ans[0] * lst_ans[1] if len(lst_ans) else 0
print(ans)
def main():
    _ = input()
    a_list = map(int, input().split())
    b_list = map(int, input().split())
    diffs = map(lambda a, b: b - a, a_list, b_list)
    total = 0
    count = 0
    for diff in diffs:
        if diff > 0:
            count += (diff + 1) // 2
            total += diff % 2
        else:
            count += -diff
            total += diff
    if count >= total:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


### FIXED CODE ###

import itertools


def main():
    x, y = map(int, input().split())
    if x % y == 0:
        result = -1
    else:
        result = next(filter(lambda i: i % y != 0, map(lambda i: i * x, itertools.count(1))))
    print(result)


if __name__ == '__main__':
    main()
S = list(input())

A = set["a","b","c"]

if set(S) == A:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

S = input()

if "a" in S and "b" in S and "c" in S:
    print("Yes")
else:
    print("No")
a = map(int,input().split())
unchi = 0
while a>=1:
    a -=1
    if 99999 >= a >= 10000:
        unchi += 1
    elif 999 >= a >= 100:
        unchi += 1
    elif 9 >= a >= 1:
        unchi += 1
print(unchi)


### FIXED CODE ###

a = int(input())
unchi = 0
while a>=1:
    if 99999 >= a >= 10000:
        unchi += 1
    elif 999 >= a >= 100:
        unchi += 1
    elif 9 >= a >= 1:
        unchi += 1
    a -= 1
print(unchi)
a,b,c,d=(int(i) for i in input().split())

if abs(a-c) =< d or (abs(a-b) =< d and abs(b-c) =< d) :
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a,b,c,d=(int(i) for i in input().split())

if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d) :
    print("Yes")
else:
    print("No")
N,M = map(int,input().split()) #n:頂点数　w:辺の数


way = [[] for i in range(M)]
depth = [float("inf") for i in range(N)]
visited = [False for i in range(N)]
que=[0]

for i in range(M):
    x,y = map(int,input().split())
    way[x-1].append(y-1)
    way[y-1].append(x-1)

for i in que:
  for j in way[i]:
    if visited[j]:
      continue
    que.append(j)
    visited[j]=True
    depth[j] = min(i+1,depth[j])
print("Yes")
for i in range(1,N):
  print(depth[i])

### FIXED CODE ###

N,M = map(int,input().split()) #n:頂点数　w:辺の数


way = [[] for i in range(N)]
depth = [float("inf") for i in range(N)]
visited = [False for i in range(N)]
que=[0]

for i in range(M):
    x,y = map(int,input().split())
    way[x-1].append(y-1)
    way[y-1].append(x-1)

for i in que:
  for j in way[i]:
    if visited[j]:
      continue
    que.append(j)
    visited[j]=True
    depth[j] = min(i+1,depth[j])
print("Yes")
for i in range(1,N):
  print(depth[i])
h,w=map(int,input().split())
s=[list(input().replace(".","0")) for i in range(h)]
for i in range(h):
  for j in range(w):
    if s[i][j]=="#":
      for k in range(-1,2):
        for l in range(-1,2):
          if 0<=i+k<=h and 0<=j+l<=w and s[i+k][j+l]!="#":
            s[i+k][j+l]=str(int(s[i+k][j+l])+1)
for i in range(h):
  for j in range(w):
    print(s[i][j], end="")
  print()

### FIXED CODE ###

h,w=map(int,input().split())
s=[list(input().replace(".","0")) for i in range(h)]
for i in range(h):
  for j in range(w):
    if s[i][j]=="#":
      for k in range(-1,2):
        for l in range(-1,2):
          if 0<=i+k<h and 0<=j+l<w and s[i+k][j+l]!="#":
              s[i+k][j+l]=str(int(s[i+k][j+l])+1)
for i in range(h):
  for j in range(w):
    print(s[i][j], end="")
  print()