peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
a -= 1
b -= 1
c -= 1
d -= 1
s = input()
def is_a(x, y):
  for i in range(x, y-1):
    if s[i]==s[i+1]=="#":
      return False
  return True
def is_f(x, y):
  for i in range(x, y+1):
    if s[i-1]==s[i]==s[i+1]==".":
      return True
  return False

ans = "No"
if is_a(a, b) and is_a(c, d):
  if c < d or is_f(b, d):
    ans = "Yes"
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
mod = 10**9+7
a = [int(input()) for _ in range(m)]
s = [0]*(n+1)
s[0],s[1]=1,1
for i in range(2,n+1):
  s[i] = (s[i-1]+s[i-2])%mod
if m == 0:
  print(s[n])
  quit()
ans = s[a[0]-1]
for i in range(1,m):
  if a[i]-a[i-1] == 1:
    print(0)
    quit()
  ans = (ans*s[a[i]-a[i-1]-2])%mod
print((ans*s[n-a[m-1]-1])%mod)
# Judge status: Accepted
from collections import deque
k = int(input())
q = deque([1,2,3,4,5,6,7,8,9])
for i in range(k):
  x = q.popleft()
  y = x%10
  if y != 0:
    q.append(10*x+y-1)
  q.append(10*x+y)
  if y != 9:
    q.append(10*x+y+1)
print(x)
# Judge status: Accepted
S = input()
N = len(S)

def isPalindrome(S, i, j):
    i = int(i)
    j = int(j)
    while S[i] == S[j]:
        i+=1
        j-=1
        if i >= j:
            return True
    return False

if isPalindrome(S, 0, N-1) and isPalindrome(S, 0, (N-1)/2-1) and isPalindrome(S, (N+3)/2-1, N-1):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N=int(input())
A=[list(map(int,input().split())) for _ in range(2)]
sum1=[0]
sum2=[0]
for i in range(N):
    sum1.append(sum1[-1]+A[0][i])
    sum2.append(sum2[-1]+A[1][i])

print(max(sum1[i]+sum2[N]-sum2[i-1] for i in range(1,N+1)))
# Judge status: Wrong Answer
n,x=map(int,input().split())
a=sorted([int(i)for i in input().split()])
res=0
if sum(a)==x:
    res=n
else:
    for i in range(n):
        if sum(a[:i])<=x:res=len(a[:i])-1
print(max(0,res))
# Judge status: Accepted
c=input()
if c in "aioue":
  print("vowel")
else:
  print("consonant")
# Judge status: Accepted
a,b = map(int,input().split())
s = input()
if s.count('-') == 1 and s[a] =='-':
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import sys

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

loop = 0

while (1):
  for i in l:
    if (i % (2 ** loop) != 0):
      print(loop)
      sys.exit(0)
  loop = loop + 1
# Judge status: Accepted
n = int(input())
if n in set([4*i+7*j for i in range(100//4+1) for j in range(100//7+1) if (4*i+7*j)<=100]):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from math import ceil
n= int(input())
print(ceil(n/2)/n)
# Judge status: Wrong Answer
x,n = map(int,input().split())
if n==0: exit(print(x))
p = list(map(int,input().split()))
p.sort()
if x not in p: exit(print(x))
h=1000
l=1000
for i in range(x,101):
    if i not in p:
        h = i
        break
for i in range(x,0,-1):
    if i not in p:
        l = i
        break
if abs(x-h)>=abs(x-l): print(l)
if abs(x-l)>abs(x-h): print(h)
# Judge status: Wrong Answer
n, k = map(int, input().split())
h = list(map(int, input().split()))
INF = 10 ** 7
D = [INF] * n
D[0] = 0
for i in range(n):
    for j in range(1, k + 1):
        if i >= j:
            D[i] = min(D[i], D[i - j] + abs(h[i] - h[i - j]))
print(D[-1])
# Judge status: Accepted
p = 0
f = 0
n, a, b = map(int, input().split())
for i in input():
    if i == "a" and p < a+b:
        p += 1
        print("Yes")
    elif i == "b" and p < a+b and f < b:
        p += 1
        f += 1
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
import numpy as np
n,m=map(int, input().split())
a=set(int(input())  for i in  range(m))
x=(10**9)+7

dp=np.array([0]*(n+1))
dp[0]=1
if 1 not in a:
  dp[1]=1

for i in range(2,n+1):
  if i in a:
    continue
  dp[i]+=dp[i-1]+dp[i-2]
  #print(dp)
  
print(dp[-1]%x)
# Judge status: Wrong Answer
N = int(input())
x = N * 800
y = N / 15 * 200
print(x - y)
# Judge status: Accepted
N=int(input())
s=input()
t=input()
chohuku=0
for i in range(N):
  if s[i:]==t[:N-i]:
    chohuku=len(s[i:])
    break
print(N+N-chohuku)
# Judge status: Wrong Answer
x,n=map(int,input().split())
p=[int(x) for x in input().split()]
min=x
gap=x
for i in range(102):
	if i in p:
		continue
	else:
		if abs(x-i) < gap:
			gap=x-i
			min=i
print(min)
# Judge status: Accepted
n,a,b = map(int, input().split())
ab = a+b
s = input()

cap_a,cap_b = 0,0

for i in range(n):
	if s[i] == "a":
		if cap_a+cap_b < ab:
			print("Yes")
			if cap_a < a:
				cap_a += 1
			else:
				cap_b += 1
		else:
			print("No")
	elif s[i] == "b":
		if cap_a+cap_b < ab and cap_b < b:
			print("Yes")
			cap_b += 1
		else:
			print("No")
	else:
		print("No")
# Judge status: Accepted
n = int(input())
if n >= 30:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import sys
from io import StringIO
import unittest

sys.setrecursionlimit(100**3)

def rec(n, dp):
	if n <= 1:
		return n
	if dp[n] < float('inf'):
		return dp[n]
	pow6 = 6
	pow9 = 9
	dp[n] = min(n, dp[n])
	while n >= pow6:
		dp[n] = min(dp[n], rec(n-pow6, dp) + 1)
		pow6 *= 6
	while n >= pow9:
		dp[n] = min(dp[n], rec(n-pow9, dp) + 1)
		pow9 *= 9
	return dp[n]

def resolve():
	n = int(input())
	dp = [float('inf')]*(n+1)
	print(rec(n, dp))
resolve()
# Judge status: Accepted
x, a, b = map(int, input().split())
if b<=a:
    print("delicious")
elif b <= a+ x:
    print("safe")
else:
    print("dangerous")
# Judge status: Accepted
n = int(input())
L = list(map(int, input().split()))
lm = max(L)

if sum(L) - lm > lm:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x, y = map(int, input().split())

if y%2!=0 or y>4*x or y<2*x:
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
n,d = map(int,input().split())
ans = 0
for _ in range(n) :
    x,y = map(int,input().split())
    distance = (x**2 + y**2)**1/2
    if distance <= d :
        ans += 1
print(ans)
# Judge status: Wrong Answer
import sys
from collections import Counter

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    s = input()

    res = 1
    D = Counter(s)
    for v in D.values():
        res *= (v + 1)
    print(res - 1)


if __name__ == '__main__':
    resolve()
# Judge status: Accepted
N = int(input())

cnt = [[0 for i in range(10)] for j in range(10)]

for i in range(1, N+1):
    i_str = str(i)
    cnt[int(i_str[0])][int(i_str[-1])] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += cnt[i][j] * cnt[j][i]

print(ans)
# Judge status: Accepted
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

x = int(input())
ans = 1
if x < 1800:
    ans = 2
if x < 1600:
    ans = 3
if x < 1400:
    ans = 4
if x < 1200:
    ans = 5
if x < 1000:
    ans = 6
if x < 800:
    ans = 7
if x < 600:
    ans = 8
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())
X = b - a
ans = 0
for i in range(X):
    ans += i
print(ans)
# Judge status: Accepted
X = input()

stacks = []
for i in range(len(X)):
    if not stacks:
        stacks.append(X[i])
    elif stacks[-1] == "S" and X[i] == "T":
        del stacks[-1]
    else:
        stacks.append(X[i])

print(len(stacks))
# Judge status: Wrong Answer
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
list = []
for i in H:
    list.append(T - (i * 0.006))
for i in range(len(list)):
    list[i] = A - list[i]
print(list.index((min(list))) + 1)
# Judge status: Accepted
import collections
n = int(raw_input())
ais = map(int,[raw_input() for _ in range(5)])
m = min(ais)
print (n + m -1) / m  + 4
# Judge status: Accepted
import numpy as np

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

a.sort()
a = a[::-1]

print(a[0::2].sum() - a[1::2].sum())
# Judge status: Accepted
a, b = [int(x) for x in input().split()]

n = b-a-1
An = n*(n+1)//2

print(An-a)
# Judge status: Accepted
n = int(input())
i = 0
while 1:
    if i*1000 >= n:
        print(i*1000-n)
        break
    else:
        i += 1
# Judge status: Accepted
t = input()
s = ""
for i in t:
    if i == "?":
        s+="D"
    else:
        s+=i
print(s)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
A.sort()
print(sum(A[N::2]))
# Judge status: Accepted
from bisect import bisect_left
n=int(input())
L=sorted((map(int,input().split())))
t=0
for i in range(n-2):
	for j in range(i+1,n-1):
		l=j
		r=n
		while l+1<r:
			c=(l+r)//2
			if L[i]+L[j]>L[c]:
				l=c
			else:
				r=c
		t+=l-j
print(t)
# Judge status: Wrong Answer
N = int(input())
if N < 1000:
    print('ABC'+str(N))
else:
    print('ABD'+str(N+1)[1:])
# Judge status: Accepted
N, M = map(int, input().split())


def divisors(n):
    d = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            d.append(i)
            if i != n // i:
                d.append(n // i)
    return d


d = divisors(M)

ans = 0

for i in d:
    if N * i <= M:
        ans = max(ans, i)

print(ans)
# Judge status: Wrong Answer
n = int(input())
p = tuple(map(int, input().split()))

cnt = 0
for i in range(1, n+1):
    if i != p[i-1]:
        cnt += 1

if cnt > 2:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
s = "".join(sorted(input()))
t = "".join(sorted(input())[::-1])
if s < t:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
X, Y, A, B, C = map(int, input().split())
p = sorted(list(map(int, input().split())), reverse = True)[: X]
q = sorted(list(map(int, input().split())), reverse = True)[: Y]
r = list(map(int, input().split()))

all_apple = sorted(p + q + r, reverse = True)
print(sum(all_apple[: X + Y]))
# Judge status: Accepted
n,k=map(int,input().split())
arr=list(map(int,input().split()))
for i in range(k,n):
  if arr[i]>arr[i-k]:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
def main():
    days = {'SUN':7,'MON':6,'TUE':5,'WED':4,'THU':3,'FRI':2,'SAT':1}
    S = input()
    print(days[S])
    return 0
    
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [float("inf")]*n
for i in range(1, n):
    for j in range(1, k+1):
        if i-j >= 0:
            dp[i] = min(dp[i], dp[i-j] + abs(h[i]-h[i-j]))
print(dp[n-1])
# Judge status: Wrong Answer
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

N = int(input())
A = list(map(int, input().split()))

A.sort()

ans = 0
if A[0] == max(A):
    ans = A[0]
else:
    a = A[0]
    b = 0
    for i in range(1, N):
        if a != A[i]:
            b = A[i]
            break

    ans = gcd(a, b)


print(ans)
# Judge status: Wrong Answer
N,M = map(int, input().split())
l=0
r=N
for _ in range(M):
  ll,rr=map(int,input().split())
  l = max(l,ll)
  r = min(r,rr)
print(rr-ll+1)
# Judge status: Accepted
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

S = str(input())
week = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
print(7 - week.index(S))
# Judge status: Accepted
import math
n=int(input())
num=int(math.sqrt(n*2))
num2=(num*(num+1))//2
num3=n-num2
if num3>num:
    num+=1
    num3-=num
if num3<0:
    num-=1
    num3+=num+1
ans=list(range(1,num+1))
for i in range(num3):
    ans[-i-1]+=1
for i in ans:
    print(i)
# Judge status: Accepted
def main():
    n = int(input())
    # n, k = map(int, input().split())
    # h = list(map(int, input().split()))
    # s = input()

    count = 0
    for i in range(1, n+1):
        i = str(i)
        if len(i) % 2 != 0:
            count += 1
    print(count)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n,x=map(int,input().split())

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

ans=1

cursum=0

for i in range(n):
  cursum+=l[i]
  if cursum <= x:
    ans+=1
    
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
x=max(a,b)
y=min(a,b)

z=max(x-1,y)
print(x+z)
# Judge status: Accepted
n = list(input())
n = list(map(int,n))
m = len(n)
if m == 1:
    print(n[0])
elif len(set(n)) == 1 and n[0] == 9:
    print(9 * m)
elif len(set(n)) == 2 and n[0] != 9 and n[1] == 9:
    print(n[0] + (m - 1) * 9)
else:
    print(n[0] - 1 + (m - 1) * 9)
# Judge status: Accepted
#145 a
r=int(input())
ans=r**2
print(ans)
# Judge status: Wrong Answer
N= input()
if(N[0] == str(7)):
    print("Yes")
elif(N[1] == str(7)):
    print("Yes")
elif(N[2] == str(7)):
    print("Yes")
else:
    print("N0")
# Judge status: Accepted
# -*- coding: utf-8 -*-

import math

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

print(math.ceil((a + b) / 2))
# Judge status: Wrong Answer
import math
#S=input()
#N=int(input())
#A,B,C=input().split()
H1,M1,H2,M2,K=map(int,input().split())
#A=list(map(int,input().split()))
T=math.floor(((H2-H1)*60+(M2-M1))/K)*K
if ((H2-H1)*60+(M2-M1))%K==0:
    T=T-K
if T<=0:
    T==0
print(T)
# Judge status: Accepted
N = int(input())
m = 1
for i in range(2,N+1):
  m = m*i%(10**9+7)
print(m)
# Judge status: Wrong Answer
import math
a,b,x=map(int, input().split())
print(math.floor(b/x)-math.ceil(a/x)+1)
# Judge status: Accepted
n, a, b = map(int, input().split())
ans = n // (a + b) * a
add = n % (a + b)
ans += min(add, a)
print(ans)
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
c=[i for i in range(a, b+1)]
al=a+k
bs=b-k
if al>b:
	al=b
if bs<a:
	bs=a
d=[i for i in range(al, bs+1)]
e=list(set(c)^set(d))
for i in e:
	print(i)
# Judge status: Wrong Answer
n = int(input())
for i in range(n):
    tmp=i*1.08//1
    if tmp==n:
        print(i)
        exit(0)
print(":(")
# Judge status: Accepted
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
bl = True
if S[0] != 'A':
    bl = False
if S[2:-1].count('C') != 1:
    bl = False
if S.count('C') != 1:
    bl = False
for s in S[1:]:
    if s == 'C':
        continue
    if not s.islower():
        bl = False    

print('AC' if bl else 'WA')
# Judge status: Accepted
N = int(input())
Bs = list(map(int, input().split()))
ans = []


def solve(acc, xs):
    head, *tail = xs
    if not acc:
        acc.append(head)
    if not tail:
        acc.append(head)
        return acc

    peek, *_ = tail
    acc.append(min(head, peek))
    return solve(acc, tail)


arr = solve([], Bs)
print(sum(arr))
# Judge status: Accepted
from collections import deque
S = input()
T = input()

s = deque(list(S))
t = deque(list(T))

n = len(s)
for i in range(n):
    if t == s:
        print("Yes")
        break
    a = t.popleft()
    t.append(a)
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
seq = [x for x in input().split(' ')]

b = []

if n % 2 == 0:
    for j in range(n-1, -1, -2):
        b.append(seq[j])
    for i in range(0, n, 2):
        b.append(seq[i])

else:
    b.append(seq[n-1])
    for j in range(0, n-1, 2):
        b.append(seq[j])
    
    for i in range(1, n, 2):
        b.append(seq[i])

print(' '.join(b))
# Judge status: Accepted
N = int(input())

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

a_max = max(a)

half_a = a_max//2

comb = 1000000000
for i in range(N):
    if a[i]==a_max:
        continue
    if comb>abs(half_a-a[i]):
        idx =i
        comb = abs(half_a-a[i])

print(str(a_max) + ' ' + str(a[idx]))
# Judge status: Accepted
N = int(input())

for x in range(50000):
    if x * 108 // 100 == N:
        print(x)
        break
else:
    print(':(')
# Judge status: Accepted
n, m = map(int, input().split())
a = list(map(int, input().split()))
total = sum(a)
p = [el for el in a if el >= (total/(4*m))]
if len(p) >= m:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N=input()

count=0
for i in range(-1,-4,-1):
  if N[i]==N[i+1]:
    count+=1
  else:
    count+=0
if count>=1:
  print("Bad")
else:
  print("Good")
# Judge status: Accepted
#45
a=int(input())
b=int(input())
h=int(input())

print((a+b)*h//2)
# Judge status: Accepted
a,b=map(int,input().split())
print("Yay!" if a<9 and b<9 else ":(")
# Judge status: Accepted
x,y=map(int,input().split())
n=y//x
ct=0
while n>0:
  n//=2
  ct+=1
print(ct)
# Judge status: Accepted
S = int(input())

dp = [0] * (S + 1)
dp[0] = 1
for i in range(3, S + 1):
    dp[i] = sum(dp[:i - 2])

print(dp[S] % (10 ** 9 + 7))
# Judge status: Accepted
def resolve():
  n = int(input())
  ans = 1
  num = 0
  for i in range(1, n+1):
    tmp = 0
    x = i
    while x >= 2 and x % 2 == 0:
      if x % 2 == 0:
        tmp += 1
        x /= 2
        if tmp >= num:
          ans = i
          num = tmp
      else:
        continue

  print(ans)
  return

if __name__ == "__main__":
  resolve()
# Judge status: Wrong Answer
S = input()
if '7' in 'S':
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s=input()
print('ABC' if s=='ARC' else 'ARC')
# Judge status: Wrong Answer
def main():
    from sys import stdin
    r = stdin.readline()[:-1]
    #r = stdin.readlines()

    x, y = map(int, r.split())
    print(x*y//2)
   
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import sys

N = int(input())
H = list(map(int,input().split()))

cnt = 0
for i in range(N-1):
    if(H[i] > H[i+1]):
        tmp = H[i] - 1
        if(tmp != H[i+1] or cnt > 0):
            print('No')
            sys.exit()
        cnt += 1
print('Yes')
# Judge status: Accepted
N, K = map(int, input().split())
D = set(list(input()))

for k in range(N, 20 * N):
    if len(set(list(str(k))) & D) == 0:
        print(k)
        exit()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

def gcd(x,y):
  while y:
    x, y = y, x%y
  return x

ll, lr = [0]*n, [0]*n
ll[0], lr[n-1] = a[0], a[n-1]
for i in range(1,n):
  ll[i] = gcd(ll[i-1], a[i])
  lr[n-i-1] = gcd(lr[n-i], a[n-i-1])

print(max(ll[n-2], lr[1], *[gcd(l,r) for l,r in zip(ll[:n-2], lr[2:])]))
# Judge status: Accepted
n = int(input())
cake = n // 4
dou = n // 7
res = "No"
for i in range(cake+1):
    for j in range(dou+1):
        if 4*i + 7*j == n:
            res = "Yes"
print(res)
# Judge status: Wrong Answer
import math

x,y = map(int,input().split())

num = y/x
ans = int(math.log2(num) + 1)

print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
ans=-1
c=int(b*10)
d=int((b+1)*10)
for i in range(c,d):
    if int(i*0.08)==a:
        ans=i
        break
print(ans)
# Judge status: Wrong Answer
import numpy as np

S = str(input())

r = '00'
b = '11'

count=0
i=0
while i < (len(S)-1):
    if r == S[i:i+2]:
        S = S.replace(r,'',1)
        count+=1
        i=0
    if b == S[i:i+2]:
        S = S.replace(b,'',1)
        count+=1
        i=0
    else:
        i+=1
        
print(int(2*count))
# Judge status: Wrong Answer
n = int(input())
if n <= 999:
    ans = 'ABC' + str(n).zfill(3)
else:
    ans = 'ABD' + str(n-1000+1).zfill(3)

print(ans)
# Judge status: Wrong Answer
def solve():
    s = list(input())

    if s[0] == 'B':
        s[0] == ''

    for i in range(1, len(s)):
        if s[i] == 'B':
            s[i-1], s[i] ='', ''


    return ''.join(s)

    
print(solve())
# Judge status: Wrong Answer
# C - Takahashi's Information
a =[list(map(int, input().split())) for i in range(3)]
sum_a = sum(map(sum, a))

for i in range(3,100):
    if sum_a % i == 0 and sum_a // i >= 3:
        print("Yes")
        exit()
    else:
        pass

print("No")
# Judge status: Wrong Answer
s = input()
t = input()

count = 0

for i in range(len(s)):
    if s[i] == t[i]:
        count += 1

print(count)
# Judge status: Accepted
N, M, Q = map(int, input().split())

a,b,c,d = [], [], [], []
for i in range(Q):
    tmp_a, tmp_b, tmp_c, tmp_d = map(int, input().split())
    a.append(tmp_a)
    b.append(tmp_b)
    c.append(tmp_c)
    d.append(tmp_d)

import itertools

ans = {}

for j in itertools.combinations_with_replacement(range(1,M+1), N):
    ans[j] = 0
    for i in range(Q):
        if j[b[i]-1]-j[a[i]-1] == c[i]:
            ans[j] += d[i]
print(max(ans.values()))
# Judge status: Wrong Answer
A, B = map(int, input().split())
if A != 1 or B != 1:
    if A == B:
        print('Draw')
    elif A > B:
        print('Alice')
    elif A < B:
        print('Bob')
else:
    if A == 1 and B != 1:
        print('Alice')
    elif B == 1 and A != 1:
        print('Bob')
    else:
        print('Draw')
# Judge status: Accepted
a,b = map(int,input().split())
P = 'Possible'
if a % 3 == 0:
    print(P)
elif b % 3 == 0:
    print(P)
elif (a + b) % 3 == 0:
    print(P)
else:
    print('Impossible')
# Judge status: Wrong Answer
q, h, s, d = map(int, input().split())
n = int(input())
a = [8*q, 4*h, 2*s, d]

if n == 1:
    a.remove(d)
    price = min(a) / 2
elif n % 2 == 0:
    price = min(a) * n / 2
else:
    price = min(a) * (n-1) / 2
    a.remove(d)
    price = price + min(a) / 2

print(int(price))
# Judge status: Accepted
N = int( input() )
D = list ( int(x) for x in input().split() )

if D[0] != 0:
    ans = 0
else:
    Ds = [ 0 for i in range( max(D) + 1 ) ]

    for i in range( N ):
        Ds[ D[i] ] += 1

    ans = 1

    if Ds[ 0 ] != 1:
        ans = 0
    else:
        for i in range( 1 , max(D) + 1 ):
            ans *= Ds[ i-1 ] ** Ds[i]

            if ans == 0:
                break


print( ans % 998244353 )
# Judge status: Wrong Answer
n = int(input())
a = input().split()
if n > 1:
  s = a[0]
  t = a[0]
  for i in range(1, n):
    if i % 2 == 0:
      s = s + ' ' + a[i]
      t = a[i]+ ' ' + t
    else:
      s = a[i] + ' ' + s
      t = t + ' ' + a[i]
if n == 1:
  s = a[0]
if n % 2 == 1:
  print(s)
else:
  print(t)
# Judge status: Wrong Answer
import sys
S = [chr for chr in input()]
for moji in S:
    S.remove(moji)
    if moji in S:
        print('no')
        sys.exit(0)
print('yes')
# Judge status: Wrong Answer
import math
A = list(map(int, input().split()))
A.sort(reverse=True)
if A[0] % 2 == 0 or A[1] % 2 == 0 or A[2] % 2 == 0:
  ans = 0
else:
  a = A[0] // 2
  b = A[0] - A[0] // 2
  x = a * A[1] * A[2]
  ans = math.floor(x * (b/a - 1))
print(ans)
# Judge status: Accepted
S = input()
first = int(S[:2])
second = int(S[2:])
if 1<=first<=12 and 1<=second<=12:
  print('AMBIGUOUS')
elif 1<=first<=12:
  print('MMYY')
elif 1<=second<=12:
  print('YYMM')
else:
  print('NA')
# Judge status: Wrong Answer
import re
S = input()
T = input()
if not re.match(r"^.*("+"\?"*(len(T)-1)+")",S):
  print("UNRESTORABLE")
else:
  startN=re.match(r"^.*("+"\?"*(len(T)-1)+")",S).span(1)[0]
  S=S[:startN]+T[1:]+S[startN+len(T)-1:]
  S=S.replace("?","a")
  print(S)
# Judge status: Accepted
N = int(input())

CSF = []
for _ in range(N-1):
  C, S, F = map(int, input().split())
  CSF.append((C, S, F))

def cnt(x):
  ret = 0
  for i in range(x, N-1):
    C, S, F = CSF[i]
    if ret < S:
      ret = S
      ret += C
    else:
      ret = -(-ret//F)*F
      ret += C
  return ret

for x in range(N):
  print(cnt(x))
# Judge status: Accepted
S = input()
T = input()
N = len(S)

check = False
for i in range(N):
  S = S[-1] + S[:-1]
  if S == T:
    check = True

print("Yes" if check else "No")
# Judge status: Accepted
n = int(input())
arr = list(map(int, input().split()))
acc = 0
for i in range(n):
  if i % 2 == 0 and arr[i] % 2 == 1:
    acc += 1
print(acc)
# Judge status: Accepted
n = int(input())
a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

def dfs(s, count):
    if len(s) == n:
        print(s)
        return

    for z in range(count + 1):
        dfs(s + a[z], count + 1 if z == count else count)


dfs("", 0)
# Judge status: Accepted
date = input()
list_date = date.split('/')
if int(list_date[0]) <= 2018:
    print('Heisei')
elif int(list_date[0]) <= 2019 and int(list_date[1]) <= 4:
    print('Heisei')
else:
    print('TBD')