Harryxun/stf_run huggingface dataset:
N, A, B, C = map(int, input().split())
mod = 10 ** 9 + 7

W = [1] * (2 * N)
for i in range(2 * N - 1):
	W[i + 1] = ((w + 1) * W[i]) % mod

def rev(a):
	return pow(a, mod - 2, mod)

def comb(a, b):
	return (W[a] * rev(W[b]) * rev(W[a - b])) % mod

def f(a, b):
	res = 0
	for i in range(N):
		res += ((i + N) * com[i] * pow(b, i, mod)) % mod
		res %= mod
	return (pow(a, N, mod) * res) % mod

a = A * rev(A + B)
b = B * rev(A + B)
c = C * rev(100)
com = [comb(i + N - 1, i) for i in range(N)]

w_a = f(a, b)
w_b = f(b, a)
ans = ((w_a + w_b) * rev(1 - c)) % mod
print(ans)

### FIXED CODE ###

N, A, B, C = map(int, input().split())
mod = 10 ** 9 + 7

W = [1] * (2 * N)
for i in range(2 * N - 1):
	W[i + 1] = ((i + 1) * W[i]) % mod

def rev(a):
	return pow(a, mod - 2, mod)

def comb(a, b):
	return (W[a] * rev(W[b]) * rev(W[a - b])) % mod

def f(a, b):
	res = 0
	for i in range(N):
		res += ((i + N) * com[i] * pow(b, i, mod)) % mod
		res %= mod
	return (pow(a, N, mod) * res) % mod

a = A * rev(A + B)
b = B * rev(A + B)
c = C * rev(100)
com = [comb(i + N - 1, i) for i in range(N)]

w_a = f(a, b)
w_b = f(b, a)
ans = ((w_a + w_b) * rev(1 - c)) % mod
print(ans)
from math import gcd
N, X = map(int, input().split())
l = list(map(int, input().split()))
g = X - l[0]
for i in l[1:N]:
	if i == X: continue
	g = gcd(g, abs(X-i))

print(abs(g))

### FIXED CODE ###

N, X = map(int, input().split())
l = list(map(int, input().split()))
g = X - l[0]
from fractions import gcd
for i in l[1:N]:
	if i == X: continue
	g = gcd(g, abs(X-i))

print(abs(g))
def solve(n,s,lst):
    if n == 0 and s == 0:
        return(1)
    elif s < lst[0] or len(lst)==0:
        return(0)
    else:
        return(solve(n-1,s-lst[0],lst[1:]) + solve(n,s,lst[1:]))

if __name__ == "__main__":
    while True:
        n, s = map(int, input().split())
        if n==0 and s==0:
            break
        print(solve(n,s,list(range(9))))

### FIXED CODE ###

def solve(n,s,lst):
    if n == 0 and s == 0:
        #print("Complete!")
        return(1)
    elif n==0 or len(lst)==0 or s < lst[0]:
        return(0)
    else:
        return(solve(n-1,s-lst[0],lst[1:]) + solve(n,s,lst[1:]))

if __name__ == "__main__":
    while True:
        n, s = map(int, input().split())

        if n==0 and s==0: 
            break
        print(solve(n,s,list(range(10))))
            
        if n==0 and s==0:
            break
N = int(input())
print("Yes" if "7" in N else "No")

### FIXED CODE ###

N = input()
print("Yes" if "7" in N else "No")
xs = list(map(int,input().split()))
print(xs.index(0)+1)1 

### FIXED CODE ###

xs = list(map(int,input().split()))
print(xs.index(0)+1)
A, B, C, X, Y = map(int, input().split())

if A + B > 2 * C:
    if A < B:
        ans = 2 * C * Y + min(A, 2 * C) * max((X - Y), 0)
    else:
        ans = 2 * C * X + min(B, 2 * C) * max((Y - X), 0)
else:
    ans = A * X + B * Y

print(ans)

### FIXED CODE ###

S = input()
ans = 700 + S.count('o') * 100
print(ans)
x = input()
y = input()

if len(x) > 10:
  print('No')
elif len(y) - len(x) !=:
  print('No')
elif x.islower() ==False:
  print('No')
else:
  print('Yes')
  

### FIXED CODE ###

x = input()
y = input()
 
if len(x) > 10:
  print('No')
elif len(y) - len(x) != 1:
  print('No')
elif x.islower() ==False or x.isalpha() != True:
  print('No')
elif x != y[:-1]:
  print('No')
else:
  print('Yes')
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n ,k = i2()
p = intl()
def sx(n):
    return (n+1)/2

m = 0
pnt = 0
for i in range(0,n-k+1):
    s = sum(p[i:i+k])
    if s > m:
        m = s
        pnt = i
cnt = 0
for j in range(pnt,pnt+k):
    cnt += sx(p[j])
print(cnt)

### FIXED CODE ###

import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
l = input().split()
s,t = l[0],l[1]
a ,b = i2()
u = input()
if s == u:
    print(a-1,b)
else:
    print(a,b-1)
def A(x):
  return x + x**2 + x**3


def B(s, t):
  ans = 0
  for i in range(len(s)):
    if s[i] != t[i]:
      ans += 1
  return ans


def C(n, m, k, a, b):
  pa = 0
  pb = 0
  ans = 0
  while k > 0:
    if pa < len(a) and a[pa] < b[pb]:
      k -= a[pa]
      pa += 1
    elif pb < len(b):
      k -= b[pb]
      pb += 1
    else:
      break
    if k >= 0:
      ans += 1
  return ans


def main():
  n, m, k = map(int, input().split())
  a = list(map(int, input().split()))
  b = list(map(int, input().split()))
  print(C(n, m, k, a, b))


if __name__ == '__main__':
  main()


### FIXED CODE ###

def A(x):
  return x + x**2 + x**3


def B(s, t):
  ans = 0
  for i in range(len(s)):
    if s[i] != t[i]:
      ans += 1
  return ans


def C(n, m, k, a, b):

  def _get_acc(x):
    acc = [0]
    for idx in range(len(x)):
      acc.append(x[idx] + acc[idx])
    return acc

  acc_a = _get_acc(a)
  acc_b = _get_acc(b)

  pa = 0
  pb = 0

  while pa <= n and acc_a[pa] <= k:
    pa += 1
  pa -= 1

  max_num = 0
  while True:
    if pa < 0 or pb > m:
      break
    if acc_a[pa] + acc_b[pb] <= k:
      if max_num < pa + pb:
        max_num = pa + pb
      pb += 1
    else:
      pa -= 1

  return max_num


def main():
  n, m, k = map(int, input().split())
  a = list(map(int, input().split()))
  b = list(map(int, input().split()))
  print(C(n, m, k, a, b))


if __name__ == '__main__':
  main()
H, W = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(H)]

ans = []
dx = -1
w = 0

for h in range(H):
    dx *= -1
    for j in range(W):
        if A[h][w] % 2 == 1:
            A[h][w] -= 1
            a = [h+1, w+1]
            if w + dx < 0 or w + dx >= W:
                if h + 1 == H:
                    break
                A[h+1][w] += 1
                a += [h+2, w+1]
            else:
                A[h][w+dx] += 1
                a += [h+1, w+1+dx]
            ans.append(a)
        w += dx
        
print(len(ans))
for a in ans:
    print(*a)


### FIXED CODE ###

H, W = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(H)]

ans = []
dx = -1
w = 0

for h in range(H):
    dx *= -1
    for j in range(W):
        if A[h][w] % 2 == 1:
            A[h][w] -= 1
            a = [h+1, w+1]
            if w + dx < 0 or w + dx >= W:
                if h + 1 == H:
                    break
                A[h+1][w] += 1
                a += [h+2, w+1]
            else:
                w += dx
                A[h][w] += 1
                a += [h+1, w+1]
            ans.append(a)
            
        elif 0 <= w + dx < W:
            w += dx
            
            
        

print(len(ans))
for a in ans:
    print(*a)
N = int(input())
ans = 0

def dfs(s):
    if int(s) > N:
        return

    if s.count('7') and s.count('5') and s.count('3'):
        cnt += 1
    
    dfs(s + '7')
    dfs(s + '5')
    dfs(s + '3')

dfs('')

print(ans)

### FIXED CODE ###

N = int(input())
ans = 0

def dfs(i):
    global ans
    if int(i) > N:
        return
    if all(i.count(c) for c in '753'):
        ans += 1
    dfs(i + '3')
    dfs(i + '5')
    dfs(i + '7')
    
dfs('0')

print(ans)
import math
n,m=map(int,input().split())
# 1*mのうちnコを予め除いた残りで組み合わせの数を求められる
# (m-n+n-1)!/((m-n)!(n-1)!)
if n%m==0:
    print(m//n)
else:
    print(math.gcd(m//n,m%n))


### FIXED CODE ###

# できなかった
# a1,...,anがdivisorで割り切れる、すなわちdivisorはMの約数である
n,m=map(int,input().split())

divisors=[]
for i in range(1,int(m**0.5)+1):
    if m%i==0:
        divisors.append(i)
        if i!=m//i:
            divisors.append(m//i)

divisors.sort(key=lambda x:-x)
# print(divisors)
for d in divisors:
    if d<=m//n:
        print(d)
        break
import sys
import numpy as np
def main():
    input = sys.stdin.readline
    N = int(input())
    ans = (1 + (N - 1)) / 2 * (N - 1)

    if N <= 1e07:
      a = np.arange(start=1, step=1, stop=N+1)
      if N %2 == 1:
        bol = (a % ((N+1)/2) >= a)
        ans += np.sum((a % ((N+1)/2)[bol] - a[bol]))
      else:
        bol = (a % (N/2) >= a)
        ans += np.sum((a % (N/2)[bol] - a[bol])
    print(int(ans))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import numpy as np
def main():
    input = sys.stdin.readline
    N = np.int64(input())
    #print(N)
    #ans = np.int64((1 + (N - 1)) / 2 * (N - 1))
    ans = (1 + (N - 1)) * (N - 1) // 2
    print(int(ans))
if __name__ == '__main__':
    main()
import math

A, B, C, D = map(int, input().split())
CD = int(C * D / math.gcd(C, D))

#print(CD)

C_count = B//C - (A-1)//C 
D_count = B//D - (A-1)//D
CD_count = B//CD - (A-1)//CD 



#print(C_count, D_count, CD_count)

print(B - A + 1 - C_count - D_count + CD_count)

### FIXED CODE ###


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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)


CD = lcm(C, D)

#print(CD)

C_count = B//C - (A-1)//C 
D_count = B//D - (A-1)//D
CD_count = B//CD - (A-1)//CD 



#print(C_count, D_count, CD_count)

print(B - A + 1 - C_count - D_count + CD_count)
while True:
    a, b = map(int, raw_input().split())
    if a is None:
        break
    print len(a+b)

### FIXED CODE ###

while True:
    try:
        a, b = map(int, raw_input().split())
        print len(str(a+b))
    except:
        break
# -*- coding: utf-8 -*-
a,b,c = list(map(int,input().split()))
from decimal import Decimal
a,b,c = list(map(Decimal,[a,b,c]))

ret = "No"
if a**0.5+b**0.5<c**0.5:
    ret="Yes"
print(ret)

### FIXED CODE ###

# -*- coding: utf-8 -*-
a,b,c = list(map(int,input().split()))


ret = "No"
if c-a-b<0:
    ret="No"
elif 4*a*b<(c-a-b)**2:
    ret="Yes"
print(ret)
N,M=map(int,input().split())
a=list(map(int,input().split()))

A=sum(a)
if N-A<0:
  print(-1)
  else :
    print(N-A)


### FIXED CODE ###

R=float(input())

print(R*2*3.141592)
import itertools
a0,b0,c0 = map(int, input().split())
k = int(input())
p = itertools.product(range(3),repeat = k)
ans = 'No'
for i in p:
    a,b,c = a0,b0,c0
    if i[0] == 0:
        a = 2*a
    elif i[0] == 1:
        b = 2*b
    elif i[0] == 2:
        c = 2*c
    if b > a and c > b:
        ans = 'Yes'
        break
    if i[1] == 0:
        a = 2*a
    elif i[1] == 1:
        b = 2*b
    elif i[1] == 2:
        c = 2*c
    if b > a and c > b:
        ans = 'Yes'
        break
    if i[2] == 0:
        a = 2*a
    elif i[2] == 1:
        b = 2*b
    elif i[2] == 2:
        c = 2*c
    if b > a and c > b:
        ans = 'Yes'
        break
print(ans)

### FIXED CODE ###

import itertools
a0,b0,c0 = map(int, input().split())
k = int(input())
p = itertools.product(range(3),repeat = k)
ans = 'No'
for i in p:
    a,b,c = a0,b0,c0
    for ii in i:
        if ii == 0:
            a = 2*a
        elif ii == 1:
            b = 2*b
        elif ii == 2:
            c = 2*c
        
        if b > a and c > b:
            ans = 'Yes'
            break
    if ans == 'Yes':
        break
print(ans)
T, X = map(int, input.split()) 
print(T / X)



### FIXED CODE ###

T, X = map(int, input().split()) 
print(T / X)
N = int(input())
X = input()

cnt = 0
for i in range(N):
    if X[i] == "1":
        cnt += 1
    
down = [0] * N
up = [0] * N
ald = 0
alu = 0
for i in range(N):
    down[i] = pow(2, N-1-i, cnt-1)
    up[i] = pow(2, N-1-i, cnt+1)
    if X[i] == "1":
        ald += down[i]
        ald %= cnt-1
        alu += up[i]
        alu %= cnt+1

for i in range(N):
    if X[i] == "1":
        n = (ald - down[i]) % (cnt-1)
    else:
        n = (alu + up[i]) % (cnt+1)
    ans = 1
    while n != 0:
        c = 0
        for j in range(18):
            if (n >> j) % 2 == 1:
                c += 1
        n %= c
        ans += 1
    print(ans)
        
    
    

### FIXED CODE ###

N = int(input())
X = input()

cnt = 0
for i in range(N):
    if X[i] == "1":
        cnt += 1
    
down = [0] * N
up = [0] * N
ald = 0
alu = 0
for i in range(N):
    up[i] = pow(2, N-1-i, cnt+1)
    if X[i] == "1":
        alu += up[i]
        alu %= cnt+1
    if cnt <= 1:
        continue
    down[i] = pow(2, N-1-i, cnt-1)
    if X[i] == "1":
        ald += down[i]
        ald %= cnt-1

for i in range(N):    
    if X[i] == "1":
        if cnt == 1:
            print(0)
            continue
        n = (ald - down[i]) % (cnt-1)
    else:
        n = (alu + up[i]) % (cnt+1)
    ans = 1
    while n != 0:
        c = 0
        for j in range(20):
            if (n >> j) % 2 == 1:
                c += 1
        n %= c
        ans += 1
    print(ans)
S = input()
N = len('S')
if S = S[::-1] and S[0:(N-3)/2] = S[0:(N-3)/2:-1]:
    print ('Yes')
else:
    print ('No')

### FIXED CODE ###

S = input()
N = len(S)
K = (N-3)//2
if S == S[::-1] and S[0:K] == S[K:0:-1]:
    print ('Yes')
else:
    print ('No')
ins = list(map(int, input().split()))
N = ins[0]
L = ins[1]
Ss = []

for i in range(N):
  Ss.append(input())

for i, a in enumerate(Ss):
  key = a
  j = i - 1

  while j >= 0 and Ss[j] > a:
    Ss[j + 1] = Ss[j]
    j = j - 1

  Ss[j + 1] = key

print(' '.join(Ss))

### FIXED CODE ###

arr = list(input().split())

result = "YES" if ((arr.count('5')) == 2 and (arr.count('7')) == 1) else "NO"

print(result)
N=int(input())
a_list = list(map(int,input().split()))
ans = 0
min = a_list[0]
for i in range(1,N):
  if min > a_list[i]:
    ans += a_list[i]-m
  else:
    min = a_list[i]
print(ans)
             

### FIXED CODE ###

N=int(input())
a_list = list(map(int,input().split()))
ans = 0
min = a_list[0]
for i in range(1,N):
  if min > a_list[i]:
    ans += min-a_list[i]
  else:
    min = a_list[i]
print(ans)
n = int(input())
pL = [input() for i in range(n)]
print(sum(pL)-max(pL)/2)

### FIXED CODE ###

n = int(input())
pL = [int(input()) for i in range(n)]
print(int(sum(pL)-(max(pL)/2)))
# codoing: utf-8

import math

num = input()

menseki = int(num)**2*math.pi
ensyu = 2*int(num)*math.pi

print(str("{0:6f}".format(menseki)) + " " + str("{0:6f}".format(ensyu)))

### FIXED CODE ###

# cording: utf-8

import math

num = float(input())

print(str(num**2*math.pi) + " " + str(2*num*math.pi))
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

a,b = map(str,input().split())

if a == "H" and b == "H":
    tp == True
elif a=="D" and b == "H"
    tp == False
elif a=="D" and b=="D":
    tp = True
else:
    tp = False


if tp:
    print("H")
else:
    print("D")


### FIXED CODE ###

# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

a,b = map(str,input().split())

if a == "H" and b == "H":
    tp = True
elif a=="D" and b == "H":
    tp = False
elif a=="D" and b=="D":
    tp = True
else:
    tp = False


if tp:
    print("H")
else:
    print("D")
from decimal import Decimal

def main():
    a, b, n = list(map(int, input().split()))
    
    floor_list = []
    
    for i in range(n+1):
        floor_1 = int(Decimal(a*i/b))
        floor_2 = a * int(Decimal(i/b))
        floor_list.append(floor_1 - floor_2)
    
    print(max(floor_list))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def we_love_golf():
    K = int(input())
    condition = input()
    condition_list = condition.split()
    A = int(condition_list[0])
    B = int(condition_list[1])
    
    for i in range(A, B+1):
        if i % K == 0:
            print('OK')
            return
    
    print('NG')
    return

we_love_golf()
n = int(input())

def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

def search_divisor_num(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num
print(search_divisor_num(n) % (pow(10,9) + 7))

### FIXED CODE ###

import math
import collections

def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    factor.append(n)
    return factor

n = int(input())
c = collections.Counter([])
for num in range(2, n+1):
  prime_list = trial_division(num)
  c.update(prime_list)
res = 1
for prime, count in c.most_common():
  if(prime > 1):
    res = res * (count + 1)
print(res % (pow(10,9) + 7))
k=int(input())

ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        an=fractions.gcd(i,j)
        for s in range(1,k+1):
            anse=fractions.gcd(s,an)
            ans+=anse
print(ans)

### FIXED CODE ###

k=int(input())
from math import gcd
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for s in range(1,k+1):
            ans+=gcd(gcd(i,j),s)
print(ans)
n = int(input())

dishes = list()

for i in range(0, n):
    a, b = raw_input().split()
    a = int(a)
    b = int(b)
    sum = a + b
    dishes.append([a, b, sum])

takahashi = 0
aoki = 0
dishes.sort(key=lambda x: x[2], reverse=True)

for i in range(0, n):
    if i % 2 == 0:
        j = dishes[0]
        dishes.pop(0)
        takahashi = takahashi + j[0]
    else:
        j = dishes[0]
        dishes.pop(0)
        aoki = aoki + j[1]

print(takahashi - aoki)


### FIXED CODE ###

#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
import math


n = int(input())

dishes = list()

for i in range(0, n):
    a, b = raw_input().split()
    a = int(a)
    b = int(b)
    sum = a + b
    dishes.append([a, b, sum])

takahashi = 0
aoki = 0
dishes.sort(key=lambda x: x[2], reverse=True)

for i in range(0, n):
    if i % 2 == 0:
        j = dishes[0]
        dishes.pop(0)
        takahashi = takahashi + j[0]
    else:
        j = dishes[0]
        dishes.pop(0)
        aoki = aoki + j[1]

print takahashi - aoki
N,M=map(int,input().split())
a = list(map(int, input().split()))
list.sort(a, reverse=True)

if a[M-1] < sum(a)/(4*M) :
  print("No")
else:
  print("Yes")


### FIXED CODE ###

X,Y,Z=map(int,input().split())
print(Z,X,Y)
n, m = map(int, input().split())
a_pos = [0]*(n+1)
for i in range(m):
    a_pos[int(input())] = 1
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if aL[0] == 1 else 1
for i in range(2, n+1):
    if a_pos[i] == 1:
        dp[i] = 0
    else:
        dp[i] = (dp[i-2] + dp[i-1]) % mod

print(dp[-1])

### FIXED CODE ###

n, m = map(int, input().split())
a_pos = [0]*(n+1)
for i in range(m):
    a_pos[int(input())] = 1
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if a_pos[1] else 1
for i in range(2, n+1):
    if a_pos[i] == 1:
        dp[i] = 0
    else:
        dp[i] = (dp[i-2] + dp[i-1]) % mod

print(dp[-1])
n,a,b,c,d = (int(i) for i in input().split())  
s = input()
e = 0
if c<d:
  if s[a:c-1].count("##")==0 and s[b:d-1].count("##")==0:
    print("Yes")
  else:
    print("No")
else:
  if s[a:c-1].count("##")==0 and s[b:d-1].count("##")==0 and s.[b-2:d+1].count("...")>0:
    print("Yes")
  else:
    print("No")



### FIXED CODE ###

n,a,b,c,d = (int(i) for i in input().split())  
s = input()
e = 0
if c<d:
  if s[a:c-1].count("##")==0 and s[b:d-1].count("##")==0:
    print("Yes")
  else:
    print("No")
else:
  if s[a:c-1].count("##")==0 and s[b:d-1].count("##")==0:
    for i in range(b-1,d):
      if s[i-1:i+2]=="..." :
        e = 1 
    if e == 1:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
import math
import fractions import gcd
import numpy as np
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

K = int(input())

ans = 0

for a in range(1,K+1) :
    for b in range(1,K+1) :
        for c in range(1,K+1) :
           X = fractions.gcd(a, b)
           Y = fractions.gcd(X, c)
           ans += Y

print(ans)

### FIXED CODE ###

from math import gcd

K = int(input())

ans = 0

for a in range(1,K+1) :
    for b in range(1,K+1) :
        X = gcd(a, b)
        for c in range(1,K+1) :
           Y = gcd(X, c)
           ans += Y

print(ans)
n=int(input())
if (n==0)print(1)
else print(0)

### FIXED CODE ###

n=int(input())
if (n==0):print(1)
else :print(0)
N = int(input())
A = [int(input()) for i in range(N - 1)]
for i in range(1, N + 1):
  print(A.count(i))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = [0 for i in range(N)]
for a in A:
  ans[a - 1] += 1
for a in ans:
  print(a)
import sys
sys.setrecursionlimit(8000)
 
n=int(input())
h=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0
 
def rec(i):
    if dp[i]<float('inf'):
        return dp[i]
    
    if i==0:
        return 0
    
    res=float('inf')#最小に更新する
    
    res=min(res,rec(i-1)+abs(h[i]-h[i-1]))
    if i>1:
        #i-2が負になる場合を避ける
        res=min(res,rec(i-2)+abs(h[i]-h[i-2]))
    
    return res
    
    
print(rec(n-1))

### FIXED CODE ###

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

dp=[float('inf')]*n
dp[0]=0#初期条件を設定

for i in range(1,n):
    dp[i]=min(dp[i],dp[i-1]+abs(h[i]-h[i-1]))
    #i=1の時i-2<0となるので先にここを計算する
    if i>=2:
        dp[i]=min(dp[i],dp[i-2]+abs(h[i]-h[i-2]))
        
print(dp[-1])
a=int(input())
b=int(input())
if a>b:
  print(2*a-1)
elif a==b:
  print(2*a)
else:
  print(2*b-1)

### FIXED CODE ###

a,b=map(int, input().split())
if a>b:
  print(2*a-1)
elif a==b:
  print(2*a)
else:
  print(2*b-1)
# -*- coding:utf-8 -*-
# /usr/bin/python3

def main():
  N = int(input())
  liA = list(map(int, input().strip().split(' ')))
  liB = []
  for i, a in enumerate(liA[::-1]):
    i = len(liA) - i
    sumA = sum([liA[j] for j in range(i, len(liA), i+1)])
    if sumA % 2 != a:
      liA[i] += 1
      liB += [i]
  print(len(liB))
  print(' '.join(map(str,liB)))
  pass

if __name__=='__main__':
  main()


### FIXED CODE ###

# -*- coding:utf-8 -*-
# /usr/bin/python3

def main():
  N = int(input())
  liA = list(map(int, input().strip().split(' ')))
  boxes = [0 for _ in range(len(liA))]
  index = []
  for i in range(len(liA))[::-1]:
    sumBoxes = sum([boxes[j] for j in range(i, len(boxes), i+1)])
    if sumBoxes % 2 != liA[i]:
      boxes[i] += 1
      index += [i+1]
  print(len(index))
  print(' '.join(map(str, index)))
  pass

if __name__=='__main__':
  main()
v

### FIXED CODE ###


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

W = [0]
E = [0]

for i in range(N): 
  s = S[i]
  if s == "W":
    W.append(W[-1] + 1)
    E.append(E[-1])
  else:
    W.append(W[-1])
    E.append(E[-1] + 1)


ans = float("inf")
for i in range(N):
  ans = min(ans, W[i] + (E[-1] - E[i+1]))
print(ans)