peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n, m = map(int, input().split())

ans = 0
if n > m:
  n, m = m, n
if n==1:
  if m==1:
    ans = 1
  else:
    ans = m-2
else:
  ans = (n-2)*(m-2)  
  
print(ans)
# Judge status: Accepted
s, t = input().split()
print("{}{}".format(t, s))
# Judge status: Wrong Answer
n,m,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

xmax = max(x)
ymin = min(y)

for i in range(xmax,ymin+1):
    if X<i<Y:
        print("No War")
        exit()
    
print("War")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
S = 0
prev = -2
for i in range(n):
    now = a[i]
    S += b[now - 1]
    if now - prev == 1:
        S += c[prev - 1]
    prev = now

print(S)
# Judge status: Accepted
N = int(input())
A = list([int(x) for x in input().split()])

xor_base = A[0]
for a in A[1:]:
    xor_base ^= a

result = []
for a in A:
    result.append(a ^ xor_base)

print(*result)
# Judge status: Accepted
import collections
s = input()
c = collections.Counter(s)

if len(c.keys()) == 2:
    for v in c.values():
        if v == 2:
            print('Yes')
            exit()
        else:
            print('No')
            exit()
print('No')
# Judge status: Accepted
n,a,b=map(int,input().split())
ma=b*(n-1)+a
mi=a*(n-1)+b
print(ma-mi+1 if ma-mi+1>0 else 0)
# Judge status: Accepted
n,a,b=map(int,input().split())
s=input()
x=0
y=0
for i in range(n):
  if s[i]=="a":
    if y<a+b:
      print("Yes")
      y+=1
    else:
      print("No")
  elif s[i]=="b":
    if y<a+b and x<b:
      x+=1
      y+=1
      print("Yes")
    else:
      print("No")
  else:
    print("No")
# Judge status: Accepted
nks = input().split(' ');
n = int(nks[0]);
k = int(nks[1]);
s = int(nks[2]);



for i in range(k) :
	if n - k == 0 and i== k-1 :
		print(s);
	else :
		print(s,'',end='');
for i in range(n-k) :
	nokori = 0;
	if s <= 2 :
		nokori = s+1;
	else :
		nokori = s-1;
	if i == n-k-1 :
		print(nokori);
	else :
		print(nokori,'',end='');
# Judge status: Accepted
line = input()
a, b = line.split(" ")
a = int(a)
b = int(b)

if a <= 9 and b <= 9:
    print(a * b)
else:
    print(-1)
# Judge status: Accepted
x, y = map(int, input().split())
if x % y:
    print(x)
else:
    print(-1)
# Judge status: Wrong Answer
S = input()
judge = 0

for i in range(4):
  if S[i-1] == S[i]:
    judge += 1
    
if judge == 0:
  print('Good')
else:
  print('Bad')
# Judge status: Wrong Answer
a = input()
b = input()
c = input()
card = a[0]
a = a[1:]
while a!="" and b!="" and c!="":
    if card == "a":
        card = a[0]
        a = a[1:]
    elif card == "b":
        card = a[0]
        b = b[1:]
    else:
        card = a[0]
        c = c[1:]
if a=="":
    print("A")
elif b=="":
    print("B")
else:
    print("C")
# Judge status: Accepted
S = input()

ss = []
ans = 0
for i in range(len(S)): ss.append(S[i])

zeros = 0
ones = 0

for i in range(len(ss)):
    if ss[i] == "0":
        zeros += 1
    elif ss[i] == "1":
        ones += 1

ans = 2*min(zeros, ones)
print(ans)
# Judge status: Accepted
s = input()
s_odd = s[::2]
s_even = s[1::2]
if "L" in s_odd or "R" in s_even:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
D,T,S=map(int, input().split())

if T*S>=D:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

ans = [0 for _ in range(n)]
for i in reversed(range(n)):
  tmp = 0
  for j in range((i+1)*2-1,n,i+1):
    if ans[j] == 1:
      tmp += 1
  if a[i] == 0 and tmp % 2 == 1:
    ans[i] = 1
  elif a[i] == 1 and tmp % 2 == 0:
    ans[i] = 1

c = 0
l = []
for i in range(n):
  if ans[i] == 1:
    l.append(i+1)
    c += 1
if c == 0:
  print(0)
else:
  l = [str(i) for i in l]
  l = " ".join(l)
  print(c)
  print(l)
# Judge status: Accepted
N = int(input())
alist = list(map(int, input().split()))

cnt = 1
ans = 0
for a in alist:
    if a != cnt:
        ans += 1
    else:
        cnt += 1

if ans==N:
    print(-1)
else:
    print(ans)
# Judge status: Accepted
n = int(input())
d = {}
for i in range(n):
  a = int(input())
  d[a] = d.get(a, 0) + 1

c = 0
for e in d.values():
  if e % 2 == 1:
    c += 1
print(c)
# Judge status: Wrong Answer
N = int(input())

if N % 2 == 0:
    print("1")
else:
    a = N // 2 + 1
    print(a/N)
# Judge status: Accepted

n = int(input())

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

can4 = 0
even = 0
odd = 0

for i in a:
    if i % 4 == 0:
        can4 += 1
    elif i % 2 == 0:
        even += 1
    else:
        odd += 1

if even == 0 and odd == can4 + 1:
    print("Yes")
elif odd > can4:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

dp = [0]*(n+1)
dp[0] = 1000

for i in range(1, n):
    dp[i] = dp[i-1]
    for j in range(i):
        stock = dp[j]//a[j]
        cost = dp[j]+(a[i]-a[j])*stock
        dp[i] = max(dp[i], cost)
print(dp[n-1])
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))
max_cnt, cnt = 0, 0
for i in range(n - 1):
    if h[i] >= h[i + 1]:
        cnt += 1
    else:
        cnt = 0
    max_cnt = max(max_cnt, cnt)
print(max_cnt)
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))
l=0;r=10**10
while r-l>1:
  x=(l+r)//2
  ct=0
  for i in range(n):
    ct+=(a[i]-1)//x
  if ct<=k:
    r=x
  else:
    l=x
print(r)
# Judge status: Accepted
n, k, q = map(int, input().split())
tokuten = [k-q]*n

for i in range(q):
    a = int(input())
    tokuten[a-1] += 1


for i in range(n):
    if tokuten[i] <= 0:
        print("No")
    else:
        print("Yes")
# Judge status: Wrong Answer
n,k,q = map(int,input().split())
a = []
for _ in range(q):
    a.append(int(input()))
#
point_get = [0] * n
for i in range(q):
    point_get[a[i]-1] += 1
#
print(point_get)
for j in range(n):
    if k - q + point_get[j] >= 1:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
import sys
sys.setrecursionlimit(4100000)

x,y,a,b,c = map(int,input().split())
p = sorted(list(map(int,input().split())))
q = sorted(list(map(int,input().split())))
r = list(map(int,input().split()))
ans = 0

for k in range(1,x+1):
    r.append(p[-k])
for v in range(1,y+1):
    r.append(q[-v])

rs = sorted(r)

for i in range(1,x+y+1):
    ans += rs[-i]
print(str(ans))
# Judge status: Accepted
# -*- coding: utf-8 -*-
n, r = map(int, input().split())
if n >= 10:
    print(r)
else:
    print(r+100*(10-n))
# Judge status: Wrong Answer
K,X=map(int,input().split())
nums=[i for i in range(-100,101) if X-(K-1)<= i <=X+(K-1)]

ans=str("")
for n in nums:
    ans+=str(n)+" "
print(ans)
# Judge status: Accepted
s = input()
result = s[0:3]
print(result)
# Judge status: Accepted
def resolve():
    from math import ceil
    h, w = map(int, input().split())
    if h <= 1 or w <= 1:
        print(1)
    elif h * w % 2 == 0:
        print(int(h * w / 2))
    else:
        print(int(ceil(h * w / 2)))


resolve()
# Judge status: Accepted
k, n = map(int, input().split())
a = list(map(int, input().split()))

mx = (k - a[n - 1]) + a[0]

for i in range(n - 1):
    sa = a[i + 1] - a[i]
    if sa > mx:
        mx = sa

print(k - mx)
# Judge status: Accepted
A, B, C, K = map(int, input().split()) 
if K%2 == 0:
    print(A-B) if abs(A-B)<=10**18 else print("Unfair")
else:
    print(B-A) if abs(B-A)<=10**18 else print("Unfair")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

z = 0
for i in range(n):
    z += a[i]

y = (z % 1000000007)** 2

x = 0
for j in range(n):
    x += a[j] ** 2

p = ((y - x) / 2) % 1000000007
print(int(p))
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split());print("NYoe s"[((abs(b-a)<=d and abs(c-b)<=d) or (c-a)<=d)::2])
# Judge status: Accepted
D,T,S = list(map(int,input().split()))

if D / S <= T:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
def answer(n, c, k, ts):
    ts.sort()
    bus = 1
    _c = 1
    standard = ts[0]
    for i in range(1, len(ts)):
        if ts[i] <= standard+k and _c < c:
            _c += 1
        else:
            _c = 1
            standard = ts[i]
            bus += 1
    return bus
    
n, c, k = map(int, input().split())
ts = []
for _ in range(n):
    ts.append(int(input()))
print(answer(n, c, k, ts))
# Judge status: Accepted
import heapq

n, m = map(int, input().split())
s = list(map(lambda x: x* (-1), map(int, input().split())))

heapq.heapify(s)

while m != 0:
  num = heapq.heappop(s)
  heapq.heappush(s, -1*num//2*-1)
  m -= 1

print(-1 * sum(s))
# Judge status: Wrong Answer
N,K = map(int,input().split())
ans = 0
for i in range(1,N+1):
  j = 0
  point = i
  while point < K:
    point *= 2
    j += 1
  ans += (1/N)*(0.5**j)
print(point)
# Judge status: Accepted
X = int(input())-1
result = False

while not result:
  result = True
  X += 1
  for i in range(2,X//2+1):
    if X % i == 0:
      result = False
      break
print(X)
# Judge status: Wrong Answer
import math

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

if 2*x <= a*a*b:
  y = 2 * x / (a * b)
  print(math.degrees(math.atan(y/b)))
else:
  y = 2 * x / (a * a)
  print(math.degrees(math.atan(a/y)))
# Judge status: Wrong Answer
n=int(input())
b=list(map(int,input().split()))
ans=0
for i in range(n-2):
    ans+=min(b[i],b[i]+1)
print(ans+b[0]+b[-1])
# Judge status: Accepted
N=int(input())
*A,=map(int,input().split())
from collections import*
C=Counter(A)
S=sum(v*(v-1)//2 for v in C.values())
for a in A:
    print(S-C[a]+1)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
num = [0] * n
cnt = 0

for i in a:
    num[i - 1] += 1

for i in num:
    cnt += i * (i - 1)//2

for i in range(n):
    tmp = num[a[i]-1]
    ans = cnt - ((tmp-(tmp-2)) * (tmp-1) // 2)
    ans += ((tmp-2) * (tmp-1) // 2)
    print(ans)
# Judge status: Wrong Answer
n=int(input())
s=list(input())
a=s.count("R")
b=s.count("G")
c=s.count("B")
print(a*b*c)
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    k=2*j-i
    if n-1>=k and not(s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]):
        ans=ans+1
print(a*b*c-ans)
# Judge status: Wrong Answer
A,B = map(int,input().split())
if A == 0 or B == 0:
	print("Zero")
	exit()
if A * B < 0:
	print("Zero")
	exit()
if A > 0 and B > 0:
	print("Positive")
else:
	print("Negative")
# Judge status: Accepted
s=input()
t=input()
n=len(s)
f=0
a=[[] for i in range(26)]
for i in range(n):
    
    if len(a[ord(s[i])-97])==0:
        a[ord(s[i])-97].append(t[i])
    else:
        if a[ord(s[i])-97][0]!=t[i]:
            f=1
x=[a[i][0] for i in range(26) if len(a[i])==1]
if len(x)!=len(set(x)):
    f=1
print("Yes" if f==0 else "No")
# Judge status: Wrong Answer
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = Counter(A)

tmp = 0
for i in range(N):
    tmp += B[i]*(B[i]-1)//2

for k in range(N):
    print(tmp-B[A[k]]+1)
# Judge status: Accepted
s=input()

n = len(s)
count = 0

before = int((n-1)/2)
after = int((n+1)/2)

if s[:before] != s[after:]:
    count += 1

if count == 0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a = input().split()
c, d = map(int, input().split())
e = input()

if (e == a): c -= 1
else: d -= 1

print("{}" "{}" "{}".format(c," ",d))
# Judge status: Accepted
from collections import defaultdict
d = defaultdict(int)
d["D"]=0

n=int(input())
for _ in range(n):
  d[input()]+=1

n=int(input())
for _ in range(n):
  d[input()]-=1
  
print(max(d.values()))
# Judge status: Wrong Answer
n,x = map(int,input().split())
a = list(map(int,input().split()))
res,ans = [],0
for i in range(n):
	res.append(abs(a[i]-x))
#print(min(res))
res.sort()
ans = res[0]
cnt = 0
if n > 1:
	num = min((n-1),11)
	for j in range(2,num):
		cmp = a[0]%res[0]*j
		for s in range(n):
			if a[s]%res[0]*j != cmp:
				break
			else:
				cnt += 1
		if cnt == n:
			ans = res[0]*j
print(ans)
# Judge status: Accepted
from fractions import gcd
n =int(input())
a =list(map(int ,input().split()))

b =[a[0]]
for i in range(1,n-1):
    b.append(gcd(b[-1],a[i]))

c =[a[-1]]
for i in range(n-2,0,-1):
    c.append(gcd(c[-1], a[i]))

MAX =0
for i in range(n):
    if i == 0:
        MAX =max(MAX, c[-1])
    elif i ==n-1:
        MAX =max(MAX, b[-1])
    else:
        MAX =max(MAX, gcd(b[i-1], c[n-i-2]))
print(MAX)
# Judge status: Accepted
Y, Z, X =map(int, input().split())
print(X,Y,Z)
# Judge status: Wrong Answer
n = int(input())
B = list(map(int, input().split()))

asum = B[-1]
before_b = B[0]
for i in range(1, n-1):
    asum += min(B[i], before_b)
    before_b = B[i]

if n == 2:
    asum += B[-1]

print(asum)
# Judge status: Accepted
if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    count = 0
    for i in range(1,a[0]+1):
        s = str(i)
        sumN = 0
        for j in s:
            sumN += int(j)

        if a[1] <= sumN and a[2] >= sumN:
            count+=i
    print(count)
# Judge status: Accepted
X, N = list(map(int, input().split()))
if N > 0:
    P = list(map(int, input().split()))
    l = X
    h = X
    while True:
        if l not in P:
            print(l)
            break
        if h not in P:
            print(h)
            break
        l -= 1
        h += 1
else:
    input()
    print(X)
# Judge status: Wrong Answer
N, T = map(int, input().split())
List = []
List2 = []
min = 1000

for i in range(N):
    M, B = map(int, input().split())
    List.append([M,B])
    M, B = 0, 0

for k in range(N):
    if int(List[k][1]) <= T:
        List2.append(List[k])

for n in range(len(List2)):
    if List2[n][0] <= min:
        min = List[n][0]

if min == 1001:
    print('TLE')
else:
    print(min)
# Judge status: Wrong Answer
from functools import reduce
MOD = 10**9 + 7


def cmb(N, A):
    num = reduce(lambda x, y: x * y % MOD, range(N, N - A, -1))
    den = reduce(lambda x, y: x * y % MOD, range(1, A + 1))
    return num * pow(den, MOD - 2, MOD) % MOD


n, a, b = map(int, input().split())
a %= MOD
b %= MOD


print((pow(2, n, MOD) - cmb(n, a) - cmb(n, b)) % MOD)
# Judge status: Accepted
s = input()
k = int(input())
n = len(s)

S = list(s)

import string
A = [chr(i) for i in range(ord("a"), ord("z")+1)]
B = {}
for i in range(26):
    B[A[i]] = i

for i in range(n):
    if S[i] != "a" and 26 - B[S[i]] <= k:
        k -= 26 - B[S[i]]
        S[i] = "a"
        
# print(k)
if k > 0:
    S[-1] = A[(B[S[-1]] + k) % 26]

# print(S)

print("".join(S))
# Judge status: Accepted
N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))

wa1 = [0]*N
wa2 = [0]*N
wa1[0] = A1[0]
wa2[0] = A2[0]
ans = 0

for i in range(1,N):
    wa1[i] = wa1[i-1]+A1[i]
    wa2[i] = wa2[i-1]+A2[i]
    
for i in range(N):
    if i == 0:
        tmp = wa1[i] + wa2[-1]
    else:
        tmp  = wa1[i] + (wa2[-1]-wa2[i-1]) 
    ans = max(ans,tmp)
    
print(ans)
# Judge status: Accepted
n=int(input())
s=list(input())
b2=s.count("#")
w2=s.count(".")
b1=0
w1=0
ans=w2
for i in range(n):
    if s[i]=="#":
        b1+=1
        b2-=1
    else:
        w1+=1
        w2-=1
    ans=min(ans,b1+w2)
print(ans)
# Judge status: Accepted
N = int(input())
a = [int(input()) for _ in range(N)]
log = set()
i = 0
count = 1
while a[i] != 2:
  i = a[i] - 1
  if i in log:
    print(-1)
    break
  else:
    log.add(i)
    count += 1
else:
  print(count)
# Judge status: Wrong Answer
S = input()
K = int(input())

if len(S) == 1:
    print(S)
    exit()

answer = S[1]
print(answer)
# Judge status: Accepted
from collections import deque

N = int(input())
Monsters = deque(map(int, input().split()))
Fighters = deque(map(int, input().split()))

Knockouts = 0
prev_ftr = 0

while len(Monsters) > 0:
  mon = Monsters.popleft()
  ko1 = min(mon, prev_ftr)
  #print(mon, prev_ftr, ko1)
  Knockouts += ko1
  mon -= ko1

  if len(Fighters) > 0:
    ftr = Fighters.popleft()
    ko2 = min(mon, ftr)
    #print(mon, ftr, ko2)
    Knockouts += ko2
    mon -= ko2
    prev_ftr = ftr - ko2

print(Knockouts)
# Judge status: Accepted
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))
l = []
for i in h:
  l.append(abs(t-i*0.006 - a))
print(l.index(min(l))+1)
# Judge status: Accepted
A,B,C,K=map(int,input().split())

if K%2==0:
    print(A-B)
else:
    print(B-A)
# Judge status: Wrong Answer
import sys
from collections import Counter
input = sys.stdin.readline

X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort()
q.sort()
r.sort()

p = p[-X:]
q = q[-X:]

p.extend(q)
p.extend(r)

p.sort()

print(sum(p[-(X+Y):]))
# Judge status: Accepted
n,m = map(int,input().split())
s = [0] * m
c = [0] * m
def ret():
	print(0)
	return
for i in range(m):
	s[i],c[i] = map(int,input().split())

def ret1():
	for i in range(0 if n == 1 else 10**(n-1),10**n):
		flag = 1
		for j in range(m):
			if i//(10**(n-s[j]))%10 != c[j]:
				flag = 0
		if flag == 1:
			print(i)
			return
	print(-1)
	return

if m == 1 and n == 1 and c[0] == 0:
	ret()
else:
	ret1()
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    n,p=map(int,input().split())
    A=list(map(int,input().split()))
    even=0
    odd=0
    for i in range(n):
        if A[i]%2==0:
            even+=1

    odd=n-even
    if odd==0:
        print(2**n if p==0 else 0)
    else:
        print((2**even)*2**(odd-1))



resolve()
# Judge status: Accepted
s = input().split()
for i in range(5):
    if s[i] == "0":
        print(i+1)
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if max(a, b, c, d, e) - min(a, b, c, d, e) > k:
  print(':(')
else:
  print('Yay!')
# Judge status: Wrong Answer
s = input()
left = 0
cou = 0
l = [0 for i in range(len(s)+1)]
for i in range(len(s)):
  s1 = s[i]
  a1 = l[i]
#  print(s1,l,cou)
  if s1=='<':
    l[i+1] = l[i]+1
    left = 0
  else:
    l[i+1] = l[i]-1
    left += 1
    if l[i+1]>=0:
      l[i+1] = 0
      left = 0
    else:
      l[i+1] =0
      cou += left
print(cou+sum(l))
# Judge status: Accepted
N=int(input())
S=input()
if S[:N//2]==S[N//2:]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import math

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

L = [0 for i in range(N+1)]
R = [0 for i in range(N+1)]

for i in range(N):
    L[i+1] = math.gcd(L[i], A[i])
    R[N - (i+1)] = math.gcd(R[N - i], A[N - (i+1)])

print(max([math.gcd(L[i], R[i+1]) for i in range(N)]))
# Judge status: Accepted
n = int(input())

ans = 0

for i in range(1,n+1):
    yakusu = []
    for j in range(1,i+1):
        if i % j == 0:
            yakusu.append(i)
    if i % 2 == 1 and len(yakusu) == 8:
        ans +=1
print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())


print(max((c - (a - b)),0))
# Judge status: Wrong Answer
N, D = [int(i) for i in input().split()]
n = N // D
print((n - (n // 2)))
# Judge status: Accepted
a, b, c = input().split()

flag = bool

if a == '5' and b =='7' and c=='5':
    flag = True
if a =='7' and b=='5' and c == '5':
    flag = True
if a =='5' and b=='5' and c == '7':
    flag = True

if flag == True:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
N = int(input())
*A, = map(int, input().split())
aa = A + A
aa.sort(reverse=True)
ans = 0
for i in range(1, N):
    ans += aa[i]
print(ans)
# Judge status: Wrong Answer
from collections import defaultdict
N = int(input())

A = list(map(int, input().split()))
stick = defaultdict(int)

for a in A:
  stick[a] += 1

stick = {key: value for key, value in stick.items() if value >= 2}


if len(stick) >= 2:
  len1 = max(stick.keys())
  stick.pop(len1)
  len2 = max(stick.keys())
  print(len1 * len2)
else:
  print(0)
# Judge status: Accepted
N, A, B = map(int, input().split())
tmp = N%(A+B)
if tmp>A:
    tmp=A
ans = (N//(A+B))*A + tmp
print(ans)
# Judge status: Accepted
def rounder(x):
    flt = x - int(x)
    if flt>=0.5:
        return int(x)+1
    else:
        return int(x)

def main():
    a, b = map(int, input().split())
    A = list(range(rounder(a/0.08), rounder((a+1)/0.08)))
    B = list(range(rounder(b/0.10), rounder((b+1)/0.10)))
    r = -1

    for i in range(len(B)):
        if B[i] in A:
            r = B[i]
            break
    print(r)

main()
# Judge status: Accepted
X, Y = map(int, input().split())
ans = 1
i = X
while i * 2 <= Y: 
  i *= 2
  ans += 1
print(ans)
# Judge status: Accepted
s = input()
replace_num = '8'
print(s[:3]+replace_num+s[4:])
# Judge status: Wrong Answer
N = int(input())
print((10**N - 9 ** N - 9**N + 8**N) % (10**9 - 7))
# Judge status: Accepted
weatherS = input()
p = weatherS[0] == 'R'
q = weatherS[1] == 'R'
r = weatherS[2] == 'R'

if p and q and r:
    serial = 3
elif (p and q) or (q and r):
    serial = 2
elif p or q or r:
    serial = 1
else:
    serial = 0

print(serial)
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))
ans = 'Yes'
temp = h[0]
for i in range(1,n):
  if h[i]>temp:
    h[i] -= 1
  elif temp>h[i]:
    ans = 'No'
  temp = h[i]
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

if N == 2:
    print((A[0]*A[1])%(10**9+7))
B = [0]*(N-1)
B[N-2] = A[N-1]

for i in range (3, N+1):
    B[N-i]=B[N-i+1]+A[N-i+1]

count = 0
for i in range (0, N-1):
    count+=(A[i]*B[i])

print(count%(10**9+7))
# Judge status: Accepted
a,b = map(str,input().split())
b = b[0] + b[2:]
a,b = int(a),int(b)
print(a*b//100)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))

ans = 1

for i in range(1, n):
    if p[i] <= p[i-1]:
        ans += 1

print(ans)
# Judge status: Accepted
import sys
n = int(input())

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

for i in range(a, b+1):
  if i % n == 0:
    print("OK")
    sys.exit()
print("NG")
# Judge status: Wrong Answer
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
LIST = lambda: list(map(int, INPUT().split()))

sys.setrecursionlimit(10 ** 9)


def main():
    N = INT()
    L = LIST()

    one = L[0]
    others = 0
    for i in range(N-1):
        if L[i] < L[i+1]:
            one = L[i+1]
            others += L[i]
        else:
            others += L[i+1]

    print("Yes" if one < others else "No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
A,B,C = map(int,input().split())

sum = C
ans = 'NO'
cnt = 0

while cnt < A:
    sum += B
    if sum % A == 0:
        print('YES')
        exit()
    cnt += 1
print('NO')
# Judge status: Accepted
s = input()

cnt = [1] if s[0] == "<" else [0, 1]

bc = s[0]

for i in range(1, len(s)):
    if s[i] == bc:
        cnt[-1] += 1
    else:
        cnt.append(1)
    bc = s[i]

if len(cnt) % 2 == 1:
    cnt.append(0)


ans = 0

for i in range(0, len(cnt), 2):
    ma = max(cnt[i], cnt[i + 1])
    mi = min(cnt[i], cnt[i + 1])
    ans += max(0, ma * (ma + 1) // 2)
    ans += max(0, (mi - 1) * mi // 2)

print(ans)
# Judge status: Wrong Answer
D, N = map(int, input().split())
print(N * (100**D))
# Judge status: Wrong Answer
A,B,C,D=map(int,input().split())

print(max((B-C)-A,0))
# Judge status: Accepted
(K,) = [int(x) for x in input().split()]
ans = 0
seven = 7
for i in range(1000000):
    if seven % K == 0:
        print(i + 1)
        break
    seven = (10 * seven + 7) % K
else:
    print(-1)
# Judge status: Wrong Answer
N=int(input())
r = 0
for i in range(6,0,-1):
  k = 2**i
  if N >= k:
    r = k
    break
print(r)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
MOD = 10 ** 9 + 7
digit = 60
o=[0]*digit
z=[0]*digit

for i in a:
  for j in range(digit):
    if (i >> j) & 1:
      o[j] += 1
    else:
      z[j] += 1
ans = 0    
for j in range(digit):
  ans += (o[j]*z[j]*pow(2,j,MOD))
print(ans % MOD)
# Judge status: Accepted
N=int(input())
S=input()
A=[0]*N
A[0]=S[1:].count('E')
for i in range(1,N):
    if S[i-1]=='W':
        A[i]=A[i-1]+1
    else:
        A[i]=A[i-1]
    if S[i]=='E':
        A[i]-=1
print(min(A))
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print("NO" if (a%2==1 and c%2==0) or (a%2==0 and c%2==1) else "YES")
# Judge status: Accepted
N, M = map(int, input().split())

s = set()
g = set()

for _ in range(M):
    A, B = map(int, input().split())
    if A == 1:
        s.add(B)
    if B == N:
        g.add(A)

if s & g:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")