Harryxun/stf_run huggingface dataset:
h, w, a, b = map(int, input().split())
mx = [[0 for i in range(w)] for _ in range(h)]
for k in range(a):
  mx[0][k] = 1

for i in range(b):
  mx[i][0] = 1

if w == 1 and a != 0:
  print("No")
elif w == 1 and a == 0:
  for j in range(h):
    s = [str(x) for x in mx[j]]
    print("".join(s))
elif h == 1 and b != 0:
  print("No")
elif h == 1 and b == 0:
  for j in range(h):
    s = [str(x) for x in mx[j]]
    print("".join(s))
else:
  pr = 1
  pc = 1

  while pr < w:
    for k in range(pc, pc + a - sum(mx[pr][:pc])):
      if k >= w:
        print("No")
        exit()
      else:
        mx[pr][k] = 1

    csum = 0
    for i in range(pr):
      csum += mx[i][pc]
    for i in range(pr, pr + b - csum):
      mx[i][pc] = 1
    pr += 1
    if pc < w - 1:
      pc += 1

  flg = 0
  for j in range(w):
    bsum = sum(mx[:][j])
    if min(bsum, h - bsum) != b:
      flg = 1
      break

  if flg == 1:
    print("No")
  else:
    for j in range(h):
      s = [str(x) for x in mx[j]]
      print("".join(s))

### FIXED CODE ###

h, w, a, b = map(int, input().split())
for i in range(h):
  if i < b:
    print("0"*a + "1"*(w-a))
  else:
    print("1"*a + "0"*(w-a))
w, h, x, y = map(int, input().split())

are_w = min(w*y, w*(h-y))
are_h = min(x*h, (w-x)*h)

ans_are = max(are_w, are_h)
ans = 0
if are_w == are_h:
    ans = 1

if x == w and y == h:
    ans_are = w*h/2
    ans = 0

if x == 0 and y == 0:
    ans_are = w*h/2
    ans = 0
    
if x == 0 and y == h:
    ans_are = w*h/2
    ans = 0

if x == w and y == 0:
    ans_are = w*h/2
    ans = 0

if w/h == x/y:
    ans_are = w*h/2
    ans = 0

print(ans_are, ans)



### FIXED CODE ###

w, h, x, y = map(int, input().split())
ans = 0
if w == 2*x and h == 2*y:
    ans = 1
print(w*h/2, ans)
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
xyh = []
for _ in range (N):
    xyh.append([int(x) for x in input().split()])

count = 0
while True:
    if xyh[count][2] >= 0:
        hstd = xyh[count][2]
        break
    else:
        count += 1

for x in range (101):
    for y in range (101):
        Cx = x
        Cy = y
        H = hstd + abs(x-Cx) + abs (y - Cy)
        xyhcand = []
        for k in range (N) :
            xi = xyh[k][0]
            yi = xyh[k][1]
            h = max(H-abs(x-Cx)-abs(y-Cy),0)
            xyhls = [xi,yi,h]
            xyhcand.append(xyhls)
            xyhls = []
        if sorted(xyh) == sorted(xyhcand):
            ans = '.'.join([x,y,H])
            break
        
print(ans)




### FIXED CODE ###

#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
xyh = []
for _ in range (N):
    xyh.append([int(x) for x in input().split()])

count = 0
while True:
    if xyh[count][2] > 0:
        xstd = xyh[count][0]
        ystd = xyh[count][1]
        hstd = xyh[count][2]
        break
    else:
        count += 1

for x in range (101):
    for y in range (101):
        Cx = x
        Cy = y
        H = hstd + abs(xstd-Cx) + abs (ystd - Cy)
        xyhcand = []
        for k in range (N) :
            xi = xyh[k][0]
            yi = xyh[k][1]
            h = max(H-abs(xi-Cx)-abs(yi-Cy),0)
            xyhls = [xi,yi,h]
            xyhcand.append(xyhls)
            xyhls = []
        if sorted(xyh) == sorted(xyhcand):
            ans = " ".join([str(x),str(y),str(H)])
            break
        
print(ans)
n = int(input())
h = list(map(int,input().split()))
ans = 0
ls = []
for i in range(n-1):
    if h[i] >= h[i+1]:
        ans += 1
    else:
        ls.append(ans)
        ans = 0
ls.append(ans)
print(max(ls))


### FIXED CODE ###

s = input()
t = input()
ans = 0
for i in range(3):
    if s[i] == t[i]:
        ans += 1
        
print(ans)
n = int(input())
l = sorted(map(int, input().split()), reverse = True)

alice = 0
bob = 0
ab = False
for i in l:
  if ab = False:
	alice += i
  else:
    bob += i
    
print(alice - bob)
  

### FIXED CODE ###

n = int(input())
l = sorted(map(int, input().split()), reverse = True)

alice = 0
bob = 0
ab = False
for i in l:
  if ab == False:
    alice += i
    ab = True
  else:
    bob += i
    ab = False
    
print(alice - bob)
import math
a = int(input())
if ((a > 0) & (a < 100001)):
    data_size = int (math.log10(a) + 1)
    if a == 100000:
        print(90909)
    elif data_size == 5:
        print(a - 10000 + 1 + 909)
    elif data_size == 4:
        print(909)
    elif data_size == 3:
        print(a - 100 + 1 + 9)
    elif data_size == 2:   
        print(9)
    elif data_size == 1:   
        print(a - 1 + 1)

### FIXED CODE ###

a,b,c=(int(x) for x in input().split())
if ((c - (a - b)) < 0):
    print(0)
else:
    print(c - (a - b))
N=int(input())
A=[input() for i in range(N)]
cnt=0

while all(i%2 == 0 for i in A):
  A = [i/2 for i in A]
  cnt+=1
print(cnt)


### FIXED CODE ###

input()

A = list(map(int, input().split(" ")))
B = 0

while all(a%2 == 0 for a in A):
  A = [a/2 for a in A]
  B += 1

print(B)
list=list(input())
for s in list:
  s='x'
print(*list sep='')


### FIXED CODE ###

print('x'*len(input()))
def main():
 from heapq import*
 import sys
 r=sys.stdin.readline
 def g(n,E,S,G):
  F=[1e7]*-~n;F[S],H=0,[(0,S)]
  while H:
   c,u=heappop(H)
   if u==G:return c
   for f,v in E[u]:
    t=c+f
    if t<F[v]:F[v]=t;heappush(H,(t,v))
  return-1
 def s(n,k):
  E=[[]for _ in[0]*-~n]
  for _ in[0]*k:
   f=r();p=map(int,f[2:].split())
   if'0'==f[0]:print(g(n,E,*p))
   else:c,d,e=p;E[c]+=[(e,d)];E[d]+=[(e,c)]
 for e in iter(r,'0 0\n'):s(*map(int,e.split()))
if __name__ == '__main__':
    main()


### FIXED CODE ###

def s():
 import sys
 r=sys.stdin.readline
 I=float('inf')
 for e in iter(r,'0 0\n'):
  n,k=map(int,e.split())
  F=[[I]*-~n for _ in[0]*-~n]
  for i in range(1,n+1):F[i][i]=0
  for _ in[0]*k:
   f=r();g=map(int,f[2:].split())
   if'0'==f[0]:a,b=g;A=F[a][b];print([A,-1][A==I])
   else:
    c,d,e=g
    if e<F[c][d]:
     for i in range(2,n+1):
      for j in range(1,i):
       F[i][j]=F[j][i]=min(F[i][j],F[i][c]+e+F[d][j],F[i][d]+e+F[c][j])
s()
H, W, D = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]

d = {}
for y in range(H):
    for x in range(W):
        d[A[y][x]] = (y, x)

t = [[0] * (H * W // D + 1) for _ in range(D)]
for i in range(D):
    j = 0
    if i == 0:
        j = 1
    while i + (j + 1) * D <= H * W:
        y1, x1 = d[i + j * D]
        y2, x2 = d[i + (j + 1) * D]
        t[i][j + 1] = abs(y1 - y2) + abs(x1 - x2)
        j += 1
    for j in range(len(H * W // D + 1) - 1):
        t[i][j + 1] += t[i][j]

Q = int(input())
for _ in range(Q):
    L, R = map(int, input().split())
    i = L % D
    print(t[i][(R - i) // D] - t[i][(L - i) // D])


### FIXED CODE ###

H, W, D = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]

d = {}
for y in range(H):
    Ay = A[y]
    for x in range(W):
        d[Ay[x]] = (y, x)

t = [[0] * ((H * W + D - 1) // D + 1) for _ in range(D)]
for i in range(D):
    ti = t[i]
    j = 0
    if i == 0:
        j = 1
    while i + (j + 1) * D <= H * W:
        y1, x1 = d[i + j * D]
        y2, x2 = d[i + (j + 1) * D]
        ti[j + 1] = abs(y1 - y2) + abs(x1 - x2)
        j += 1
    for j in range(len(ti) - 1):
        ti[j + 1] += ti[j]

Q = int(input())
for _ in range(Q):
    L, R = map(int, input().split())
    i = L % D
    print(t[i][(R - i) // D] - t[i][(L - i) // D])
N = int(input())
d = int(input()))

d = set(d)
print(len(d))

### FIXED CODE ###

n = int(input())

di = set(map(int, [input() for i in range(n)]))

print(len(di))
n=int(input())
s=input()
t=input()
if s==t:
    print(n)
else:
    ans=2*n
    f=True
    for i in range(n):
        for j range(i+1):
            if t[j]==a[n-1-i+j]:
                f=False
        if not f:
            break
    print(ans)

### FIXED CODE ###

n=int(input())
s=input()
t=input()
i=0
while n>i:
    if i==0 and s==t:
        break
    if t[:-i]==s[i:]:
        break
    i+=1
print(n+i)
while True:
    N = input()
    if N == "0":
        break

    q1,b,c1,c2,q2 = [int(i) for i in N.split()]

    x = min((b-c2*q1) // (c1-c2), q2, b // c1)
    y = (b-c1*x) // c2

    if x <= 0:
        print("NA")
    else:
        print(x,y)



### FIXED CODE ###

while True:
    N = input()
    if N == "0":
        break

    q1,b,c1,c2,q2 = [int(i) for i in N.split()]

    if c1 <= c2:
        x = min(q2, b // c1)
    else:
        x = min((b-c2*q1) // (c1-c2), q2, b // c1)
    y = (b-c1*x) // c2

    if x <= 0 or x + y < q1:
        print("NA")
    else:
        print(x,y)
n = int(input())
a = []
for i in range(n):
    a.append(int(input())
ans = 0
for i in set(a):
    if i in a:
        ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
a = {}
for i in range(n):
    b = int(input())
    if b in a.keys():
        a[b] += 1
    else:
        a[b] = 1
ans = 0
for i in a.keys():
    if a[i]%2 == 1:
        ans += 1
print(ans)
dp=[0]+[1<<20]*10000
n=int(input())
for i in range(1,n+1):
    a=int(input())
    for j in range(i//2+1):
        dp[j],dp[i-j]=map(min,[(dp[j],dp[i-j]+a),(dp[i-j],dp[j]+a)])
print(dp[n//2])

### FIXED CODE ###

dp=[0]+[1<<20]*10000
n=int(input())
for i in range(1,n):
    a=int(input())
    for j in range(i//2+1):
        if dp[j]>dp[i-j]+a:dp[j]=dp[i-j]+a
        if dp[i-j]>dp[j]+a:dp[i-j]=dp[j]+a
print(dp[n//2])
h,w=map(int,input().split())
lists=[list(input()) for i in range(h)]
visited=[[False for i in range(h)] for j in range(w)]
from collections import deque

ans=0
dif=[(-1,0),(1,0),(0,-1),(0,1)]
def solve(i,j):
    global ans 
    ans=ans
    visited[i][j]=True
    d=deque()
    e=deque()
    d.append((i,j))
    black=0
    white=0
    while d:
        while d:
            p=d.popleft()
            x,y=p
            color=lists[x][y]
            if color=="#":
                black+=1
            else:
                white+=1
            for que in dif:
                dx,dy=que
                if 0<=dx+x<h and 0<=dy+y<w:
                    if visited[dx+x][dy+y]==False and visited[dx+x][dy+y]!=color:
                        visited[dx+x][dy+y]=True
                        e.append((dx+x,dy+y))
                        if color=="#":
                            white+=1
                        else:
                            black+=1
        if e:
            d=e
            e=deque()
    ans+=white*black
flag=True
while flag:
    sub=False
    for i in range(h):
        for j in range(w):
            if visited[i][j]==False:
                solve(i,j)
                sub=True
    if sub==False:
        flag=False
print(ans)
        
        
    
        
        
                        
                
            
    

### FIXED CODE ###

h,w=map(int,input().split())
lists=[list(input()) for i in range(h)]
visited=[[False for i in range(w)] for j in range(h)]
from collections import deque

ans=0
dif=[(-1,0),(1,0),(0,-1),(0,1)]

def solve(i,j):
    global ans 
    ans=ans
    black=0
    white=0
    if visited[i][j]==False:
        if lists[i][j]=="#":
            black+=1
        else:
            white+=1
        visited[i][j]=True
        
    d=deque()
    e=deque()
    d.append((i,j))
    while d:
        while d:
            p=d.popleft()
            x,y=p
            color=lists[x][y]
            for que in dif:
                dx,dy=que
                if 0<=dx+x<h and 0<=dy+y<w:
                    if visited[dx+x][dy+y]==False and lists[dx+x][dy+y]!=color:
                        visited[dx+x][dy+y]=True
                        e.append((dx+x,dy+y))
                        if color=="#":
                            white+=1
                        else:
                            black+=1
        if e:
            d=e
            e=deque()
    ans+=(white)*(black)
flag=True
while flag:
    sub=False
    for i in range(h):
        for j in range(w):
            if visited[i][j]==False:
                solve(i,j)
                sub=True
    if sub==False:
        flag=False
print(ans)
A, B = map(int, input().split()))
print(A+B if A%B==0 else B-A)

### FIXED CODE ###

A, B = map(int, input().split())
print(A+B if B%A==0 else B-A)
N = int(input())
left  =  [-1 for i in range(N)]
right =  [-1 for i in range(N)]
root = sum(range(N)) - N - 1
 
for i in range(N):
    i, l, r = map(int, input().split())
    left[i] = l
    right[i] = r
    root -= (l + r)
 
def preorder(i):
    if i == -1:
        return
    print(' ', i, sep = '')
    preorder(left[i])
    preorder(right[i])
     
def inorder(i):
    if i == -1:
        return
    inorder(left[i])
    print(' ', i, sep = '')
    inorder(right[i])
     
def postorder(i):
    if i == -1:
        return
    (l, r) = tree[i]
    postorder(left[i])
    postorder(right[i])
    print(' ', i, sep = '')
     
print('Preorder')
preorder(root)
print()
 
print('Inorder')
inorder(root)
print()
 
print('Postorder')
postorder(root)
print()

### FIXED CODE ###

N = int(input())
left  =  [-1 for i in range(N)]
right =  [-1 for i in range(N)]
root = sum(range(N)) - N - 1
 
for i in range(N):
    i, l, r = map(int, input().split())
    left[i] = l
    right[i] = r
    root -= (l + r)
 
def preorder(i):
    if i == -1:
        return
    print(' ', i, sep = '', end = '')
    preorder(left[i])
    preorder(right[i])
     
def inorder(i):
    if i == -1:
        return
    inorder(left[i])
    print(' ', i, sep = '', end = '')
    inorder(right[i])
     
def postorder(i):
    if i == -1:
        return
    postorder(left[i])
    postorder(right[i])
    print(' ', i, sep = '', end = '')
     
print('Preorder')
preorder(root)
print()
 
print('Inorder')
inorder(root)
print()
 
print('Postorder')
postorder(root)
print()
N, M=map(int,input().split())
s=list()
c=list()
a=0
for i in range(0,M):
    s.append(0)
    c.append(0)
for i in range(0,M):
    s[i], c[i]=map(int,input().split())
for i in range(0,M):
    for j in range(0,M):
        if s[i]==s[j] and c[i]!=c[j]:
            print("-1")
            break
    else:
        continue
    break
else:
    if N==1:
        b=[0]
        for i in range(0,M):
            b[s[i]-1]=c[i]
        print(b[0])
    else:
        b=[1]
        for i in range(0,N-1):
            b.append(0)
        if s[i]==1 and c[i]==0:
            print("-1")
        else:
            for i in range(0,M):
                b[s[i]-1]=c[i]
            for i in range(0,N):
                print(b[i],end='')

### FIXED CODE ###

N, M=map(int,input().split())
s=list()
c=list()
a=0
for i in range(0,M):
    s.append(0)
    c.append(0)
for i in range(0,M):
    s[i], c[i]=map(int,input().split())
for i in range(0,M):
    for j in range(0,M):
        if s[i]==s[j] and c[i]!=c[j]:
            print("-1")
            break
    else:
        continue
    break
else:
    if N==1:
        b=[0]
        for i in range(0,M):
            b[s[i]-1]=c[i]
        print(b[0])
    else:
        b=[1]
        for i in range(0,N-1):
            b.append(0)
        for i in range(0,M):
            if s[i]==1 and c[i]==0:
                print("-1")
                break
        else:
            for i in range(0,M):
                b[s[i]-1]=c[i]
            for i in range(0,N):
                print(b[i],end='')
import math

N = int(input())
d_list = []

for i in range(3, int(math.sqrt(N))):
  if N % i == 0:
    d_list.append(i)
    if i != math.sqrt(N):
      d_lsit.append(N / i)

output = sum(d_list) - (len(d_list) - 2) - 3
print(output)


### FIXED CODE ###

N, K = [int(x) for x in input().split(' ')]

output = N - K + 1

print(int(output))
import math
n, k = map(int, input().split())

mod = 10**9+7
sum = 0
for i in range(1,k+1):
    combi = math.factorial(k-1)/(math.factorial(i-1)*math.factorial(k-i))
    
    tmp = (math.factorial(n-k+i)/(math.factorial(n-k)*math.factorial(i)) - sum) * combi
    print(int(tmp%mod))
    sum += tmp


### FIXED CODE ###

import math
n, k = map(int, input().split())

def combination(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
mod = 10**9+7
for i in range(1,k+1):
    if n-k+1 < i:
        print(0)
    else:
        print(combination(n-k+1, i)*combination(k-1, i-1)%mod)
import math
r = int(input())

S = r ** 2 * math.pi
R = 2 * r * math.pi
print("{0:.6f}".format(S) + " " + "{0:.6f}".format(R))

### FIXED CODE ###

import math
r = float(input())
 
S = r ** 2 * math.pi
R = 2 * r * math.pi
print("{0:.6f}".format(S) + " " + "{0:.6f}".format(R))
x = int(input())
print x ** 3

### FIXED CODE ###

x = int(input())
print (x ** 3)
# input
N = int(input())
A = [int(x) for x in input().split()]

# Common divisor
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) #再帰定義

def gcd_wrapper(x, y):
    if x >= y:
        return gcd(x, y)
    else:
        return gcd(y, x)

if N == 2:
    print(max(A))
else:
    CD = []
    CD_alt = []
    for index, array_val in enumerate(A):
        if index != 0:
            CD.append(gcd_wrapper(A[0], array_val))
        if index != 1:
            CD_alt.append(gcd_wrapper(A[1], array_val))
    sorted_CD = sorted(CD)
    sorted_CD_alt = sorted(CD_alt)
    print(max([max(sorted_CD[0:2]), max(sorted_CD_alt[0:2])]))

### FIXED CODE ###

from math import floor

# input process
inputData = input().split()
# A秒後
A = int(inputData[0])
# B枚ずつ
B = int(inputData[1])
# T+0.5秒後まで
T = int(inputData[2])

# calculation process
prodCount = int(floor((float(T) + 0.5) // float(A)))
biscuitTotal = prodCount * B

# output process
print(biscuitTotal)
import math
def combi(n,r):
  ans = math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
  return ans

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

ans = 0
ans += combi(M,2)
ans += combi(N,2)
print(ans)


### FIXED CODE ###

import math
def combi(n,r):
  ans = math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
  return ans

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

ans = 0
if N > 1:
  ans += combi(N,2)
if M > 1:
  ans += combi(M,2)
print(ans)
r,g,b = map(int, input().split())
if (r*100+g*10+b)%%4 == 0:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

r,g,b = map(int, input().split())
if (r*100+g*10+b)%4 == 0:
  print('YES')
else:
  print('NO')
,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
for i in range(N):
  if A[i]%2==1: odd+=1
if odd==0:
  if P==1: print(0)
  else: print(2**N)
else:
  print(2**(N-1))

### FIXED CODE ###

N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
for i in range(N):
  if A[i]%2==1: odd+=1
if odd==0:
  if P==1: print(0)
  else: print(2**N)
else:
  print(2**(N-1))
n = input()
print(f"ABC{n}")

### FIXED CODE ###

n = input()
print("ABC"+n)
a = input()
 print(a + a * 2 + a * 3)


### FIXED CODE ###

a = int(input())
print(a + a**2 + a**3)
N = input()
sum = 0

tmp = N
while (N >= 1):
    sum += N % 10
    N /= 10

if tmp % sum == 0:
    print ('Yes')
else:
    print('No')


### FIXED CODE ###

N = int(input())
sum = 0

tmp = N
while (N >= 1):
    sum += N % 10
    N //= 10

if tmp % sum == 0:
    print ('Yes')
else:
    print('No')
import numpy as np
 
n,m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
d = 2**18
 
f = np.array([0]*d)
for i in a:
    f[i]+=1
 
tf = np.fft.fft(f)
f = np.fft.ifft(tf*tf)
f = [int(i+0.5) for i in f]
 
ans=0
for i in range(len(f)-1,0,-1):
    if f[i]<=m:
        ans+=i*f[i]
        m-=f[i]
    elif f[i]>m:
        ans+=i*m
        break
print(ans)

### FIXED CODE ###

import numpy as np

n,m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
d = 2**18

f = np.array([0]*d)
for i in a:
    f[i]+=1

tf = np.fft.fft(f)
f = np.fft.ifft(tf*tf)
f = [int(i+0.5) for i in f]

ans=0
for i in range(len(f)-1,0,-1):
    if f[i]<=m:
        ans+=i*f[i]
        m-=f[i]
    elif f[i]>m:
        ans+=i*m
        break
print(ans)
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

N = input()
l = [input() for i in range(N)]
a = 0
for i in range(0,len(l)):
    if ( is_prime(l[i]) == True
         a += 1
print(a)



### FIXED CODE ###

import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

N = input()
N = int(N)
l = [int(input()) for i in range(N)]
a = 0
for i in range(0,len(l)):
    if is_prime(l[i]) == True:
         a += 1
print(a)
n = input()

print("Yes" if n[0]=n[2] else "No")

### FIXED CODE ###

n = input()

print("Yes" if n[0]==n[2] else "No")
H, W, A, B = map(int, input().split())
answer = 0
mod = 1000000007
factorial = [1]
for n in range(1, H+W):
    factorial.append(factorial[n-1]*n%mod)
def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y/2)**2%mod
    else:
        return power(x, y/2)**2*x%mod

inverseFactorial = [0] * (H+W)
inverseFactorial[H+W-1] = power(factorial[H+W-1], mod-2)
for n in range(H+W-2, -1, -1):
    inverseFactorial[n] = inverseFactorial[n+1] * (n+1) % mod
def combi(n, m):
    return factorial[n] * inverseFactorial[m] *inverseFactorial[n-m]%mod

for i in range(B+1, W+1):
    answer = (answer + combi(H-A-2+i, i-1)*combi(A+W-i-1,W-i)) % mod
print(answer)

### FIXED CODE ###

f = False
a = input().split(' ')
for i in range(3):
  a[i]=int(a[i])
while True:
  for i in range(3):
    if a[i] != 5 and a[i] != 7:
      print('NO')
      f = True
      break
  if f == True:
    print(2)
    break
  if a[0] + a[1] + a[2] == 17:
    print('YES')
    break
  else:
    print('NO')
    break
import numpy as np
a, b, x = map(int,input().split())
if a * a * b * (1 / 2) >= x:   
    l = (2 * x) / (a * b)  
    print(180 / np.pi * np.arctan(b / l))
else:
    l = (2 * (a * a * b - x)) / (a * a)
    print(180 / np.pi * np.arctan(a / l))

### FIXED CODE ###

import numpy as np
a, b, x = map(int,input().split())
if x == 0:
    print(90)
elif a * a * b * (1 / 2) >= x:   
    l = (2 * x) / (a * b)
    print(180 / np.pi * np.arctan(b / l))
else:
    l = (2 * (a * a * b - x)) / (a * a)
    print(180 / np.pi * np.arctan(l / a))
while True:
	try:
		d = int(input())
	except:
		break
	ans = 0
	x = d
	while x < 600:
		ans += (x**2)*dx += d
	print(ans)


### FIXED CODE ###

while True:
	try: d = int(input())
	except: break
	print(sum([(i*d)**2*d for i in range(600//d)]))
n=int(input())
t,a=map(int,input().split())

h=[int(input()) for i in range(n)]

min=1000
for i in range(n):
  temp=abs(t-0.006*h[i]-a)
  if min>temp:
    min=temp
    id=i
print(id+1)

### FIXED CODE ###

n=int(input())
t,a=map(int,input().split())

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

min=1000
for i in range(n):
  temp=abs(a-t+0.006*h[i])
  if min>temp:
    min=temp
    id=i
print(id+1)
def main():
  N = int(input())
  A = [int(x) for x in input().split()]
  
  B = [0] * N
  for i in range(N):
    B[A[N-i-1]] += 1
  
  for i in range(N):
    print(B[i])
    
if __name__ == '__main__':
  main()

### FIXED CODE ###

def main():
  N = int(input())
  A = [int(x) for x in input().split()]
  
  B = [0] * N    
  for i in range(N-1):
      B[A[N-i-2]-1] += 1
  
  for i in range(N):
    print(B[i])
    
if __name__ == '__main__':
  main()
S=input()
if len(S)==len(set(list(S))):
  print('yes'):
else:
  print('no')

### FIXED CODE ###

S=input()
if len(S)==len(set(list(S))):
  print('yes')
else:
  print('no')
i = input().split(" ")
n = int(i[0])
x = int(i[1])
l = input().split(" ")
height = 0
count = 0

while height <= x:
    height += int(l[count])
    count += 1

print(count)


### FIXED CODE ###

i = input().split(" ")
n = int(i[0])
x = int(i[1])
l = input().split(" ")
height = 0
count = n+1

for i in range(n):
    if (height + int(l[i]) <= x):
        height += int(l[i])
    else:
        count = i + 1
        break

print(count)
A=input() B=input() C=input() K=input()
if (K<=A):
  print(K)
elif (A<K<=A+B):
  print(A)
else:
  print(2A+B-k)

### FIXED CODE ###

A, B, C, K = map(int, input().split())
if K <= A:
  print(K)
elif K <= A+B:
  print(A)
else:
  print(2*A+B-K)
X = input()

idx = 0

while idx < len(X):
    print(idx, X)
    if X[idx] == 'S':
        if idx+1 < len(X) and X[idx+1] == 'T':
            X = X[:idx] + X[idx+2:]
            idx = max(-1, idx-2)
    idx += 1

print(len(X))

### FIXED CODE ###

X = input()

s, t = 0, len(X)//2
cnt = 0
used = 0
for x in X:
    if x == 'S':
        s += 1
        if t-used > 0:
            cnt += 1
            used += 1
    else:
        used = max(0, used-1)
        t -= 1

print(len(X)-cnt*2)