peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N=int(input())
A=[]
B=[]
for i in range(N):
    AB=list(map(int,input().split()))
    A.append(AB[0])
    B.append(AB[1])

ans=0
for i in range(N-1,-1,-1):
    A[i]+=ans
    A[i]%=B[i]
    if A[i]!=0:
        ans+=B[i]-A[i]

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

ans = (n // 11) * 2

rem = n % 11

if rem > 0 :
    if rem <= 6:
        ans += 1
    else:
        ans += 2

print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

N, W = map(int, input().split())
B = [list(map(int, input().split())) for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)]
for i in range(N):
    w, v = B[i]
    for j in range(W+1):
        if j-w >= 0:
            dp[i+1][j] = max(dp[i][j], dp[i][j-w]+v)
        else:
            dp[i+1][j] = dp[i][j]
print(dp[N][W])
# Judge status: Accepted
W,H,N=map(int,input().split())
l,r,b,t=0,W,0,H
for _ in range(N):
    x,y,a=map(int,input().split())
    if a==1:
        l=max(l,x)
    elif a==2:
        r=min(r,x)
    elif a==3:
        b=max(b,y)
    else:
        t=min(t,y)
if l<r and b<t:
    print((r-l)*(t-b))
else:
    print(0)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

cnt = 1
mono = 0
for i in range(1, n):
  d = a[i] - a[i - 1]
  if d * mono < 0:
    cnt += 1
    mono = 0
  elif d != 0:
    mono = d
print(cnt)
# Judge status: Accepted
o = int(input())
if 30 <= o:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
# -*- coding: utf-8 -*-
s = list(str(input()))

"""
tmp = [s[0]]
flag = True
for i in s:
    if i in tmp:
        flag = False
    else:
        tmp.append(i)

if flag:
    print("yes")
else:
    print("no")
"""

if len(s) == len(set(s)):
    print("yes")
else:
    print("no")
# Judge status: Accepted
a,b=map(int,input().split())
t=b/1000
List=[-1,-1,-1]
for l in range(a+1):
    if (t-9*l-a)%4==0 and a-l-(t-9*l-a)/4>=0 and t-9*l-a>=0:
        s=int((t-9*l-a)/4)
        List=[l,s,a-l-s]
        break
print(*List)
# Judge status: Wrong Answer
s = list(map(int, input()))
k = int(input())
res = 1
for i in range(len(s)):
    if s[i] != 1:
        res = s[i]
        break
print(res)
# Judge status: Accepted
# coding: utf-8
from math import ceil
from bisect import bisect_left
N = int(input())
A = list(map(int, input().split()))
A.sort()
a = A[-1]
ans = ceil(a / 2)
b = float("inf")
for i in range(N-1):
    if abs(b - ans) > abs(A[i] - ans):
        b = A[i]
print(a, b)
# Judge status: Accepted
n = int(input())

c = 0
for i in range(1,n+1):
    if i % 2 != 0:
        c += 1

print(c/n)
# Judge status: Accepted
S = input()

Slst = [S.count('a'), S.count('b'), S.count('c')]
Slst.sort(reverse=True)

x = (len(S)-1) // 3
y = (len(S)-1) % 3
if y == 0:
    lst = [x+1, x, x]
elif y == 1:
    lst = [x + 1, x+1, x]
else:
    lst = [x+1, x+1, x+1]
if lst == Slst:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
N = int(input())

can_list = [[0 for _ in range(10)] for _ in range(10)]

str_list = list(map(str, range(1, N+1)))

for n in range(N):
    idx = str(n + 1)[0] + str(n + 1)[-1]
    can_list[int(idx[0])][int(idx[1])] += 1

res = 0
for i in range(10):
    for j in range(10):
        res += can_list[i][j] * can_list[j][i]


print(res)
# Judge status: Accepted
K, N = map(int, input().split())
A = list(map(int, input().split()))

dif_max = 0

for i in range(N):
    if i == 0:
        dif = A[0] + (K - A[-1])
    else:
        dif = abs(A[i] - A[i-1])
    if dif > dif_max:
        dif_max = dif

print(K - dif_max)
# Judge status: Wrong Answer
a, b, c = (int(n) for n in input().split())
print(c - (a - b))
# Judge status: Accepted
# DP practice
# https://atcoder.jp/contests/dp/tasks/dp_a

# 入力方法としてはこれが手軽
N = int(input())
h = list(map(int, input().split()))

dp = list()

# N = 0, 1 の時の処理も必要。だが省く
dp.append(0)
dp.append(dp[0] + abs(h[1] - h[0]))

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


print(dp[N-1])
# Judge status: Wrong Answer
#155 a 
a,b,c=map(int,input().split())
if a==b==c:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
s = set()
cnt = 0
for i in a:
    if i >= 3200:
        cnt += 1
    else:
        s.add(i // 400)
print(max(1, len(s)), len(s) + cnt)
# Judge status: Accepted
break_line = int(input())
word = input()

if len(word) <= break_line:
    print(word)
else:
    print('{}...'.format(word[:break_line]))
# Judge status: Accepted
n=int(input())
t,a=map(int,input().split())
hl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

mn=abs(a-(t-hl[0]*0.006))
temp=[]
for i in range(n):
    mn=min(mn,abs(a-(t-hl[i]*0.006)))
    temp.append(abs(a-(t-hl[i]*0.006)))

print(temp.index(mn)+1)
# Judge status: Accepted
n,a,b=map(int,input().split())
if a==0:
  print(0)
  exit()
elif b==0:
  print(n)
  exit()
s=a+b
cnt=n//s
r=n%s
ans=cnt*a+min(a,r)
print(ans)
# Judge status: Accepted
import sys
from math import sqrt, floor
from bisect import bisect_right as bi_r

def factorize(n):
    res = []
    for i in range(1, floor(sqrt(n)) + 1):
        if not n % i:
            res.append(i)
            res.append(n // i)
    return sorted(res)

n, m = map(int, sys.stdin.readline().split())

def main():
    res = factorize(m)
    ans = res[bi_r(res, m / n) - 1]
    return ans

if __name__ == '__main__':
    ans = main()
    print(ans)
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())

ans = ''

ans += 'R' * (tx - sx)
ans += 'U' * (ty - sy)

ans += 'L' * (tx - sx)
ans += 'D' * (ty - sy)

ans += 'L'
ans += 'U' * (ty - sy + 1)
ans += 'R' * (tx - sx + 1)
ans += 'D'

ans += 'R'
ans += 'D' * (ty - sy + 1)
ans += 'L' * (tx - sx + 1)
ans += 'U'

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

#Ai + i 
#j-Aj
ans = 0
cnt = [0]*(n+1)
for i in range(n-1):
    j=i+1
    a = mp[i]+i
    if(a<=n):
        cnt[a] += 1 
    b = j-mp[j]
    if(b<0):
        continue
    ans += cnt[b]
    

print(ans)
# Judge status: Wrong Answer
N, M = map(int,input().split())
crain = (4 * N - M) / 2
if crain.is_integer() and crain > 0:
  print("Yes")

else:
  print("No")
# Judge status: Accepted
a,_,_,_,e,k=[int(input()) for i in range(6)]
print(":(" if e-a>k else "Yay!")
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a!=b:
  s=max(a,b)
  print(s*(s-1))
else:
  print(a**2)
# Judge status: Accepted
I = 1009
a,b = map(int,input().split());flag=0
for i in range(1,I):
    x = (i*8)//100;y=(i*10)//100
    if(x==a and y==b):
        print(i)
        flag=1
        break
if(flag==0):
    print(-1)
# Judge status: Accepted
x = int(input())
ans = x//11*2
if x%11 == 0:
    pass
elif x%11 <= 6:
    ans += 1
else:
    ans += 2
print(ans)
# Judge status: Accepted
n=int(input())
s = [input().split() for i in range(n)]
c=0
for x in s:
    c+=1
    x.append(c)
    x[1]=str(100-int(x[1])).zfill(3)
s.sort(key=lambda x:(x[0],x[1]))
for x in s:
    print(x[2])
# Judge status: Accepted
c = [input() for _ in range(2)]
tmp = c[0][0] == c[1][2] and c[0][1] == c[1][1] and c[0][2] == c[1][0]
print("YES" if tmp else "NO")
# Judge status: Wrong Answer
A = []
ans = 0
for _ in range(5):
  a = int(input())
  if a % 10 == 0: ans += a
  else: A.append(a)
A.sort(key = lambda x:x%10)
for i in range(1, len(A)+1):
  if A[-i] != A[0]:ans += 10 - (A[-i]%10) + A[-i]
  else: ans += A[-i]
print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())

if c >= a and c <= b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,x,y=map(int,input().split())
l=[0 for i in range(n-1)]
#print(l)
length=0
for i in range(1,n):
  for j in range(i+1,n+1):
    length=min(abs(j-i)-1,abs(y-j)+abs(x-i),abs(y-j)+abs(x-i))
    #print(i,j,length)
    l[length]+=1
for i in l:
  print(i)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
for i in range(1, 1000):
    if B*i%A==0:
        count=1
    else:
        count=0
print("No" if count==0 else "Yes")
# Judge status: Accepted
s = list(input())
ss = set(s)
if len(s) == len(ss):
  print('yes')
else:
  print('no')
# Judge status: Accepted
n=int(input())
candy=[list(map(int,input().split())) for i in range(2)]

ans=candy[0][0]+sum(candy[1])
t=ans
for i in range(n-1):
    t+=candy[0][i+1]
    t-=candy[1][i]
    if t>ans:
        ans=t
print(ans)
# Judge status: Wrong Answer
N = int(input())
s = []
count=0
for i in range(N):
  a = list(input())
  a.sort()
  s.append(a)

while True:
  if len(s) == 0:
    break
  count += s.count(s[0])
  s=[i for i in s if i != s[0]]
  
print(count)
# Judge status: Accepted
S = input()[::-1]
T = input()[::-1]
n = len(S);m = len(T)
a = []
for i in range(0, n - m + 1):
    f = 1
    s = S[i:i+m]
    for j in range(m):
        if s[j] not in ["?",T[j]]:
            f = 0
            break
    if f:
        a = S[:i] + T + S[i+m:]
        break

if a:
    print(a.replace('?','a')[::-1])
else:
    print('UNRESTORABLE')
# Judge status: Accepted
N = int(input())
L = sorted(list(map(int, input().split())))

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            if L[i] == L[j] or L[j] == L[k]:
                pass
            elif L[i] + L[j] > L[k]:
                ans += 1
print(ans)
# Judge status: Accepted
N = int(input())
A_list = []
for i in range(N):
    A = int(input())
    A_list.append(A)
# print(A_list)

ans = 0
tmp = 0
for i in range(len(A_list)):
    if A_list[i] != 0:
        if i == len(A_list)-1:
            tmp += A_list[i]
            ans += int(tmp/2)
        else:
            tmp += A_list[i]
    else:
        ans += int(tmp/2)
        tmp = 0

print(ans)
# Judge status: Accepted
N = int(input())
H = list(map(int,input().split()))

s=0
flag = True

if N==1:
    print("Yes")
    exit()

for i in range(N-1):
    s = max(s,H[i])
    if s-H[i+1]>1:
        flag = False
if flag:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b, c = map(int, input().split())
print("YES" if c - b == b - a else "NO")
# Judge status: Wrong Answer
import random
d = int(input()) #365
c = list(map(int, input().split())) # 26個
s = [list(map(int, input().split())) for _ in range(d)]

#output
t = [random.randint(1,27) for _ in range(d)]
for i in range(d):
    print(t[i])
# Judge status: Accepted
import string

s=list(input())
k=int(input())

str=string.ascii_lowercase
abc=str+str

s_len=len(s)
for i in range(s_len):
  si_inx=abc.index(s[i])

  if i==s_len-1:
    k%=26
    s[i]=abc[si_inx+k]
    break

  if s[i]=='a':
    continue

  if k>=26-si_inx:
    k-=26-si_inx
    s[i]='a'
  else:
    continue

print(''.join(s))
# Judge status: Wrong Answer
import math
x,y = map(int,input().split())
n = math.floor(math.log2(y)-math.log2(x)+1)
print(n)
# Judge status: Wrong Answer
a,b=input().split()
a=int(a)
b=int(b)
x=10
y=int(x*8/100)
z=int(x*10/100)
for i in range(10000):
  if y==a and z==b:
    print(x)
  else:
    x=x+1
# Judge status: Accepted
x,a,b=map(int,input().split())
if b-a<=0:
    print('delicious')
elif b-a<=x:
    print('safe')
elif b-a>=x+1:
    print('dangerous')
# Judge status: Wrong Answer
x=int(input())

if x==9 or x//10==9:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

sx, sy, tx, ty = map(int, input().split())

mov_x = tx - sx
mov_y = ty - sy

ans = ''
ans += 'R' * mov_x
ans += 'U' * mov_y
ans += 'L' * mov_x
ans += 'D' * mov_y
ans += 'D'
ans += 'R' * (mov_x + 2)
ans += 'U' * (mov_y + 2)
ans += 'U'
ans += 'L' * (mov_x + 2)
ans += 'D' * (mov_y + 2)
ans += 'R'
print(ans)
# Judge status: Accepted
n=int(input())
m=0
a=1
for i in range(1,n+1):
    c=0
    j=i
    while 1:
        j/=2
        if j%1==0:
            c+=1
        else:
            break
    if m<c:
        m=c
        a=i
print(a)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

pf = [0]*n
mn = 1e9
for i in range(0,n):
    mn = min(mn,a[i])
    pf[i] = mn
    
cn = 0
for i in range(n):
    if(a[i]<=pf[i]):
        cn += 1
        
print(cn)
# Judge status: Wrong Answer
x = int(input())
print(0 if x == 0 else 1)
# Judge status: Wrong Answer
s = input()
n = len(s)

s_lh_r = s[n//2+1:][::-1]
s_fh = s[:n//2]

if not s_lh_r == s_fh:
    print("No")
    exit()

n = len(s_fh)

if not s_fh[:n//2] == s_fh[n//2+1:][::-1] or not s_lh_r[:n//2] == s_lh_r[n//2+1:][::-1]:
    print("No")
    exit()

print("Yes")
# Judge status: Accepted
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]
ans=0
for i in s:
    ans=max(ans,s.count(i)-t.count(i))
print(ans)
# Judge status: Accepted
X, N = map(int, input().split())
try:
    P = set((map(int, input().split())))
except:
    print(X)
    exit()
dif = 0
while X - dif in P:
    if not X + dif in P:
            print(X + dif)
            exit()
    dif += 1
print(X - dif)
# Judge status: Accepted
N,M = map(int, input().split())
l = list(map(int, input().split()))

if N - sum(l) < 0:
  print("-1")
else:
  print(N - sum(l))
# Judge status: Wrong Answer
N,K = map(int,input().split())
print(N//(K-1))
# Judge status: Wrong Answer
N,M= list(map(int , input().split()))
H = list(map(int , input().split()))
A = []
B = []
for i in range(M):
    x,y=[int(i) for i in input().split()]
    A.append(x)
    B.append(y)
S = []
for j in range (M):
    if H[A[j]-1] > H[B[j]-1]:
        S.append(B[j])        
    elif H[A[j]-1] < H[B[j]-1]:
        S.append(A[j])  
S = set(S)
print(N - len(S))
# Judge status: Accepted
W,a,b=map(int,input().split())
print(max(max(a,b)-W-min(a,b),0))
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[22]:


S = input()


# In[24]:


keyence = "keyence"
length = len(keyence)
flag = True
for i in range(len(keyence)):
#     print(S[:i+1], keyence[:i+1], S[-length+i+1:], keyence[-length+i+1:])
    if S[:i+1] == keyence[:i+1]:
        if S[-length+i+1:] == keyence[-length+i+1:]:
            print("YES")
            flag = False
            break
if flag:
    print("NO")


# In[ ]:
# Judge status: Accepted


def solve():
    N, M = map(int, input().split())
    A = [int(i) for i in input().split()]
    print(max(N - sum(A), -1))


if __name__ == '__main__':
    solve()
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for i in range(n)]
now = a[0]
cnt = 0
for i in range(n - 1):
    #print(now)
    now = a[now - 1]
    cnt += 1
    if now == a[1]:
        
        print(cnt)
        
        exit()
print("-1")
# Judge status: Accepted
a, b = map(int, input().split())
cnt = 0
for num in range(a, b + 1):
    if str(num) == str(num)[::-1]:
        cnt += 1

print(cnt)
# Judge status: Wrong Answer
N,K = map(int,input().split())

print(N - int(input()))
# Judge status: Accepted
# ####################################################################
# import io
# import sys

# _INPUT = """\
# 1001
# 1079
# 432

# 12 5 2
# cabbabaacaba

# 10 2 3
# abccabaabb
# """
# sys.stdin = io.StringIO(_INPUT)
####################################################################
import sys
def p(*_a):
  return
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
####################################################################
yn = lambda b: print('Yes') if b else print('No')
####################################################################
N = int(input())

NO = ":("

a = (N-1) // 1.08

for i in range(100):
  b = a + i
  if int(b * 1.08) == N:
    print( int(b) )
    exit()

print(NO)
# Judge status: Accepted
a, b, t = map(int, input().split())
ans = 0
if(b <= t):
  while(a*ans < t + 0.5):
    ans += 1
else:
  ans = 1
print((ans-1) * b)
# Judge status: Accepted
n=int(input())
list=list(map(int,input().split()))
temp=0
for i in list:
    if temp>i:
        print("No")
        break
    else:
        temp=max(temp,i-1)
else:
    print("Yes")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

ans = list(reversed(a[1::2])) + a[::2]
if n % 2:
    print(*reversed(ans))
else:
    print(*ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split( )))

count = 0

for i in a:
    a_ = [t % i for t in a]
    c = a_.count(0)
    
    if c == 1:
        count += 1
print(count)
# Judge status: Accepted
import math
H,W = (int(x) for x in input().split())
if H == 1 or W == 1:
    print(1)
else:
    print(math.ceil(H*W/2))
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

for _ in range(42):
    S = [0] * (N + 1)
    for i, a in enumerate(A):
        l = min(N-1, max(0, i-a))
        r = min(N-1, i+a)
        S[l] += 1
        S[r+1] -= 1
    t = 0
    for i in range(N):
        t += S[i]
        A[i] = t
print(*A)
# Judge status: Accepted
a, b = map(int,input().split())
if b == 1:
  print(0)
  quit()
if a >= b:
  print(1)
  quit()
count = 0
while(True):
  count += 1
  if a + (a-1)*count >= b:
    print(count+1)
    quit()
# Judge status: Accepted
n, p = map(int, input().split())
a = [int(i)&1 for i in input().split()]
odd = sum(a)
ans = 0
if odd:
    ans = 2**(n-1)
else:
    ans = 2**n*(1-p)

print(ans)
# Judge status: Accepted
S = list(input())
N = len(S)
s = S[:N//2]
for _ in range(N//2):
    S.pop(-1)
    S.pop(-1)
    s.pop(-1)
    if s + s == S:
        break
print(len(S))
# Judge status: Accepted
from math import ceil
K = int(input())
A, B = map(int, input().split())
upper = B//K
lower = ceil(A/K)
if upper>=lower:
  print("OK")
else:
  print("NG")
# Judge status: Accepted
N,M = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
wa = 0
for i in range(M):
    wa += a[i]
print(max(-1,N-wa))
# Judge status: Accepted
n,k=map(int,input().split())
xs=list(map(int,input().split()))
m=float('inf')
for l,r in zip(xs,xs[k-1:]):
    d=min(abs(l),abs(r))+abs(r-l)
    m=min(m,d)
print(m)
# Judge status: Accepted
a,b=map(int,input().split());print([a+b,a+b-24][a+b>=24])
# Judge status: Accepted
import numpy as np
import math
N = int(input())
X_k = list(map(int , input().split(" ")))

P = float(sum(X_k)/N)
P_ceil = int(math.ceil(P))
P_floor= int(math.floor(P))

ceil_sum = 0
floor_sum = 0

for X in X_k:
    ceil_sum = ceil_sum + (P_ceil-X)*(P_ceil-X)
    floor_sum = floor_sum + (P_floor-X)*(P_floor-X)


if (ceil_sum-floor_sum > 0):
    print(floor_sum)
else:
    print(ceil_sum)
# Judge status: Accepted
from collections import defaultdict

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

d = defaultdict(int)

for i, a in enumerate(A):
    d[i+a] += 1

ans = 0
for j, a in enumerate(A):
    ans += d[j-a]

print(ans)
# Judge status: Accepted
n=int(input())
s=input()
data=[0]*(n+1)
for i in range(n):
  if s[i]=='E':
    data[i+1]=data[i]+1
  else:
    data[i+1]=data[i]
print(min(i-data[i]+data[n]-data[i+1] for i in range(n)))
# Judge status: Accepted
n = int(input())
s = list(input())
mod = 10 ** 9 + 7
alpha = "abcdefghijklmnopqrstuvwxyz"
cnt = []
for a in alpha:
    tmp = s.count(a)
    cnt.append(tmp + 1)
ans = 1
for num in cnt:
    ans *= num
    ans %= mod
print(ans - 1)
# Judge status: Accepted
S = int(input())

kMod = 10**9+7

memo = {}

def count(n):
    if n < 3:
        return 0
    if n in memo:
        return memo[n]
    ans = 1
    for i in range(3, n+1):
        ans += count(n-i)
        ans %= kMod
    memo[n] = ans
    return ans

print(count(S))
# Judge status: Accepted
from fractions import gcd

def lcm(x, y):
    return (x * y) // gcd(x, y)

N = int(input())
Ps = list(map(int,input().split(" ")))
MOD = 10 ** 9 + 7
g = 1
for p in Ps:
    g = lcm(g,p)
ans = 0

print(sum([g // p for p in Ps]) % (10 ** 9 + 7))
# Judge status: Wrong Answer
#!/usr/bin/env python3

N = int(input())
stones = input()


def count_WR(stones):
    return stones.count('WR')


def solve(stones):
    if count_WR(stones) == 0:
        return 0

    count = 0

    # 左端のWをRにする
    if stones[0] == 'W':
        stones = 'R' + stones[1:]
        count += 1

    count += count_WR(stones)

    return count


print(solve(stones))
# Judge status: Wrong Answer
n,k=map(int,input().split())
s=input()


print(s.replace(s[k-1],s[k-1].lower()))
# Judge status: Accepted
A = input()
B = input()

se = set(["1","2","3"])

a = se-set([A,B])

print(a.pop())
# Judge status: Accepted
N, M = map(int, input().split())
dic = {i :0 for i in range(1, M+1)}

for j in range(N):
    lis = list(map(int, input().split()))
    count = lis[0]
    answer = lis[1:]
    for k in answer:
        dic[k] += 1

num = [x for x in dic.values() if x == N]
print(len(num))
# Judge status: Accepted
n,k = map(int,input().split())

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

c = 1 + (n-k) // (k-1)
if((n-k)%(k-1) != 0):c += 1
print(c)
# Judge status: Accepted
n = int(input())
flg = False
tmp = 0
ans = 0
for i in range(n):
	a, b = map(int, input().split())
	if not flg and a == b:
		tmp = 1
		flg = True
	elif flg and a == b:
		tmp += 1
	else:
		tmp = 0
	ans = max(ans, tmp)
print("Yes" if ans >= 3 else "No")
# Judge status: Accepted
x, y = map(int, input().split())
mod = 10**9 + 7
if (2*x-y)%3 == 0 and (2*y-x)%3 == 0 and 2*x-y >= 0 and 2*y-x >= 0:
    u = (2*x-y)//3
    v = (2*y-x)//3
    n = u + v
    x = 1
    y = 1
    for i in range(u):
        x = x*(n-i)%mod
        y = y*(i+1)%mod
    print((x * pow(y, mod-2, mod))%mod)
else:
    print(0)
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())
if (c//a) < (d//b):
 print("Yes")
else:
 print("No")
# Judge status: Accepted

ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########

def resolve():
    x,y = mi()
    minval = x * 2
    maxval = x * 4
    invalid  = 1
    if minval<= y and y <= maxval and y%2 == 0:
        invalid = 0
    print("No" if invalid else "Yes")

if __name__ == "__main__":
    resolve()
# Judge status: Accepted
a,b,c,d= map(int,input().split())
A=min(min(4*a,2*b),c)
B=min(2*A,d)

n=int(input())
if n %2==0:
    print(n*B//2)
else:
    print((n//2)*B + A)
# Judge status: Accepted
N,Q = map(int,input().split())
S = input()
c = []
count = 0
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        count += 1
    c.append(count)
for i in range(Q):
    l,r = map(int,input().split())
    if l == 1:
        print(c[r-2]-0)
    else:
        print(c[r-2]-c[l-2])
# Judge status: Accepted
ABC = [int(_) for _ in input().split()]
K = int(input())

ABC = sorted(ABC)

ret = ABC[2]
for i in range(K):
    ret = ret * 2

ret += sum(ABC[:2])

print(ret)
# Judge status: Accepted
import numpy as np

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

cumsumA = np.cumsum(arrA)

ans = 10**9 * 2 * 10**5
for num in cumsumA[:-1]:
    ans = min(ans,abs(num*2 - cumsumA[-1]))

print(ans)
# Judge status: Wrong Answer
N = int(input())
d = {0:0,1:0,2:0}
for a in list(map(int,input().split())):
  if a%2 == 0:
    if a%4==0:
      d[2]+=1
    else:
      d[1]+=1
  else:
    d[0]+=1
if d[0] <= (d[2]+1 if d[2]>0 else 0) :
  if d[1] > 1:
    print("Yes")
  elif d[0] + d[1] <= (d[2]+1 if d[2]>0 else 0):
    print("Yes")
  else:
    print("No")
elif d[0]+d[2]==0:
    print("Yes")
else:
  print("No")
# Judge status: Accepted
from functools import reduce
MOD = 10**9 + 7
n, a, b = map(int, input().split())

def comb(n, k):
    def mul(a, b):
        return a*b%MOD
    x = reduce(mul, range(n, n-k, -1))
    y = reduce(mul, range(1, k+1))
    return x*pow(y, MOD-2, MOD) % MOD

ans = (pow(2, n, MOD)-1-comb(n,a)-comb(n,b)) % MOD

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

mi = a * (n-2)
ma = b * (n-2)
result = ma - mi + 1
if a > b:
    print(0)
elif a == b and n != 1:
    print(0)
elif result < 0:
    print(0)
elif n == 1:
    print(b-a+1)
else:
    print(result)
# Judge status: Wrong Answer
n = input()

for i in range(0,10):
    if n.count(str(i)) >= 3:
        print('Yes')
        exit()

print('No')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

left = a - b
print(c - left)
# Judge status: Accepted
#!/usr/bin/env python
# DP解

x = int(input())
dp = [False for _ in range(x+1)]
dp[0] = True

if 1 <= x < 100:
    print(0)
    exit()

for i in range(1, 100):
    dp[i] = False
for i in range(100, x+1):
    tmp = False
    for j in range(6):
        if i-(100+j) >= 0:
            tmp = (tmp or dp[i-(100+j)])
    if tmp:
        dp[i] = True
    else:
        dp[i] = False

if dp[x]:
    print(1)
else:
    print(0)