peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
# 2020/01/10

from fractions import gcd

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

aa=list(map(lambda x: x//2,a))
lcm=aa.pop()
for e in aa:
    lcm=(lcm*e)//gcd(lcm,e)
print(-(-m//lcm//2) if m>=lcm else 0)
# Judge status: Wrong Answer
from sys import stdin
import fractions

n = int(stdin.readline().rstrip())
li = [[0,0]]+[list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
li = li[::-1]
count = 0
for i in range(n):
    if li[i][0]%li[i][1] != 0:
        count += li[i][1]-li[i][0]%li[i][1]
        li[i+1][0] += count
    print(li)
print(count)
# Judge status: Accepted
a, b, c = map(int, input().split())

if((c-a-b)>0 and (c-a-b)**2>4*a*b):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
h = list(map(int, input().split()))

dp = [0]*N
dp[1] = abs(h[1]-h[0])

for i in range(2,N):
    dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]))

print(dp[-1])
# Judge status: Accepted
n=int(input())
a=[]
for _ in range(n):
    a.append(int(input()))

t=0
for i in range(1,n+1):
    t=a[t]-1
    if t==1:
        print(i)
        break
else:
    print(-1)
# Judge status: Wrong Answer
N, K = map(int, input().split())
D = set(map(int, input().split()))
while True:
    if set(str(N)) == set(str(N)) - D:
        print(N)
        break
    else:
        N += 1
# Judge status: Wrong Answer
a, b = map(int, input().split())
print(abs((a%b)-(a//b)))
# Judge status: Accepted
Tap = input()
len_Tap = len(Tap)
count = 0

for i in range(len_Tap):
    if (i+1) % 2 == 1:
        if Tap[i] == 'R' or Tap[i] == 'U' or Tap[i] == 'D':
            count += 1
    
    else:
        if Tap[i] == 'L' or Tap[i] == 'U' or Tap[i] == 'D':
            count += 1

if count == len_Tap:
    print('Yes')

else:
    print('No')
# Judge status: Accepted
N = int(input())
plus = []
minus = []
for _ in range(N):
    x, y = map(int, input().split())
    plus.append(x + y)
    minus.append(x - y)

print(max(max(plus) - min(plus), max(minus) - min(minus)))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
ans=1
if 0 in a:
    ans=0
else:
    for i in a:
        ans*=i
        if ans>10**18:
            ans=-1
            break
print(ans)
# Judge status: Accepted
a, s, c = map(str, input().split())

print(a[0]+s[0]+c[0])
# Judge status: Accepted
n,x=map(int,input().split())
l=list(map(int,input().split()))
sumd=0
for i in range(n):
  sumd+=l[i]
  if sumd>x:
    print(i+1)
    exit()
print(i+2)
# Judge status: Accepted

import sys

# 再起回数上限変更
sys.setrecursionlimit(1000000)

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

if N >= 10:
    print(R)
    sys.exit()

print(R + 100 * (10 - N))
# Judge status: Accepted
hoge = input().split()
K = int(hoge[0])
N = int(hoge[1])
A_list = list(map(int,input().split()))

kankaku = []
for i in range(len(A_list) - 1):
  kankaku.append(A_list[i+1] - A_list[i])
kankaku.append(A_list[0] - A_list[-1] + K)

_kankaku_max = max(kankaku)
print(K - _kankaku_max)
# Judge status: Accepted
n, m = map(int, input().split())

cnt = min(n, m // 2)
print(cnt + (m - cnt * 2) // 4)
# Judge status: Accepted
N = int(input())
A = list(map(int,input(). split ()))
max = 10**18
if 0 in A:
  print(0)
  exit()
  
prod = 1
for a in A:
  prod *= a
  if prod > max:
    print(-1)
    exit()
print(prod)
# Judge status: Wrong Answer
[h,n] = [int(i) for i in input().split()]
ab = []
for i in range(n):
    ab.append([int(j) for j in input().split()])
dp =[0] * 10001 + [10 ** 10] * 10000
for i in range(10001,20000):
    for ls in ab:
        dp[i] = min(dp[i],dp[i-ls[0]]+ls[1])
print(dp[10000+h])
# Judge status: Accepted
from collections import defaultdict

N,K,Q = map(int, input().split())

dic = defaultdict(lambda:0)
for _ in range(Q):
  dic[int(input())] += 1

for i in range(1,N+1):
  if K + dic[i] - Q > 0:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
N, C, K = map(int,input().split())
T = [int(input()) for i in range(N)]

T.sort(reverse=True)

#print(T)
t_before = T[0]
cnt = 0
ans = 0
for t in T:
    #print(t, t_before, cnt, ans)
    if t_before - t <= K and cnt + 1 <= C:
        cnt += 1
        continue
    else:
        t_before = t
        cnt = 1
        ans += 1

print(ans+1)
# Judge status: Accepted
n = int(input())
W = list(map(int,input().split()))
total = sum(W)
ans = total
s1 = 0

for i in range(n-1):
    s1 += W[i]
    ans = min(ans,abs(total-2*s1))
    
print(ans)
# Judge status: Wrong Answer
a = list(map(int,input().split()))

cnt = 1
for i in a:
  if i == 0:
    print(cnt)
    cnt += 1
# Judge status: Wrong Answer
n = int(input())
print(int((n*(n-1))/2))
# Judge status: Wrong Answer
def main():
    N = int(input())
    if N == 1 or N == 2:
        return print(N)
    ans = set()

    for i in range(1, N+1):
        N -= i
        if N in ans or N <= 2:
            N += i
            ans.add(N)
            break
        ans.add(i)
    print(*ans, sep="\n")


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = input(); a = 0; b = 0; c = int(n[0])
for i in range(len(n)):
    if n[i] != "9":
        if a == 0: a += 1; b = i
        else: a += 1
if a == 0: print(9*len(n))
elif a == 1 and b == 0: print(c+9*(len(n)-1))
else: print(c-1+9*(len(n)-1))
# Judge status: Wrong Answer
import numpy as np
# Calculate intensity
N, K = [int(v) for v in input().split(" ")]
A_arr = [int(v) for v in input().split(" ")]
step = np.arange(len(A_arr))
def Luminate(A_arr, i):
  isLuminated = abs(step - i) < np.array(A_arr)+1
  return isLuminated
def get_Intensity(A_arr):
  return [np.sum(Luminate(A_arr, i)) for i in range(len(A_arr))]
Intensity = A_arr
for i in range(K):
  Intensity = get_Intensity(Intensity)
print(Intensity)
# Judge status: Accepted
x=int(input())
s=x//500
a=(x-500*s)//5
print(1000*s+5*a)
# Judge status: Accepted
x,y,z=map(int,input().split())
print((x-z)//(y+z))
# Judge status: Accepted
S = input()
x = y = 0
n = w = s = e = 0
for c in S:
  if c == 'N':
    n += 1
  elif c == 'W':
    w += 1
  elif c == 'S':
    s += 1
  else:
    e += 1
if (n == 0 and s > 0) or (s == 0 and n > 0):
  y = 1
if (w == 0 and e > 0) or (e == 0 and w > 0):
  x = 1
print('Yes' if x == 0 and y == 0 else 'No')
# Judge status: Wrong Answer
import math
a,b,x=map(int,input().split()) 
aa=max(0,2*a**2*b-2*x)
bb=a**3
print(math.degrees(math.atan2(aa,bb)))
# Judge status: Accepted
k = list(map(int, input().split() ) )
t = 1
while k[0] > 0 and k[2] > 0:
  if t == 1:
    k[2] -= k[1]
    t=2
  else:
    k[0] -= k[3]
    t=1
if t==2:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
A,B=map(int,input().split())
if A>=13:
  print(B)
elif A>=6 and A<=12:
  print(B/2)
else:
  print(0)
# Judge status: Accepted
N,L=map(int,input().split())
Aji=[0]*N
Sum=0
AjiMin=10**9
EatApple=0
for i in range(N):
  if i==0:
    Aji[i]=L
  else:
    Aji[i]=Aji[i-1]+1
  Sum+=Aji[i]
  AbsVal=abs(Aji[i])
  if AbsVal<AjiMin:
    AjiMin=AbsVal
    EatApple=Aji[i]
print(Sum-EatApple)
# Judge status: Accepted

def main():
    N,M,X,Y = map(int,input().split())
    x_s = list(map(int,input().split()))
    y_s = list(map(int,input().split()))

    ok = False
    for z in range(X+1,Y+1):
        if z > max(x_s) and z <= min(y_s):
            ok = True
            break

    print("No War" if ok else "War")


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = min(a,key=abs)
c = 0
sum_abs_a = 0
for i in range(n):
  sum_abs_a += abs(a[i])
for i in a:
  if i < 0:
    c += 1
if c % 2 == 0:
  print(sum_abs_a)
else:
  print(sum_abs_a - abs(b)*2)
# Judge status: Accepted
S=input()
print('x' * len(S))
# Judge status: Wrong Answer
n, d = map(int, input().split())

ans = 0
for i in range(n):
    x, y = map(int, input().split())
    if x ** 2 + y ** 2 <= d:
        ans += 1

print(ans)
# Judge status: Wrong Answer
n, k = map(int, input().split())
a = list(map(int, input().split()))
sorted(a)
print(sum(a[:k]))
# Judge status: Wrong Answer
n,m=map(int,input().split())
d=[[] for _ in range(n)]
for i in range(n):
  a,b=map(int,input().split())
  d[i]=(b,a)
d=sorted(d)[::-1]
ans=0
for i,j in d:
  if m<j:continue
  ans+=i
  m-=1
print(ans)
# Judge status: Accepted
N,K = map(int,input().split())

tmp = N // K

if N % K == 0:
    print(0)
else:
    print(1)
# Judge status: Accepted
s = input()
weekdays = ('SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT')
i = weekdays.index(s)
print(7 - i)
# Judge status: Accepted
#!/usr/bin/env python

from typing import List


def f(n: int, a_list: List[int]) -> int:
    """
    >>> f(5, [2, 1, 5, 4, 3])
    4
    """
    ans = 0

    n_max: int = a_list[0]
    for i, a_i in enumerate(a_list):
        if n_max > a_i:
            ans += n_max - a_i
        else:
            n_max = a_i

    return ans


if __name__ == '__main__':
    n = int(input())
    a_list = list(map(lambda x: int(x), input().split()))
    print(f(n, a_list))
# Judge status: Accepted
n = input()
a = int(n[:3])
b = int(n[1:])
if a%111 == 0 or b%111 == 0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n, k = map(int, input().split())
pos_num = []
for i in range(n+2):
    st_num = int((i*(i-1))/2)
    ed_num = int(((2*n-i+1)*i)/2)
    # print(i,st_num,ed_num)
    pos_num.append(ed_num-st_num+1)
print(sum(pos_num[k:])%(10**9+7))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=1
flag=0
for i in range(n-1):
  if a[i+1]>a[i]:
    if flag==-1:
      ans+=1
      flag=0
    else:
      flag=1
  if a[i+1]<a[i]:
    if flag==1:
      ans+=1
      flag=0
    else:
      flag=-1
print(ans)
# Judge status: Wrong Answer
S = [c for c in input()]
len_s = len(S)
for i in range(2,len_s//2+2,2):
    a = S[:(len_s-i)//2]
    b = S[(len_s-i)//2:len_s-i]
    if a == b:
        print(len(a) + len(b))
        exit()
# Judge status: Accepted
N = int(input())
cmin = 10**5
for x in range(1,N):
    y = str(N-x)
    x = str(x)
    cnt = 0
    for i in range(len(x)):
        cnt += int(x[i])
    for j in range(len(y)):
        cnt += int(y[j])
    cmin = min(cmin,cnt)
print(cmin)
# Judge status: Wrong Answer
n=int(input())
abc=[list(map(int,input().split())) for i in range(n)]
dp=[[0,0,0] for _ in range(n+1)]
for i in range(n):
  for a in range(3):
    for b in range(3):
      if a!=b:
        dp[i+1][a]=max(dp[i][b]+abc[i][a],dp[i+1][a])
      else:
        dp[i+1][a]=0
print(max(dp[n]))
# Judge status: Accepted
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x:x[0])
#print(ab)
money = 0
buy = 0

for i in range(n):
    if buy < m:
        money += ab[i][0]*min(ab[i][1], m-buy)
        buy += min(ab[i][1], m-buy)
    if buy == m:
        break
print(money)
# Judge status: Accepted
a, b=map(int,input().split())
if a > b:
    print(a-1)
else:
    print(a)
# Judge status: Accepted
N,K = list(map(int,input().split()))
LIST_A = list(map(int,input().split()))

for i in range(N-K):
  target_1 = LIST_A[i+K]-LIST_A[i]  
  if target_1 > 0:
    print("Yes")
  else:
    print("No")
# Judge status: Accepted
N=int(input())
A=list(map(int, input().split()))
MOD=1000000007
s=0
for i in range(1,N):
    s+=A[i]
    s%=MOD

ans=0
for i in range(N-1):
    ans+=A[i]*s
    ans%=MOD
    s-=A[i+1]
    s%=MOD
    
print(ans%MOD)
# Judge status: Wrong Answer
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main(x):
        xlen=len(x)
        if x[:xlen//2]==x[xlen//2:]:
            return True
        else:
            return False
    s=input()
    if len(s)==2:
        print(1)
    else:
        for i in range(2,len(s),2):
            if main(s[:-i]):
                print(len(s[:-i]))
resolve()
# Judge status: Accepted
n,m=map(int,input().split())
l=sorted([list(map(int,input().split())) for i in range(n)])
p=0
for i in range(n):
    a,b=l[i]
    if b<m:
        m-=b
        p+=a*b
    else:
        p+=a*m
        break
print(p)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
s, t = input().split()
res = s + t
print(res)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
box = [0]*n
box_list = []

for i in range(n-1,-1,-1):
    now = i+1
    if a[i] == 0:
        if sum(box[i+now::now])%2 == 1:
            box[i] = 1
            box_list.append(i)
    else:
        if sum(box[i+now::now])%2 == 0:
            box[i] = 1
            box_list.append(i)

print(len(box_list))
for i in box_list:
    print(i+1)
# Judge status: Wrong Answer
n, m = map(int, input().split())
N = [0]*n
ac = 0
wa = 0
wa_ = 0
for i in range(m):
  p, s = map(str, input().split())
  p = int(p)
  if N[p-1]==0:
    if s=='WA':
      wa_+=1
    elif s=='AC':
      ac+=1
      N[p-1]=1
      wa+=wa_
      wa_=0
print(ac, wa)
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
cnt = 0
for i in range(1,100):
    if a % i == 0 and b % i == 0:
        cnt += 1
        if cnt == k:
            print(i)
            exit(0)
# Judge status: Accepted
a=list(map(int,input().split()))
 
if a[0]+a[2]==2*a[1]:
  print('YES')
 
else:
  print('NO')
# Judge status: Accepted
n = int(input())
print(int(n*(n+1)/2))
# Judge status: Accepted
s = input()

if len(s) % 2 == 0:
  for i in range(len(s) // 2):
    if s[2 * i] != "h" or s[2 * i + 1] != "i":
      print("No")
      break
  else:
    print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
def f(n):
  if 1<=n<10:
    return "00"+str(n)
  elif n<100:
    return "0"+str(n)
  else:
    return str(n)
n=int(input())
if n<=999:
  print("ABC"+f(n))
else:
  print("ABD"+f(n-999))
# Judge status: Accepted
s=input()
print('2018'+s[4:])
# Judge status: Accepted
com = input()
if com[0] == com[1] == com[2]:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
smii = lambda: sorted(map(int, input().split()))

# ----------

S = si()
N = len(S)
a = [0] * (N + 1)

for i in range(N):
    if S[i] == "<":
        a[i+1] = max(a[i+1], a[i]+1)

for i in reversed(range(N)):
    if S[i] == ">":
        a[i] = max(a[i+1]+1, a[i])

print(sum(a))
# Judge status: Accepted
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    A = LI()

    if sum(A) >= 22:
        print('bust')
    else:
        print('win')

if __name__ == '__main__':
    resolve()
# Judge status: Accepted
N=int(input())
M=10**9+7
K=1

for i in range(1,N+1):
    K=(K*i)%M
print(K)
# Judge status: Accepted
print(len({int(_) for _ in input().split()}))
# Judge status: Accepted
S = input()

ans = False
if S == 'keyence':
    ans = True
elif S.startswith('keyence') or S.endswith('keyence'):
    ans = True
else:
    for i in range(len(S)):
        for j in range(i, len(S)):
            p1 = S[:i]
            b = S[i:j+1]
            p2 = S[j+1:]
            # print(p1, b, p2)
            if p1 + p2 == 'keyence':
                ans = True

if ans:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
n = int(input())
list_w = [input() for s in range(0, n)]
for i in range(0, n):
    if i == 0 or (list_w[i - 1][-1] == list_w[i][0]) and list_w[i] not in list_w[:i]:
        print(list_w[i])
        continue
    else:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
a=input()
b=input()
print("YES" if (a[0]==b[2] and a[1]==b[1] and a[2]==b[0]) else "NO")
# Judge status: Accepted
l=list(map(int,open(0).read().split()));print(sum(sorted(l[2:])[:l[1]]))
# Judge status: Accepted
x = input()

cnt = 0
numt = 0
x = x[::-1]
for i in range(len(x)):
    if x[i] == 'T':
        numt += 1
    else:
        if numt > 0:
            cnt += 1
            numt -= 1
print(len(x)-2*cnt)
# Judge status: Accepted
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

from collections import Counter

n = ii()
A = iil()
s = sum(A)
d = Counter(A)

q = ii()

for i in range(q):
    b,c = iim()
    m = d.pop(b,0)
    if m:
        d[c] = d.get(c,0)+m
    s += (c-b)*m
    print(s)
# Judge status: Accepted
n = int(input())
s = list(map(int,input().split()))
flag = 1
for i in range(n):
    if s[i] == flag:
        flag += 1
if 1 not in s:
    print(-1)
else:
    print(n - flag +1)
# Judge status: Wrong Answer
def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    return a / (gcd(a, b) * b) 
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    ans = lcm(ans, n)
print(int(ans))
# Judge status: Accepted
a, b, c = sorted(map(int, input().split()))

c1 = c // 2
c2 = c - c1

print((c2 - c1) * a * b)
# Judge status: Accepted
# cf. #6489625
s = int(input())
a = 10**9
c = (a - s%a)%a
b = (s+c)//a
print(0,0,a,1,c,b)
# Judge status: Accepted
a=int(input())
b=int(input())
c=int(input())
x=int(input())

count=0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500+j*100+k*50==x:
        count+=1
      
    
print(count)
# Judge status: Accepted
N, K = map(int, input().split())
S = input()
cnt = 0
for i in range(1, N):
    if S[i] == S[i-1]:
        cnt += 1
ans = min(cnt + 2 * K, N-1)
print(ans)
# Judge status: Accepted
n, m, x, y = map(int, input().split())
xm = list(map(int, input().split()))
ym = list(map(int, input().split()))
print('No War' if max([x] + xm) < min([y] + ym) else 'War')
# Judge status: Wrong Answer
s = input()
a = ['A','T','G','C']
ans = []
c = 0

for i in s:
    if i in a:
        c += 1
    else:
        ans += [c]
        c = 0
if ans == []:
    print(len(s))
else:
    print(max(ans))
# Judge status: Accepted
x = int(input())
if x<=599 and x>=400:
  print(8)
elif x<=799 and x>=600:
  print(7)
elif x<=999 and x>= 800:
  print(6)
elif x<=1199 and x>= 1000:
  print(5)
elif x<=1399 and x>= 1200:
  print(4)  
elif x<=1599 and x>= 1400:
  print(3)
elif x<=1799 and x>= 1600:
  print(2)
elif x<=1999 and x>= 1800:
  print(1)
# Judge status: Accepted
import sys
input = sys.stdin.readline

# A - Airport Bus
N, C, K = map(int, input().split())
times = []

for i in range(N):
	T = int(input())
	t = [T, T + K]
	times.append(t)

times.sort(key=lambda x: x[1])

ans = 0
count = 0
departure_time = 0

for t in times:
	if count == 0:
		departure_time = t[1]
		count = 1
	elif count < C:
		if t[0] <= departure_time:
			count += 1
		else:
			ans += 1
			departure_time = t[1]
			count = 1
	elif count == C:
		ans += 1
		departure_time = t[1]
		count = 1

if count <= C:
	ans += 1

print(ans)
# Judge status: Accepted
n=int(input())
v=list(map(int,input().strip().split()))
a=[0]*n
for i in range(n-1,-1,-1):
  c=0
  for j in range(i,n,i+1):
    c ^= a[j]
  if c != v[i]:
    a[i] = 1
ans = []
for i in range(n):
  if a[i]: ans.append(i+1)
print(len(ans))
print(*ans)
# Judge status: Accepted
def mbisect(ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    return ok


def check(mid):
    if mid == 0:
        return False
    cnt = 0
    for i in a:
        cnt += (i + mid - 1) // mid - 1
    return cnt <= k


n, k = map(int, input().split())
a = tuple(map(int, input().split()))
print(mbisect(10 ** 9, -1))
# Judge status: Accepted
n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
    A, B = map(int, input().split())
    a[i], b[i] = A, B

a.reverse()
b.reverse()

ans = 0
for i in range(n):
    if (ans+a[i]) % b[i] == 0:
        cnt = 0
    else:
        cnt = b[i] - ((ans+a[i]) % b[i])
    ans += cnt
print(ans)
# Judge status: Accepted
h,a = map(int,input().split())
if h % a == 0:
  ans = h // a 
else:
  ans = (h // a) + 1
print(ans)
# Judge status: Accepted
import sys

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

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
lcm = 1
for i in a:
    lcm = lcm * i // gcd(lcm,i)
for i in a:
    if (lcm//i)%2 == 0:
        print(0)
        sys.exit()
print((m+lcm//2)//lcm)
# Judge status: Wrong Answer
S = list(input())
print(S)
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
    print('Bad')
else:
    print('Good')
# Judge status: Accepted
l,r,d=list(map(int,input().split()))
p=0
for i in range(l,r+1):
    if i%d==0:
        p+=1
print(p)
# Judge status: Accepted
N, X, Y = map(int, input().split())
count = [0]*N
for i in range(1, N):
    for j in range(i+1, N+1):
        if i <= X and Y <= j:
            # print(i, j, j-i-(Y-X)+1)

            count[j-i-(Y-X)+1] += 1
        else:
            # print(i, j, j-i)
            # min((j-i), abs(X-i)+abs(Y-j)+1)

            count[min((j-i), abs(X-i)+abs(Y-j)+1)] += 1
for c in count[1:]:
    print(c)
# Judge status: Accepted
S = input()
if 'A' in S and 'B' in S:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
ans = 10**9
for i in range(1,n):
    s = sum(a[:i])
    f = abs(sum(a)-2*s)
    ans = min(ans, f)
print(ans)
# Judge status: Accepted
import bisect

n = int(input())
A = list(map(int, input().split()))
A.sort()
ama = A[-1]
print(ama, end=' ')
ama2 = (ama + 1)//2
w = bisect.bisect_left(A, ama2)

a = A[w-1]
b = A[w]
if abs(a-ama2) > abs(b-ama2):
    print(b)
else:
    print(a)
# Judge status: Accepted
from collections import OrderedDict
n, m = map(int,input().split())
 
aclist = [0]*n
walist = [0]*n
wa = 0
for i in range(m):
  pp, s = input().split()
  p = int(pp) - 1
  if s == 'AC':
    if not aclist[p]:
      aclist[p] = 1
      wa += walist[p]
  else:
    if not aclist[p]:
      walist[p] += 1
"""
  pp, s = input().split()
  p = int(pp) - 1
  if s == 'AC' and not aclist[p]:
    aclist[p] = 1
    ac += 1
    wa += walist[p]
  else:
    walist[p] += 1
"""
print(sum(aclist), wa)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
if b -a==c-b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def main():
    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(reverse=True)
    Q.sort(reverse=True)
    PQR = P[:X] + Q[:Y] + R
    PQR.sort(reverse=True)    
    print(sum(PQR[:X+Y]))
    

if __name__ == "__main__":
    main()
# Judge status: Accepted
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
ans = 0
MOD = 10**9+7

for i in range(63):
    one, zero = 0, 0
    
    for Aj in A:
        if (Aj>>i)&1:
            one += 1
        else:
            zero += 1
    
    ans += 2**i*one*zero
    ans %= MOD

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

ans=0
for i in range(1,n+1):
  s=str(i)
  s=sum(list(map(int,s)))
  if a<=s<=b:
    ans+=1
print(ans)
# Judge status: Accepted
a = int(input())
print(a+a**2+a**3)
# Judge status: Accepted
import sys

N = int(input())
S = input()

W = [0]*N
E = [0]*N
ans = N
for i in range(1, N):
    W[i] = W[i-1]+1 if S[i-1]=='W' else W[i-1]
    E[-i-1] = E[-i]+1 if S[-i]=='E' else E[-i]

for i in range(N):
    ans = min(W[i]+E[i], ans)

print(ans)
# Judge status: Accepted
w,a,b=map(int,input().split())
ans=max(a,b)-min(a,b)-w
if ans<=0:
    print(0)
else:
    print(ans)
# Judge status: Accepted
s = int(input())
a = [s]

for i in range(0,1000000):
  if a[i]%2 ==0:
    a.append(a[i]/2)
  else:
    a.append(3*a[i] +1)
  if a[i] in a[:i]:
    print(i+1)
    exit()
# Judge status: Accepted
a=int(input())
s=input()

if a>=3200:
    print(s)
else:
    print('red')
# Judge status: Accepted
import sys

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

for n in range(N+1):
    for m in range(M+1):
        if N*m + M*n - n*m*2 == K:
            print("Yes")
            sys.exit()

print("No")
# Judge status: Accepted
N = int(input())
mod = 10 ** 9 + 7

e = pow(8, N, mod)
f = pow(9, N, mod)
g = pow(10, N, mod)

# 全体 - (0を含まない + 9を含まない) + 0と9どちらも含まない
ans = (g - 2 * f + e) % mod
print(ans)