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

flag = 0
ans = 1000
cnt = 0
for i in range(n-1):
    if flag == 0 and A[i] < A[i+1]:
        cnt += ans//A[i]
        ans %= A[i]
        flag = 1
    elif flag == 1 and A[i] > A[i+1]:
        ans += cnt*A[i]
        cnt = 0
        flag = 0
print(ans + cnt*A[n-1])
# Judge status: Accepted
from collections import Counter
n = int(input())
s = Counter(input())
for _ in range(n - 1):
    s &= Counter(input())
print(''.join(sorted(s.elements())))
# Judge status: Accepted
N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A += [a]
    B += [b]
ans = 0
for i in range(N-1, -1, -1):
    if (A[i] + ans) % B[i] == 0:
        continue
    ans += (B[i] - (A[i] + ans) % B[i])
    
print(ans)
# Judge status: Accepted
x, y = map(int, input().split())

group = [0]*13
group[2] = 1 # 1グループ
for i in (4,6,9,11): # 2グループ
  group[i] = 2
  
print("Yes" if group[x] == group[y] else "No")
# Judge status: Accepted
a,b = map(int, input().split())

print((a+b)%24)
# Judge status: Accepted
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
x=a.index(1)
print(math.ceil((n-1)/(k-1)))
# Judge status: Wrong Answer
elem = input()
single = elem.count("R")
double = elem.count("RR")
triple = elem.count("RRR")
if triple == 1:
    print(3)
elif double == 1:
    print(2)
else:
    if single == 1:
        print(1)
    else:
        print(0)
# Judge status: Wrong Answer
#!/usr/bin/env python3
from fractions import gcd
n, m = map(int, input().split())
a = list(map(lambda x: int(x) // 2, input().split()))
lcm = 1
for x in a:
    lcm = lcm // gcd(lcm, x) * x
if lcm > m:
    print(0)
    exit()
m //= 2
ans = (m + lcm - 1) // lcm
print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())
A = list(map(int,input().split()))
pop = sum(A) / (m*4)
i = 0
p = A[i]
k = 0
for p in A :
    if p >= pop :
        k += 1
    if p < pop :
        break  
if k >= m :
    print('Yes')
else :
    print('No')
# Judge status: Accepted
a=list(map(int,open(0).read().split()))
print('Yes' if a[0]-a[1]==a[3]-a[4]==a[6]-a[7] and a[1]-a[2]==a[4]-a[5]==a[7]-a[8] and a[0]-a[3]==a[1]-a[4]==a[2]-a[5] and a[3]-a[6]==a[4]-a[7]==a[5]-a[8] else 'No')
# Judge status: Wrong Answer
import math

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

hangle = float((h/12)*360)
hangle += (m/60)*30
mangle = float((m/60)*360)

if hangle > 180:
    hangle = hangle-180
if mangle > 180:
    mangle = mangle-180

angle = abs(hangle-mangle)
rad = math.radians(angle)

ans = float(math.sqrt(a*a + b*b - float(2*a*b*math.cos(rad))))

print(ans)
# Judge status: Accepted
n = int(input())
S = [str(input()) for _ in range(n)]
from collections import defaultdict
dic = defaultdict(int)

for s in list(S[0]):
    dic[s] += 1
for s in S[1:]:
    tmp = defaultdict(int)
    for i in list(s):
        tmp[i] += 1
    for j in dic.keys():
        dic[j] = min(dic[j], tmp[j])

ans = []
for d in dic.keys():
    num = dic[d]
    ans += [d]*num

ans.sort()
print(''.join(ans))
# Judge status: Accepted
A, B = map(int, input().split())
S = input()

ans = "Yes"
if len(S) != A+B+1:
  ans = "No"
for i, s in enumerate(S):
  if i == A:
    if s != '-':
      ans = "No"
  else:
    if not '0' <= s <= '9':
      ans = "No"
print(ans)
# Judge status: Accepted
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import Counter
    N = int(readline())
    blue = Counter()
    red = Counter()

    for _ in range(N):
        s = input()
        blue[s] += 1

    M = int(readline())

    for _ in range(M):
        s = input()
        red[s] += 1

    ans = 0

    for key in blue.keys():
        score = blue[key] - red[key]
        ans = max(ans, score)

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n=input()


n=str(n)
Sum=0
for i in range(len(n)):
    Sum=Sum+int(n[i])

if Sum%9==0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N=int(input())
S=input()
ans=0
for i in range(N-1):
  A=set(S[:i+1])
  B=S[i:]
  cnt=0
  for j in A:
    if (j in B):
      cnt+=1
  ans=max(ans,cnt)
print(ans)
# Judge status: Wrong Answer
import math
import collections
import fractions
import itertools

def solve():
    n, m = map(int, input().split())
    if n == 1 and m == 1:
        print(1)
    elif n == 1 and m != 1:
        print(m-2)
    else:
        print((n-2)*(m-2))
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
N = int(input())

list=[0]*N
for x in range(1,N+1):
    if x * x+2*x+3 > N:
        break
    for y in range(1,N+1):
        if x * x + y * y + x * y+x+y+1 > N:
            break
        for z in range(1, N + 1):
            val=x * x + y * y + z * z + x * y + y * z + z * x
            if val >= N:
                break
            list[val - 1] += 1
for i in range(N):
    print("{}".format(list[i]))
# Judge status: Accepted
l = [0, 0, 0]
l[0], l[1], l[2] = map(int, input().split())
l.sort()
print(l[2]*10+l[1]+l[0])
# Judge status: Wrong Answer
S = list(input())
N = len(S)

def cal(a,b):
    for i in range((b-a+1)//2):
        if S[a+i] != S[b-i]:
            return 1
            break
    else:
        return 0
if cal(0,N-3//2) == 0 and cal(N+1//2,N-1) == 0 and cal(0,N-1) == 0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
# 21   import sympyが最速だが、Atcoderには無い
import math
x = int(input())

#エラトステネスの篩
n = [i for i in range(2,int(math.sqrt(x))+1)]

for i in n:
    for j in n:
        if j % i == 0 and j/i !=1:
            n.remove(j)
            
while x > 0:
    x +=1
    for i in n:
        if x % i == 0:
            break
    else:
        print(x)
        break
# Judge status: Accepted
n, a, b, c, d  = map(int, input().split())
s = input()
ans = 'Yes'
if '##' in s[a-1:max(c,d)]:
    ans = 'No'
else:
    if c > d and '...' not in s[b-2:d+1]:
        ans = 'No'
print(ans)
# Judge status: Accepted
W, a, b = map(int, input().split())

ans = max(0, b-(a+W), a-(b+W))
print(ans)
# Judge status: Accepted
from sys import stdin
import math

a,b,c,k = [int(x) for x in stdin.readline().strip().split()]
print(((-1)**k) * (a - b))
# Judge status: Accepted
n = int(input())
cnt = 0
for i in (range(1, n + 1)):
    if len(str(i)) % 2 == 1:
        cnt += 1
print(cnt)
# Judge status: Accepted
N = int(input())
edge = list(map(int,input().split()))
if max(edge) < sum(edge)-max(edge):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
k,x = map(int,input().split())

c = []
for i in range(2*k-1):
    c.append(x-(k-1-i))

print(" ".join(map(str,c)))
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
ans=float("INF")
for i in range(-100,101):
    ans_=sum((a-i)**2 for a in A)
    ans=min(ans,ans_)
print(ans)
# Judge status: Accepted
import itertools

a = []
for i in range(5):
  a.append(int(input()))
k = int(input())
flag = True

for v in itertools.combinations(a, 2):
  if v[1] - v[0] > k:
    flag = False

if flag:
  print("Yay!")
else:
  print(":(")
# Judge status: Wrong Answer
n = int(input())
ls= list(map(int, input().split()))
ans = 1
for i in ls:
  ans=i*ans
  if(ans<10**18):
    ans=-1
    break
print(ans)
# Judge status: Accepted
n = int(input())

if n%2 == 0:
  print((n//2)**2)
elif n > n//2*2:
  print(n//2*(n//2+1))
else:
  print(n//2*(n//2-1))
# Judge status: Wrong Answer
S = input()
while True :
  if S[0:5] == "dream":
    S = S.replace("dream","")
  elif S[0:6] == "eraser":
    S = S.replace("eraser","")
  elif S[0:7] == "dreamer":
    S = S.replace("dreamer","")
  elif S[0:5] == "erase":
    S = S.replace("erase","")
  elif len(S) == 0:
    print("YES")
    break
  else:
    print("NO")
    break
# Judge status: Wrong Answer
n = int(input())
m = n
while True:
  for i in range(2,int(m**0.5)+1):
    if m %i == 0:
      break
    elif i > int(m**0.5)-1:
      print(m)
      exit()
  m += 1
# Judge status: Wrong Answer
S = list(input())
T = list(input())
print(S, T)
c = 0
for i in range(len(S)):
    if S[i] != T[i]:
        c += 1
print(c)
# Judge status: Accepted
d,t,s=map(int, input().split())
if d/s<=t:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
import math
sum=0
num=int(input())
for a in range(num):
  for b in range(num):
    for c in range(num):
      d=math.gcd(a,b)
      e=math.gcd(c,d)
      sum=sum+e
print(sum)
# Judge status: Accepted
s = str(input())
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
  print('Bad')
else:
  print('Good')
# Judge status: Wrong Answer
P,Q,R=map(int,input().split())
count=300
for i in [P,Q,R]:
    for j in [P,Q,R]:
        if i==j:
         count=count
        else:
         if i+j<=count:
             count=i+j
print(count)
# Judge status: Wrong Answer
from collections import Counter

s = input()

c = Counter(s)

if len(c) == 4:
    print("Yes")
elif len(c) % 2 == 1:
    print("No")
else:
    li = list(c.keys())
    if ("S" in li and "N" in li) or ("W" in li and "E" in li):
        print("Yes")
    else:
        print("NO")
# Judge status: Accepted
def resolve():
    n = int(input())
    c = input()
    ans = 0
    l = -1
    r = n
    while True:
        l += 1
        r -= 1
        while l < n and c[l] == "R":
            l += 1
        while r >= 0 and c[r] == "W":
            r -= 1
        if l > r:
            break
        ans += 1
    print(ans)


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

if a >= 3200:
    print(s)

else:
    print('red')
# Judge status: Wrong Answer
S = input()

ns = ""
for i in S:
    if i == '?':
        ns += 'D'
    else:
        ns += 'P'

print(ns)
# Judge status: Wrong Answer

x = int(input())
y = int(pow(x, 1/5))
A = [i**5 for i in range(y+1)]
B = [i**5 for i in range(y+1)]

for i in range(len(A)):
  for j in range(len(B)):
    if ( A[i] + B[j] ) == x:
      exit(print(i, j))
    elif ( A[i] - B[j] ) == x:
      exit(print(i, -j))
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a<c<b or c<b<a:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n, m = map(int, input().split())
z = [0]*(m+1)

for i in range(n):
    l= list(map(int, input().split()))
    for j in range(1, l[0]+1):
        z[l[j]] +=1

cnt = 0

for i in z:
    if i == n:
        cnt += 1

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

m = 1000000
for i in range(len(s)-3):
  x = int(s[i:i+3])
  m = min(m,abs(x-753))
  
print(m)
# Judge status: Accepted
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

def f(x,y):
    if y-x<0:
        return inf
    else:
        return y-x

x,y=map(int,input().split())
mans=min(f(x,y),f(-x,y)+1,f(x,-y)+1,f(-x,-y)+2)
print(mans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(0,n):
  if a[i]%2==0:
    if a[i]%3==0 or a[i]%5==0:
      count=count+1
  else:
    count=count+1
if count==n:
  print("APPROVED")
else:
  print("DENIED")
# Judge status: Accepted
a = list(map(int, input().split()))
k = int(input())

b = a.index(max(a))

ans = 0
for i in range(3):
    if (i == b):
        ans += a[i] * (2 ** k)
    else:
        ans += a[i]

print(ans)
# Judge status: Accepted
x=int(input())
if x%11>6:
    ans=(x//11)*2+2
elif x%11==0:
    ans=(x//11)*2
else:
    ans=(x//11)*2+1
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
s = input()
ans = True
for i in range(a + b + 1):
    if s[a] != "-":
        ans = False
        break
    else:
        if i == a:
            pass
        else:
            for j in range(10):
                if s[i] == str(j):
                    break
            else:
                ans = False

if ans:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
data = {}
for i in range(n):
    s,p = map(str,input().split())
    p = int(p)
    if s in data:
        data[s].append((p,i+1))
    else:
        data[s] = [(p,i+1)]
D = sorted(data.items())
for i in range(len(D)):
    P = D[i][1]
    P.sort()
    while P:
        print(P.pop()[1])
# Judge status: Accepted
from sys import stdin
input = stdin.readline

n = int(input())
a = list(map(int,input().split()))
ma = -1
res = 0
for i in a:
    res += max(ma - i,0)
    ma = max(ma,i)
print(res)
# Judge status: Accepted
def main():
    n=int(input())
    H=list(map(int,input().split()))
    now=H[0]-1
    if n==0:
        print('Yes')
        return
    for h in H[1:]:
        if now > h:
            print('No')
            return
        elif now == h:
            now = h
        else:
            now = h -1
    print('Yes')
main()
# Judge status: Wrong Answer
N = int(input())
S = input()
A = ''
for i in range(len(S)):
    if ord(S[i])+N <= 90:
        A += chr(ord(S[i])+N)
        print(A)
    else:
        A += chr(ord(S[i])+N-26)
        print(A)
print(A)
# Judge status: Accepted
import math
[A, B, H, M] = list(map(int, input().split()))
a = 2 * math.pi / 12 * (H + M / 60)
b = 2 * math.pi / 60 * M
c = a - b
answer = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(c))
print(answer)
# Judge status: Accepted
a, b = map(int, input().split())
x = [i  *(i + 1) // 2 for i in range(1, 1000)]
for i in range(999):
    if a <  x[i] and x[i] - a == x[i+1] - b:
        print(x[i] - a)
        break
# Judge status: Accepted
def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    ans = []
    for i in range(k, n):
        if a[i] > a[i-k]:
            ans.append("Yes")
        else:
            ans.append("No")
    for s in ans:
        print(s)

if __name__ == "__main__":
    main()
# Judge status: Accepted
from collections import Counter


def choose(n, r):
    x, y = 1, 1
    for i in range(r):
        x *= n - i
        y *= i + 1
    return x // y


N = int(input())
*a, = map(int, input().split())

ctr = Counter(a)

b = 0
for cnt in ctr.values():
    b += choose(cnt, 2)

ret = []
for x in a:
    cnt = ctr[x]
    res = b - choose(cnt, 2) + choose(cnt - 1, 2)
    ret.append(res)

print(*ret, sep='\n')
# Judge status: Accepted
from collections import Counter
w = list(input())
w = Counter(w)

flag = True
for k, v in w.items():
  if v % 2 != 0:
    flag = False
    break
print("Yes" if flag else "No")
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

cnt = 0
for i in range(2, n):
  l = [p[i - 2], p[i - 1], p[i]]
  m = sorted(l)
  if l[1] == m[1]:
    cnt += 1
    
print(cnt)
# Judge status: Accepted
import collections
n = int(input())
a = list(map(int, input().split()))
q = int(input())
query = [list(map(int, input().split())) for _ in range(q)]

s = sum(a)
a = collections.Counter(a)

for b, c in query:
    s = s + (c - b) * a[b]
    a[b], a[c] = 0, a[c] + a[b]
    print(s)
# Judge status: Accepted
n,m = map(int,input().split())
div = []
for i in range(1,int(m**0.5)+1):
    if m%i == 0:
        div.append(i)
        div.append(m//i)
div.sort(reverse=True)
for x in div:
    if m//x >= n:
        print(x)
        break
# Judge status: Accepted
n = int(input())
al = list(map(int,input().split()))

sum_a = sum(al)

potential = 1
ans = 0
for a in al:
    ans += min(sum_a, potential)
    sum_a -= a
    potential = 2 * (potential - a)
    if potential < 0:
        print(-1)
        exit()
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = sum(b)
for i in range(n-1):
    print(ans)
    if a[i+1] == a[i] + 1:
        ans += c[i-1]
print(ans)
# Judge status: Accepted
a, b, x = [int(i) for i in input().split()]

def ret(n):
    if n>=0:
        return n//x+1
    else:
        return 0
print(ret(b)-ret(a-1))
# Judge status: Accepted
S =input()

cnt = 0
cntmax = 0 
for i in range(3):
  if S[i] == 'R':
    cnt+= 1
    cntmax = max(cntmax, cnt)
  else:
    cnt =0

print(cntmax)
# Judge status: Accepted
A,B=map(int,input().split())
num=0
for i in range(A,B+1):
    N=str(i)
    if N==N[::-1]:
        num+=1
print(num)
# Judge status: Accepted
s = input()
A = s.count("a")
B = s.count("b")
C = s.count("c")

if max(A,B,C) - min(A,B,C) <= 1:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
n=int(input());a=input().split();d={}
for i in a:
  if i not in d:
    d[i]=min(a.count(i),abs(int(i)-a.count(i)))
print(sum([i for i in d.values()]))
# Judge status: Accepted
x = int(input())
print(x * -1 + 1)
# Judge status: Accepted
N, K, S = map(int, input().split())
print(" ".join([str(S)] * K + [str(S+1)] * (N-K)) if S<10**9 else " ".join([str(S)] * K + ['1'] * (N-K)))
# Judge status: Accepted
c = input()

if c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u':
    print('vowel')
else:
    print('consonant')
# Judge status: Wrong Answer
import random
import math
LI = lambda: list(map(int,input().split()))
MI = lambda: map(int,input().split())
yes = lambda: print("Yes")
no = lambda: print("No")
I = lambda: list(input())
J = lambda x: "".join(x)
II = lambda: int(input())
SI = lambda: input()
#---khan17---template
t = II()
a,b = MI()
boo = False
for i in range(a,b+1):
	if a%t == 0:
		boo = True
		break
print("OK" if boo else "NG")
# Judge status: Accepted
import sys
def Ii():return int(sys.stdin.buffer.read())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

x = Ii()

for i in range(121):
  for j in range(-119,120):
    if x == i**5 - j**5:
      print(i,j)
      exit(0)
# Judge status: Accepted
n,m = map(int,input().split())
ans=0
if n==1 and m==1:
    print(1)
elif n==1 or m==1:
    print(n*m-2)
else:
    print(n*m-2*(n+m)+4)
# Judge status: Accepted
s=input()
k=int(input())
for i in range(k):
  if not s[i]=='1':
    print(s[i])
    break
else:
  print(s[k-1])
# Judge status: Accepted
N=int(input())
s=input()

if N%2==1:
    print("No")
else:
    m=int(N/2)
    s1=s[:m]
    s2=s[m:]
    if  s1==s2:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
n, t = map(int, input().split())
ct = [list(map(int, list(input().split()))) for i in range(n)]

ct.sort(key=lambda x: x[0])

for i in range(n):
    if ct[i][1] <= t:
        print(ct[i][0])
        exit()
    if i == n - 1:
        print("TLE")
# Judge status: Accepted
A,B = [int(i) for i in input().split()]

flag=0
for i in range(1,1050):
    if int(i*0.08)==A and int(i*0.1)==B:
        ans = i
        flag=1
        break

if flag==1:
    print(ans)
else:
    print(-1)
# Judge status: Accepted
def main():
    import sys
    input = sys.stdin.readline
    N, R = map(int,input().split())
    if N >= 10:
        print(R)
    elif N < 10:
        print(R + 100 * (10 - N))

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import numpy as np
n,k,q = map(int,input().split())
a =np.array([k]*n)
a-=q
for i in range(q):
    a[int(input())-1]+=1
for i in range(n):
    if i>0:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
n, l = map(int, input().split())
s_l = [ str(input()) for _ in range(n)  ]
s_l = sorted(s_l)
print(''.join(s_l))
# Judge status: Wrong Answer
a=list(map(int,input().split()))
a=sorted(a)
k=int(input())
g=2
for i in range(1,k+1):
       f=a[2]*g
       a[2]=f
       g=g+2
c=a[0]+a[1]+a[2]
print(c)
# Judge status: Accepted
A, B = map(int, input().split())
_MAX_PRICE = 1001
for n in range(1, _MAX_PRICE):
  if int(n * 0.08) == A and int(n * 0.1) == B:
    print(n)
    exit()
print(-1)
# Judge status: Accepted
import bisect

n = int(input())
ll = list(map(int, input().split()))
ll.sort()

ans = 0
for i in range(n-2):
    e1 = ll[i]
    for j in range(i+1, n-1):
        e2 = ll[j]
        ans += bisect.bisect_left(ll[j+1:], e1+e2)

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

ans=0

for i in range(0,n):
    ans += b[a[i]-1]


    if i>=1:
        if a[i]==a[i-1]+1:

            ans+=c[a[i]-2]


print(ans)
# Judge status: Accepted
a,b = map(int, input().split())
if a<b:
    a,b = b,a

if a==b:
    print(a*2)
else:
    print(a+a-1)
# Judge status: Accepted
a = []
for _ in range(3):
    a += list(map(int, input().split()))
n = int(input())
b = {int(input()): None for _ in range(n)}

r = [(ai in b) for ai in a]

combs = [
    [0,1,2],
    [3,4,5],
    [6,7,8],
    [0,3,6],
    [1,4,7],
    [2,5,8],
    [0,4,8],
    [2,4,6],
]
if any([all([r[c] for c in comb]) for comb in combs]):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N,M=map(int,input().split())
ans = 0
if M >= 2 * N:
    ans = N
    M -= N * 2
    ans += M // 4
    
else:
    ans = M //2
print(ans)
# Judge status: Wrong Answer
n=int(input())
t=[int(input()) for _ in range(5)]
k=n//min(t)
if k<1:k=1
print(k+4)
# Judge status: Wrong Answer
n = int(input())

s = n//2
t = n%2

if t ==1:
    print(s+1)
if t ==0:
    print(s+1)
# Judge status: Wrong Answer
def solve(a, b, c, x):
    return sum(
        x == 500 * i + 100 * j + 50 * k
        for i in range(1, a + 1) # 500円
        for j in range(1, b + 1) # 100円
        for k in range(1, c + 1) # 50円
    )

_a = int(input())
_b = int(input())
_c = int(input())
_x = int(input())
print(solve(_a, _b, _c, _x))
# Judge status: Wrong Answer
S1 = list(input())
S2 = list(input())

flag = 0
for i in range(3):
  if S1[i] != S2[2-i]:
    flag = 1

if flag:
  print('No')
else:
  print('Yes')
# Judge status: Accepted
k,s = map(int,input().split())

ans = 0
if(s == 0):
  print(1)
  exit()
elif(s == 3*k):
  print(1)
  exit()
  
for i in range(0,k+1):
  for j in range(0,k+1):
    z = s - i - j
    if(z >= 0 and z <= k):
      ans += 1
        
print(ans)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
cnt = 0

while True:
    if a <= b:
        b -= a
        cnt += 1
    else:
        print(0)
        exit()
        
    if cnt == c or b <= 0:
        print(cnt)
        exit()
# Judge status: Wrong Answer
N,M = map(int,input().split())
H = list(map(int,input().split()))

data = set([int(i) for i in range(1,N+1)])
tmp = set()
for _ in range(M):
    A,B = map(int,input().split())
    tmp.add(B)
# print(data)
# print(tmp)
print(len(data-tmp))
# Judge status: Accepted
a = list(map(int,input().split()))
a = sorted(a)
a,b,c = a[0],a[1],a[2]
ca = c-a
cb = c-b
if ca % 2 == 0 and cb % 2 == 0:
    print(ca //2 + cb //2)
elif ca % 2 == 1 and cb % 2 == 1:
    print(((ca-1) // 2) + ((cb-1) // 2) + 1)
elif ca % 2 == 1 and cb % 2 == 0:
    print((cb // 2) + 1 + ((ca+1) // 2))
elif cb % 2 == 1 and ca % 2 == 0:
    print((ca // 2) + 1 + ((cb+1) // 2))
# Judge status: Accepted
a, b, c, d = input()
print("Yes" if a == b == c or b == c == d else "No")
# Judge status: Accepted
x = int(input())
dp = [False] * (x+1)
dp[0] = 1
for i in range(0, x+1):
    if dp[i]:
        try:
            dp[i + 100] = True
            dp[i + 101] = True
            dp[i + 102] = True
            dp[i + 103] = True
            dp[i + 104] = True
            dp[i + 105] = True
        except:
            pass

if dp[x]:
    print(1)
else:
    print(0)
# Judge status: Accepted
import fractions

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

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

print(lcm(A, B))
# Judge status: Accepted
import bisect
n, m = list(map(int, input().split(' ')))
aaa = list(map(int, input().split(' ')))
aaa = sorted([-a for a in aaa])[::-1]
len_aaa = len(aaa)

cccbbb = []
for i in range(m):
    b, c = list(map(int, input().split(' ')))
    cccbbb.append((-c, b))
cccbbb = sorted(cccbbb)
ccc = []
for c, b in cccbbb:
    ccc += [c] * b
    if len(ccc) > len_aaa:
        break
ans = 0
for i in range(len_aaa):
    c = ccc[i] if i < len(ccc) else 0
    ans += min(aaa[i], c)
print(abs(ans))
# Judge status: Accepted
s = input()
digit = len(s)

first_num = int(s[0])
a = 0
a = 9*(digit-1) + int(s[0]) - 1

b = 0
for i in s:
    b += int(i)
print(max(a, b))
# Judge status: Wrong Answer
from string import ascii_lowercase
N = int(input())
ans = ['a']
for i in range(1, N):
    ans2 = []
    for a in ans:
        for b in ascii_lowercase[:i + 1]:
            ans2 += [a + b]
    ans = ans2
print('\n'.join(ans))