peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
# coding: utf-8
# Your code here!

n=int((input()))
a=list(map(int,input().split()))
mod=10**9+7
b=0
for i in a:
    b+=(pow(i,mod-2,mod))
    
tmp=b%mod


def gcd(x,y):
    while y!=0:
        x,y=y,x%y
    return x
    
def lcm(x,y):
    G=gcd(x,y)
    return (x)*(y)*pow(G,mod-2,mod)
    
L=a[0]%mod
for i in a:
    L=lcm(L,i)%mod
    

print(L*tmp%mod)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

lis=[]
for i in range(0,n-1):
  if a[i]==a[i+1]-1:
    lis.append(a[i])
plus=0
for j in range(0,len(lis)):
  plus+=c[lis[j]-1]
print(sum(b)+plus)
# Judge status: Accepted
def cd_generator(num):
    i=1
    lower=[]
    upper=[]
    while i*i<=num:
        if num%i==0:
            lower.append(i)
            if num!=i*i:
                upper.append(num//i)
        i+=1
    return reversed(lower+upper[::-1])
n,m=map(int,input().split())

for ele in cd_generator(m):
    if m/ele>=n:
        print(ele)
        exit()
# Judge status: Wrong Answer
import math

n = int(input())
aL = sorted(list(map(int, input().split(" "))))

ans = n
for i in range(n - 1, -1, -1):
    for j in range(i):
        if aL[j] * 2 > aL[j]:
            break
        if aL[i] % aL[j] == 0:
            ans -= 1
            break

d = set()
for a in aL:
    d.add(a)
if len(d) == 1 and n != 1:
    print(0)
    exit()

print(ans)
# Judge status: Wrong Answer
n,m,q = map(int,input().split())
a = []
b = []
c = []
d = []
for i in range(q):
    e,f,g,h = map(int,input().split())
    a.append(e)
    b.append(f)
    c.append(g)
    d.append(h)

counter = 0
for i in range(n-1):
    counter += m - 1
    m -= 1

sum_c = 0
count = 0
for i in sorted(c):
    sum_c += i
    if sum_c > counter:
        break
    count += 1

d_count = 1
ans = 0
for i in sorted(d,reverse = True):
    if d_count > count:
        break
    ans += i
    d_count += 1


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

if s[-1] == s:
    print(s+'es')
else:
    print(s+'s')
# Judge status: Accepted
n=int(input())
p=list(map(int,input().split()))
count=0
ans='YES'
for i in range(n):
    if p[i]!=i+1:
        count+=1
    if count>2:
        ans='NO'
        break
print(ans)
# Judge status: Accepted
N,L=map(int, input().split())
S=[input()for i in range(N)]
print(''.join(sorted(S)))
# Judge status: Accepted
#!/usr/bin/env python3

n = int(input())

ans = 0
for i in range(1, n+1):
    num = n//i
    ans += (1+num)*i*num//2

print(ans)
# Judge status: Wrong Answer
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

h = ii()
count = 0
while h >= 2:
    h = (h+1)//2
    count += 1
#print(count)
if count == 0:
    print(1)
else:
    print(2**(count)-1)
# Judge status: Accepted
r, g, b = map(int, input().split())

if (10*g + b) % 4 == 0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
string = input()
k = int(input())
ans = list(string)

alpha = "abcdefghijklmnopqrstuvwxyz"
alpha_to_num = {}
for i in range(26):
    alpha_to_num[alpha[i]] = i
    
for i, s in enumerate(ans):
    if s == "a":
        continue
    pos = alpha_to_num[s]
    kk = 26 - pos
    if kk > k:
        continue
    k -= kk
    ans[i] = "a"
    
pos = alpha_to_num[ans[-1]]
new_pos = (k + pos) % 26
ans[-1] = alpha[new_pos]
print("".join(ans))
# Judge status: Accepted
from sys import stdin

def main():
    n,m = map(int,stdin.readline().split())
    if(n==m):
        print("Yes")
    else:
        print("No")

main()
# Judge status: Wrong Answer
import itertools

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N, K = ZZ()
    S = input()
    gr = itertools.groupby(S)
    ll = []
    for c, d in gr: ll.append([c, len(list(d))])

    output = N - len(ll)
    i = 1
    for _ in range(K):
        if i < len(ll): output += 2
        else: break
        i += 2

    print(output)

    return

if __name__ == '__main__':
    main()
# Judge status: Accepted
A,B,N = map(int,input().split())
x = min(N,B-1)
ans = int(A*x/B) - A*int(x/B)
print(ans)
# Judge status: Accepted
N,M = map(int,input().split())
if N % 2:
    for i in range(M):
        print(1+i,N-i,sep=" ")
else:
    even = M // 2
    odd = M - even
    for i in range(odd):
        print(1+i,N-i,sep=" ")
    st = 1 + odd
    en = st + even * 2
    for i in range(even):
        print(st+i,en-i,sep=" ")
# Judge status: Accepted
string_n = input()
string_n = '0' + string_n
len_n = len(string_n)
dp = [[0, 0] for _ in range(len_n + 1)]

for i in range(len_n):
    for j in range(2):
        if j == 0:
            dp[i + 1][j] = min(dp[i]) + int(string_n[i])
        else:
            dp[i + 1][j] = min(dp[i][0] + 1 + 10 - int(string_n[i]), dp[i][1] + 9 - int(string_n[i]))

print(min(dp[len_n]))
# Judge status: Accepted
a,b = map(int,input().split())
x = -(-(a+b)//2)
print(x)
# Judge status: Accepted
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
b = 10 ** 5
c = 0
for i in range(len(h)):
    if abs((t - h[i] * 0.006) - a) < b:
        b = abs((t - h[i] * 0.006) - a)
        c = i
print(c + 1)
# Judge status: Accepted
d = input()

if (d == 'a') or (d == 'e') or (d == 'i') or (d == 'o') or (d == 'u'):
    print("vowel")
else:
    print("consonant")
# Judge status: Accepted
a,b,c=map(int,input().split())
for i in range(500000):
    if a%2==1 or b%2==1 or c%2==1:
        print(i);exit()
    
    else:
      p=(b+c)//2 ;q=(a+c)//2 ; r=(a+b)//2
      a=p ; b=q;c=r
else:
    print(-1)
# Judge status: Wrong Answer
x, y, z = map(int, input().split())
print((x-1)//(y+z))
# Judge status: Wrong Answer
import sys
import math
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

a,b,h,m = map(int,readline().split())

degree = abs(h*30+30*(m/60) - m*6)
degree = min(degree,360-degree)
if degree == 0 or degree == 180:
    print(0)
    exit()
print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(degree))))
# Judge status: Wrong Answer
n = int(input())
cnt = [0] * 10**5
for i in map(int, input().split()):
    cnt[i] += 1

res = 0
for i in range(1, len(cnt)-2):
    val = sum(cnt[i:i+3])
    if res < val:
        res = val

print(res)
# Judge status: Accepted
S=input();print('NYOE S'[S.count('5')==2 and S.count('7')==1::2])
# Judge status: Accepted
import itertools

a1, b1, c1 = map(int, input().split())
a2, b2, c2 = map(int, input().split())
a3, b3, c3 = map(int, input().split())

checker = [
(a1,b1,c1),
(a2,b2,c2),
(a3,b3,c3),
(a1,a2,a3),
(b1,b2,b3),
(c1,c2,c3),
(a1,b2,c3),
(c1,b2,a3)
]

N = int(input())

numbers = []
for i in range(N):
  numbers.append(int(input()))
ans="No"
tuples = itertools.permutations(numbers,3)
for i in tuples:
  if i in checker:
    ans = "Yes"
    break
print(ans)
# Judge status: Wrong Answer
S = [int(x) for x in input()]
cnt = 0

for i in range(2):
    if S[i] == S[i+1]:
        cnt += 1

if cnt >= 1:
    print("Bad")
else:
    print("Good")
# Judge status: Wrong Answer
n,x = map(int,input().split()) 
A= list(map(int,input().split())) 
A.sort()
a_sum=0  
for i in range(n):
    a_sum+= A[i]
    if x<a_sum:
        print(i)
        exit() 

print(n)
# Judge status: Wrong Answer
a,b,k = map(int,input().split())
A=[]
for i in range(a,a+k):
    A.append(i)
B=[]
for i in range(b,b-k,-1):
    B.append(i)
C=list(set(A+B))
C.sort(reverse=False)
print(C)
# Judge status: Accepted
#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    A=list(map(int,input().split()))
    cnt=0
    for i in range(N):
        if A[i]%2==1 and i%2==0:
            cnt+=1
    print(cnt)
    
    
    
if __name__=="__main__":
    main()
# Judge status: Accepted
n, c, k = map(int, input().split())
t_lst = [int(input()) for _ in range(n)]
t_lst.sort()
ans = 0
cnt = 0
last = 0
if c == 1:
    print(n)
    exit()
for t in t_lst:
    if t > last:
        ans += 1
        last = t + k
        cnt = 1
    else:
        cnt += 1
        if cnt == c:
            last = 0
            cnt = 0
print(ans)
# Judge status: Accepted
from fractions import gcd
N = int(input())
A = [int(i) for i in input().split()]
lcm = A[0]
MOD = 10**9 + 7
for a in A:
    lcm = (lcm // gcd(lcm,a) * a)
res = 0
for a in A:
    res += lcm //a
print(res % MOD)
# Judge status: Accepted
S = str(input())
ans = 0
s_ctr = 0
# s の後の t をひたすら省く
for i in range(len(S)):
    if S[i] == "S":
        s_ctr += 1
    else:
        if s_ctr > 0:
            ans += 1
            s_ctr -= 1
print(len(S) - ans * 2)
# Judge status: Accepted
n,m=map(int,input().split())
ans=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    ans[a-1]+=1
    ans[b-1]+=1
[print(i) for i in ans]
# Judge status: Wrong Answer
N = int(input())
h = tuple(map(int, input().split()))
cost = [float('inf')] * N
cost[0] = 0
cost[1] = abs(h[0] - h[1])
for i in range(N-2):
  cost[i+1] = min(cost[i+1], cost[i] + abs(h[i] - h[i+1]))
  cost[i+2] = min(cost[i+2], cost[i] + abs(h[i] - h[i+2]))
print(cost[-1])
# Judge status: Wrong Answer
N, L = map(int, input().split())
l = []
for i in range(N):
  l.append(L + i)
l.sort()
if l[0]*l[-1] <= 0:
  print(0)
else:
  if l[0] > 0:
    l.pop(0)
    print(sum(l))
  else:
    l.pop(-1)
    print(sum(l))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

if n%2==0:
  s=a[-1::-2]+a[0::2]
else:
  s=a[-1::-2]+a[1::2]
  
print(" ".join(map(str,s)))
# Judge status: Accepted
n,k=map(int,input().split())
p=list(map(int, input().split()))
p_s=sorted(p)
ans=0
for i in range(k):
    ans+=p_s[i]
print(ans)
# Judge status: Accepted
n = int(input())
S = [input() for _ in range(n)]

f_inf = float("inf")
ans = [f_inf] * 26
for i in range(26):
    subs = 97 + i
    for s in S:
        ans[i] = min(ans[i], s.count(chr(subs)))

for i in range(26):
    for j in range(ans[i]):
        print(chr(97 + i), end="")
# Judge status: Accepted
import sys

a, b = map(int, sys.stdin.read().split())
if (a + b) % 2 == 1:
    print('IMPOSSIBLE')
else:
    print(int((a + b) / 2))
# Judge status: Accepted
# ABC 049: A – 居合を終え、青い絵を覆う / UOIAUAI
vowels = ['a', 'i', 'u', 'e', 'o']
c = input()
print('vowel' if c in vowels else 'consonant')
# Judge status: Accepted
n, m = map(int, input().split())
s = set()
t = set()
for i in range(m):
    a, b = map(int, input().split())
    if a > b : a, b = b, a
    if a == 1:
        s.add(b)
    if b == n:
        t.add(a)

if s & t:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Judge status: Accepted
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0

for i in range(n):
    s = input()
    if s == "AC":
        ac += 1
    elif s == "WA":
        wa += 1
    elif s == "TLE":
        tle += 1
    else:
        re += 1
        
print("AC x", ac)
print("WA x", wa)
print("TLE x", tle)
print("RE x", re)
# Judge status: Accepted
A,B=input().split()
if int(A)<=8 and int(B)<=8:
  print("Yay!")
else:
  print( ":(")
# Judge status: Accepted
n = int(input())
b_list = []
uni = []
for i in range(n):
  b = input()
  b_list.append(b)
  if not b in uni:
    uni.append(b)

m = int(input())
r_list = []
r_uni = []
for i in range(m):
  r = input()
  r_list.append(r)
  if not r in uni:
    uni.append(r)

uni.append("aaaaaaaaaaa")
uni_l = len(uni)
c = []
for i in range(uni_l):
  c.append(b_list.count(uni[i]) - r_list.count(uni[i]))
print(max(c))
# Judge status: Accepted
n,k = [int(x) for x in input().split()]
a = []
for _ in range(k):
    _ = input()
    tmp = [int(x) for x in input().split()]
    for x in tmp:
        a.append(x)

print(n - len(set(a)))
# Judge status: Wrong Answer
import numpy as np

def last(d, i):
    return 0

def loss(d, i):
    pass


precon = [[0]]*25
#print(precon)

D = int(input())
c = [int(n) for n in input().split()]
s = [[]]*D
t = []
for i in range(D):
    s[i] = [int(n) for n in input().split()]
#for i in range(D):
#    t.append(int(input()))
#print(s)
#print(t)
for i in range(D):
    print(np.random.randint(1, 26, 1))
# Judge status: Accepted
n = int(input())
aList = list(map(int,input().split()))
bList = list(map(int,input().split()))
cList = list(map(int,input().split()))

manzoku = bList[aList[0]-1] 
for i in range(1,n):
  if aList[i]-1 == aList[i-1]:
    manzoku += bList[aList[i]-1]+cList[aList[i]-1-1]
  else:
    manzoku += bList[aList[i]-1]
print(manzoku)
# Judge status: Accepted
K, X = map(int, input().split())
for i in range(X-K+1, X+K):
    print(i, end=" ")
# Judge status: Accepted
input()
x = list(map(int, input().split()))
if sum(x) - max(x) > max(x):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N=int(input())
Y=10**100

A=list(map(int,input().split()))
for a in A:
    H=0
    while a%2==0:
        a//=2
        H+=1
    Y=min(Y,H)
print(Y)
# Judge status: Wrong Answer
n, x = map(int, input().split())
l = list(map(int, input().split()))

d=[0]
for i in range(1, n+1):
  d.append(d[-1]+l[i-1])
  
print(d)
  
print(len([i for i in d if i <= x]))
# Judge status: Accepted
N, L = map(int, input().split())

ans = 0
for i in range(1, N+1):
    ans += L+i-1
    

if L+N-1 < 0:
    ans -= (L+N-1)
elif L <= 0 <= L+N-1:
    ans = ans
else:
    ans -= L
print(ans)
# Judge status: Wrong Answer
x, y = map(int, input().split())
a_cnt = abs(abs(x) - abs(y))
if y >= x:
    print(a_cnt)
elif abs(y) == abs(x):
    print(1)
else:
    print(a_cnt + 2)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

ans = 0
index = 1
while index <= (N - 1):
  ans += 1
  index += (K-1)
print(ans)
# Judge status: Wrong Answer
def main():
    n, m = map(int, input().split())
    Xs = sorted(list(map(int, input().split())))
    Xs_diff = []
    for i in range(1, m):
        Xs_diff.append(Xs[i]-Xs[i-1])

    Xs_diff.sort()
    ans = sum(Xs_diff[:(m-n)])
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import numpy as np

S = input()
NSEW = [S.count("N"), S.count("S"), S.count("E"), S.count("W")]

if np.prod(NSEW) > 0:
    print("Yes")
elif NSEW[0] + NSEW[1] > 0:
    if NSEW[0] == 0 or NSEW[1] == 0:
        print("No")
        exit()
elif NSEW[2] + NSEW[3] > 0:
    if NSEW[2] == 0 or NSEW[3] == 0:
        print("No")
        exit()
print("Yes")
# Judge status: Wrong Answer
n = int(input())
res = 0
for i in range(1,n+1, 2):
	if i % 1:
		cnt = 0
		for j in range(i+1):
			if i % j == 0:
				cnt += 1
		if cnt == 8:
			res += 1

print(res)
# Judge status: Accepted
#abc104 b
s=input()
x=s[2:-1]
flag=True
if s[0]!="A" or s[1].isupper() or s[-1].isupper():
    flag=False
cnt=0
for i in range(len(x)):
        if x[i]=="C":
            cnt+=1
        else:
            if x[i].islower()==False:
                flag=False
if cnt!=1:
    flag=False
if flag:
    print("AC")
else:
    print("WA")
# Judge status: Accepted
a,b,c=map(int,input().split())
if a <= c <= b or a >= c >= b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from itertools import product

S = input()

for i, j in product(range(len(S)), range(len(S))):
    if S[:i] + S[j:] == "keyence":
        print("YES")
        break
else:
    print("NO")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
temp=a[0]
for i in range(n-1):
    temp=temp^a[i+1]
for i in range(n):
    print(temp^a[i])
# Judge status: Accepted
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

n,a,b,c,d = iim()
s = input()
st = s[b-2:min(c,d)+1]
s = s[a-1:max(c,d)]

if '##' in s:
    print('No')
elif c < d:
    print('Yes')
else:
    print('Yes' if '...' in st else ' No')
# Judge status: Accepted
def resolve():
	n, x = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		if i != 0:
			if (a[i] + a[i-1]) > x:
				diff = a[i] + a[i-1] - x
				ans += diff
				a[i] = a[i] - diff
		if a[0] > x:
			ans += a[0] - x
			a[0] = x
	print(ans)
resolve()
# Judge status: Accepted
n = int(input())
a_ls = list(map(int, input().split()))
b_ls = list(map(int, input().split()))
times_add = 0
diff_to_pad = 0
for i in range(n):
    diff = b_ls[i] - a_ls[i]
    if diff > 0:
        times_add += -(-diff//2) 
        if diff % 2 == 1:
            diff_to_pad += 1
    elif diff < 0:
        diff_to_pad += -diff
if diff_to_pad > times_add:
    res = 'No'
else:
    res = 'Yes'
print(res)
# Judge status: Wrong Answer
n,a,b = map(int,input().split())
print(min(abs(a-b),max(a-1,b-1),max(n-a,n-b)))
# Judge status: Wrong Answer
S = input()
N = len(S)
left = S[:N // 2]
right = S[N // 2 + 1:]

print('Yes') if left == left[::-1] and right == right[::-1] else print('No')
# Judge status: Accepted
a,b,c=map(int,input().split())
if b>=c:
    print("delicious")
elif a>=(c-b):
    print("safe")
else:
    print("dangerous")
# Judge status: Accepted
A, B, X = map(int, input().split())
if (A + B >= X) and (A <= X):
    print('YES')
else:
    print('NO')
# Judge status: Accepted
a, b = list(map(int, input().split()))
result = 0

for i in range(2):
    if a >= b:
        result += a
        a -= 1
    else:
        result += b
        b -= 1

print(result)
# Judge status: Accepted
n, k = map(int, input().split())
mat = [list(map(int, input().split())) for _ in range(n)]
mat.sort(key=lambda x: x[0])
for a, b in mat:
    k -= b
    if k <= 0:
        print(a)
        exit()
# Judge status: Accepted
N,M,K = map(int,input().split())

for i in range(N+1):
    for j in range(M+1):
        black = i * (M - j) + j * (N - i) 
        
        if black == K:
            print("Yes")
            exit()
            
print("No")
# Judge status: Accepted
N,M = map(int, input().split())

G = [[] for _ in range(N+1)]

for _ in range(M):
    A, B = map(int, input().split())
    G[A].append(B)
    G[B].append(A)

D = [None]*(N+1)
D[1] = 0

Q = set([1])

while len(Q) > 0:
    Q2 = set()
    for q in Q:
        for r in G[q]:
            if D[r] == None:
                D[r] = q
                Q2.add(r)

    Q = Q2


print('Yes')
for d in D[2:]:
    print(d)
# Judge status: Accepted
def main():
    import fractions
    a,b,c,d=map(int, input().split())
    def lcm(c,d):
        return c*d//fractions.gcd(c,d)
    e=lcm(c,d)
    ans=(b-a+1)-((b//c-(a-1)//c)+(b//d-(a-1)//d))+(b//e-(a-1)//e)
    print(ans)
    
if __name__=='__main__':
    main()
# Judge status: Accepted
def main():
    from builtins import int, map, list, print, len
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    S = input()
    T = input()
    ans = 0
    for i in range(len(T)):
        if S[i] != T[i]:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
import numpy as np

n=int(input())

Z=np.zeros((n,4))
for i in range(n):
    Z[i][0],Z[i][1]=map(int, input().split())
    Z[i][2]=Z[i][0]+Z[i][1]
    Z[i][3]=Z[i][0]-Z[i][1]
Z2=Z[np.argsort(Z[:,2])]

ans=1
border=Z2[0][2]
for i in range(1,n):
    if Z2[i][3]>=border:
        ans+=1
        border=Z2[i][2]

print(ans)
# Judge status: Accepted
n = int(input())
a = sorted(map(int, input().split()))

from bisect import bisect_left
ans_n = a[-1]

p = bisect_left(a, (ans_n+1)//2)
ans_r = a[p] if p != n-1 else a[p-1]
if abs(a[p] - ans_n/2) > abs(a[p-1] - ans_n/2):
  ans_r = a[p-1]

print(ans_n, ans_r)
# Judge status: Accepted
a, b, c = map(int,input().split())
if a == b == c:
  print(1)
elif a == b or b == c or c == a:
  print(2)
else:
  print(3)
# Judge status: Wrong Answer
import sys

N, C, K = map(int ,input().split())
T = [int(input()) for _ in range(N)]

if C == 1:
	print(N)
	sys.exit()

cnt = 0
capacity = 0
time_limit = 0
for i in range(N):
	if capacity == 0:
		capacity += 1
		time_limit = T[i] + K
		continue
	if capacity > 0:
		if T[i] <= time_limit:
			capacity += 1
			if capacity == C:
				cnt += 1
				capacity = 0
				continue
		elif T[i] > time_limit:
			cnt += 1
			capacity = 1
			time_limit = T[i] + K


print(cnt+1)
# Judge status: Accepted
a, b, c = map(int, input().split())
ans = set([a, b, c])
print(len(ans))
# Judge status: Accepted
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
mx = max(a)
a.sort()
c = Counter(a)

dp = [0] * (mx+1)
for i in a:
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in set(a):
    if dp[i] == 0 and c[i] == 1:
        cnt += 1

print(cnt)
# Judge status: Wrong Answer
import sys
n = int(sys.stdin.readline())
m = map(int, sys.stdin.read().split())
ab = list(zip(m, m))
res = 0
for i, j in ab[::-1]:
  if j != 1:
  	res += j - (i + res) % j
print(res)
# Judge status: Accepted
n=int(input())
s=list(map(int,input().split()))
ans=0
p=sorted(s)
for i in range(n):
    if s[i]!=p[i]:
        ans+=1
print("NO" if ans>2 else "YES")
# Judge status: Accepted
n = int(input())
W = [input() for i in range(n)]

if len(W) != len(set(W)):
  print("No")
  exit()
else:
  for i in range(len(W)-1):
    if W[i][len(W[i])-1] !=  W[i+1][0]:
      print("No")
      exit()
    
print("Yes")
# Judge status: Wrong Answer
N = int(input())
Plan = [list(map(int,input().split())) for _ in range(N-1)]

for i in range(N-1):
    c1,s1,f1 = Plan[i]
    time = s1+c1
    for j in range(i+1,N-1):
        c,s,f = Plan[j]
        if time <= s:
            time = s
        elif (time-s)%f != 0:
            time = f-(time-s)%f
        time += c
    print(time)
print(0)
# Judge status: Accepted
n=int(input())
r=range(1,100)
l=[0]*n
for x in r:
  for y in r:
    for z in r:
      t=x*x+y*y+z*z+y*z+z*x+x*y-1
      if t<n: l[t]+=1
for i in l: print(i)
# Judge status: Accepted
S=input()
key="keyence"

if S.find(key)!=-1:
    print("YES")
    exit()


count=0
for i in range(7):
    s=S[i]
    if s==key[count]:
        count+=1
    else:
        break

for i in range(-1,-8,-1):
    s=S[i]
    if s==key[i]:
        count+=1
    else:
        break
if count>=7:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
s = {}
s['a'], s['b'], s['c'] = [input() for i in range(3)]

player = 'a'
while True:
    if len(s[player]) == 0:
        break
    first_c = str(s[player])[0]
    s[player] = str(s[player])[1:]
    player = first_c

print(player.upper())
# Judge status: Accepted
k = int(input())
seqS=input().split(" ")
num=[]
for q in seqS:
    num.append(int(q))
contador,abc,arc=0,0,0
num.sort() #ORGANIZA
#num do meio
print(num[int(len(num)/2)]- num[int(len(num)/2)-1])
# Judge status: Accepted
A, B = map(int, input().split())
import math
c = math.ceil((B - A) / (A - 1))
print(c + 1)
# Judge status: Accepted
a, b = map(int, input().split())
if a == b: print(str(a)*a)
else:
    mi, ma = min(a, b), max(a, b)
    print(str(mi)*ma)
# Judge status: Accepted
N = int(input())
L = sorted([list(input().split()) + [i + 1] for i in range(N)], key = lambda x: x[0])
while len(L) > 0:
    c = sum([x[0] == L[0][0] for x in L])
    M = sorted(L[0: c], key = lambda x : int(x[1]), reverse = True)
    for x in M:
        print(x[2])
    L = L[c:]
# Judge status: Accepted
import sys


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


sys.setrecursionlimit(10 ** 9)


def main():
    S = input()
    cnt = [0, 0, 0]
    for s in S:
        if s == "a":
            cnt[0] += 1
        elif s == "b":
            cnt[1] += 1
        else:
            cnt[2] += 1
    if max(cnt) - min(cnt) > 1:
        print("NO")
    else:
        print("YES")


if __name__ == "__main__":
    main()
# Judge status: Accepted
from fractions import gcd
def lcm(p,q):
    return p*q//gcd(p,q)

n,m = map(int, input().split())
a = list(map(int, input().split()))
x = 1
for i in range(n):
    a[i] = a[i]//2
    x = lcm(x,a[i])
    if x>m:
        print(0)
        exit()
for i in range(n):
    if (x//a[i])%2==0:
        print(0)
        exit()
p = m//x
if p%2==0:
    ans = p//2
else:
    ans = p//2 +1
print(ans)
# Judge status: Accepted
from fractions import gcd

A, B, C, D = map(int, input().split())

def f(x):
    return x - x//C - x//D + x//(C*D//gcd(C, D))

print(f(B)-f(A-1))