peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n=int(input())
x=[]
for i in range(n):
    key,val=map(str,input().split())
    x.append([key,-int(val),i+1])
dic_sort=sorted(x, key=lambda x:(x[0],x[1]))
print(dic_sort)
for i in range(n):
    print(dic_sort[i][2])
# Judge status: Accepted
s = input()
t = input()
minCount = len(t)
i = 0
while i < len(s) and i + len(t) <= len(s):
    countSame = 0
    j = 0
    while j < len(t):
        if t[j] == s[i+j]:
            countSame += 1
        j += 1
        minCount = min(len(t) - countSame, minCount)
    i += 1
print(minCount)
# Judge status: Accepted
S,T=map(str,input().split())
s,t=map(int,input().split())
U=input()

if S==U:
    print(s-1,t)
elif T==U:
    print(s,t-1)
# Judge status: Accepted
def main():
    n, k, s = map(int, input().split())
    ans = []
    for i in range(k):
        ans.append(str(s))
    for i in range(n-k):
        if s < 10**9:
            ans.append(str(s+1))
        else:
            ans.append('1')

    print(' '.join(ans))


main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
if a[0] > 0 or a.count(0) > 1:
  print(0)
  exit()
  
a = sorted(a)
dp = [0]*(n+1)
dp[0] = 1
count_list = [0]*n
count_list[0] = 1
for i in range(1, n):
  count_list[a[i]] += 1
for i in range(1, a[n-1]+1):
  dp[i] = dp[i-1] * count_list[i-1] ** count_list[i] % 998244353
print(dp[a[n-1]])
# Judge status: Accepted
input()
L = list(map(int, input().split()))
print("Yes" if sum(L) > 2*max(L) else "No")
# Judge status: Wrong Answer
A = input("3numbers")
if A in [7]:
    print("yes")
else:
    print("no")
# Judge status: Accepted
a,b = map(int, input().split())
if a-1>=b:
  print(2*a-1)
elif b-1 >= a:
  print(2*b-1)
elif a==b:
  print(a+b)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
count = 0
for i in range(N-2):
  if A[i] <= A[i+1]:
    if A[i+1] > A[i+2]:
      count += 1
      break
for i in range(N-2):
  if A[i] >= A[i+1]:
    if A[i+1] < A[i+2]:
      count += 1
      break

print(count + 1)
# Judge status: Accepted
s = set(input())
alp = 'abcdefghijklmnopqrstuvwxyz'
for a in alp:
    if a not in s:
        print(a)
        exit()
print('None')
# Judge status: Wrong Answer
a = sorted(list(input().split()))
ans = int(a[0])+int(a[1]+a[2])
print(ans)
# Judge status: Accepted
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    D = int(sys.stdin.readline().rstrip())
    print('Christmas' + ' Eve'*(25-D))



if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import math
N, K = map(int, input().split())

var = N % K
if var == 0 or N == 0:
        print(0)
elif var == K-1 or var == 1:
        print(1)
else:
        ans = N
        while ans != N:
                ans = N
                N = N // K
        print(ans)
# Judge status: Wrong Answer
w = input()
if len(w)/len(set(w))==2:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
print((1+N)*N//2)
# 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(N):
    ans = B[i] + ans
for i in range(N-1):
    if A[i+1] == A[i]+1:
        ans = C[A[i]-1] + ans
print(ans)
# Judge status: Wrong Answer
import math
n,d = map(int,input().split())
c = 0

for i in range (n):
  a,b = map(int,input().split())
  if math.sqrt(a*a +b *b) >=d:
    c+=1

print(c)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
import math

H, W = map(int, input().split(' '))
ans = (H * W) // 2
if H % 2 == 1 and W % 2 == 1:
    ans += 1
if H == 1 or W == 1:
    ans = 0
print(ans)
# Judge status: Accepted
# abc165

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

if n>=b-1:
    print(a*(b-1)//b)
else:
    print(a*n//b)
# Judge status: Accepted
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]


def fetch_ints_inputs(times):
    return [fetch_int_input() for _ in range(times)]

N = int(fetch_one_line())
nums = fetch_int_input()

min_num = 999999999999999999
count = 0

for num in nums:
    if min_num >= num:
        count += 1
        min_num = num

print(count)
# Judge status: Wrong Answer
S=input()
count=0
max_count=-1
for i in range(len(S)):
    if S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T":
        count=count+1
    else:
        if max_count<count:
            max_count=count
            count=0
print(max_count)
# Judge status: Accepted
line = input()
a, b, k = line.split(" ")
a = int(a)
b = int(b)
k = int(k)
 
if k >= a+b:
    print(0,0)
else:
    if a - k < 0:
        print(0, b-(k-a))
    else:
        print(a - k, b)
# Judge status: Wrong Answer
n = int(input())
mod = n%1000
print(1000-mod)
# Judge status: Wrong Answer
n = int(input())
XL = []
for i in range(n):
  x, l = map(int, input().split())
  XL.append([x, l])
  
XL.sort(key=lambda x: x[0]-x[1])

seen = -10**10
ans = 0
for i in range(n):
  rob = XL[i]
  if seen <= rob[0]+rob[1]:
    seen = rob[0]+rob[1]
    ans += 1

print(ans)
# Judge status: Accepted
S = input()
a = S.count('N')
b = S.count('S')
c = S.count('E') 
d = S.count('W')

if a*b*c*d > 0:
  print('Yes')
elif a*b > 0 and c==0 and d==0:
  print('Yes')
elif c*d >0 and a==0 and b==0:
  print('Yes')
elif a==0 and b==0 and c==0 and d==0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
def main():
    args = input().rstrip().split(' ')
    S = [c for c in args[0]]
    if(S[0]==S[1] and S[0]==S[2] and S[1]==S[2]):
        print('No')
    else:
        print('Yes')
    
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N=int(input())
d=[int(s) for s in input().split(" ")]

d.sort()

if (N//2)%2==0:
    print(0)
else:
    K=d[(N//2)]-d[N//2-1]
    if K==0:
        K=1
    print(K)
# Judge status: Wrong Answer
L,R,d = map(int, input().split())
print(R//d-L//d)
# Judge status: Accepted
K = int(input())
A, B = map(int, input().split())
result = 'NG'
for i in range (A, B + 1):
    if i % K == 0:
        result = 'OK'
print(result)
# Judge status: Accepted
H, A = map(int, input().split())
i = 0
while H > 0:
  H = H - A
  i = i + 1
print(i)
# Judge status: Accepted
A,B = map(int,input().split())	
abc = -1

for i in range(10000,-1,-1):
    tax1 = int(i*0.08)
    tax2 = int(i*0.1)
    if tax1 == A and tax2 == B:
        abc = i
print(abc)
# Judge status: Accepted
from collections import Counter
mod = 998244353

n = int(input())
dl = list(map(int, input().split()))
c = Counter(dl)

if dl[0]!=0:
    print(0)
    exit()

if c[0]!=1:
    print(0)
    exit()

res = 1
for x in range(max(dl)):
    res *= pow(c[x],c[x+1],mod)
    res %= mod

print(res)
# Judge status: Accepted
n = int(input())
if n > 1:
    print(((10**n) - (9**n * 2 - 8**n))%(10**9+7))
else:
    print("0")
# Judge status: Accepted
import bisect,collections,copy,heapq,itertools,math,string
import sys
def I():
    #1 line 1 int
     return int(sys.stdin.readline().rstrip())
def LI():
    #1 line n int
     return list(map(int,sys.stdin.readline().rstrip().split()))
def S():
    #1 line 1 string
     return sys.stdin.readline().rstrip()
def LS():
    #1 line n strings
     return list(sys.stdin.readline().rstrip().split())

C1=S()
C2=S()

if C1[0]==C2[2] and C1[1]==C2[1] and C1[2]==C2[0]:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = int(input())
e = a[1]-b[1]
if e == 0 or e <= 0:
  print("NO")
else:
  g = a[0]*e
  h = g-b[0]
  if h % e == 0:
    print("YES")
  else:
    print("NO")
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))
d = {}
for a in A:
  d[a] = d.get(a, 0) + 1
for i in range(M):
  b, c = map(int, input().split())
  d[c] = d.get(c, 0) + b
ans = 0
n = 0
for a, b in sorted(d.items(), reverse=True):
  if n >= N: break
  elif n + b > N:
    ans += a * (N - n)
  else:
    ans += a * b
  n += b
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
m = a[0]
for i in range(1,n):
    if m>a[i]+1:
        print("No")
        break
    m = max(m,a[i])
else:
    print("Yes")
# Judge status: Wrong Answer
N, M = map(int, input().split())
k = (2 * M - N) // 6
print(N+k)
# Judge status: Accepted
import math
n,d=input().split(' ')
n=int(n)
d=int(d)
count=0

for i in range(0,n):
    x,y=input().split(' ')
    x=int(x)
    y=int(y)
    dist=math.sqrt((x*x)+(y*y))
    if(dist<=d):
        count+=1
print(count)
# Judge status: Wrong Answer
import numpy as np

s = input().split()
H = int(s[0])
N = int(s[1])

m = np.array([list(map(int, input().split())) for i in range(N)])

A = m[:, 0]
B = m[:, 1]

i = np.argmax(A / B)

if H // A[i] == 0:
    print((H // A[i])*B[i])
else:
    j = np.argmin(B)
    print((H // A[i])*B[i] + B[j])
# Judge status: Wrong Answer
N, C, K = map(int, input().split())
arr = sorted([int(input()) for _ in range(N)])
start_t = arr[0]
bus_n = 0
ans = 0
for i in range(N):
    if arr[i] < start_t + K and bus_n < C:
        bus_n += 1
    else:
        bus_n = 1
        start_t = arr[i]
        ans += 1
if bus_n != 0:
    ans += 1
print(ans)
# Judge status: Accepted
S=input()
DNA=['A','T','C','G']

count=0
v=0
for ch in S:
  if ch in DNA:
    count+=1
  else:
    if v < count:
      v=count
      count=0
    else:
      count=0
if v < count:
  v=count

print(v)
# Judge status: Accepted
s = input()
l = len(s)
S =[]
for i in range(l):
    S.append(int(s[i]))
m = [1]
n = [0]
for i in range(1,l):
    if i % 2 == 1:
        m.append(0)
        n.append(1)
    else:
        m.append(1)
        n.append(0)
ans1 = 0
ans2 = 0
for i in range(l):
    if m[i] != S[i]:
        ans1 += 1
    if n[i] != S[i]:
        ans2 += 1
print(min(ans1,ans2))
# Judge status: Wrong Answer
#!/usr/bin/env python3

n = int(input())
A = list(map(int, input().split()))
pn = 0

for s in range(1, n-2):
    if s+A[s-1] > n:
        break
    for t in range(s+A[s-1]+1, n+1):
        if A[s-1] + A[t-1] == t-s:
            pn += 1

print(pn)
# Judge status: Accepted
N,M = map(int,input().rstrip().split(" "))
ans = [False for _ in range(N + 1)]
balls = [1 for _ in range(N + 1)]
ans[1] = True
for i in range(M):
  q = list(map(int,input().rstrip().split(" ")))
  if ans[q[0]] == True:
    ans[q[1]] = True
  balls[q[0]] -= 1
  if balls[q[0]] == 0: ans[q[0]] = False
  balls[q[1]] += 1
ansi = 0
for i in range(N + 1):
  if ans[i]: ansi += 1
print(ansi)
# Judge status: Accepted
n=int(input())
P=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
  if sorted([P[i-1],P[i],P[i+1]]).index(P[i]) == 1:
    ans += 1
print(ans)
# Judge status: Wrong Answer
# 次の日曜日が何日後か出力

answer = input ()

if answer == "SUN":
    print("7")
elif answer == "MON":
    print("6")
elif answer == "TUE":
    print("5")
elif answer == "WED":
    print("4")
elif answer == "THU":
    print("3")
elif answer == "FRI":
    print("2")
elif answer == "STU":
    print("1")
# Judge status: Accepted
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    _a, _b = input().split()

    a = _a * int(_b)
    b = _b * int(_a)
    print(a if a < b else b)


main()
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
cn=0
buf=s
for i in range(n):
  cn+=a[i]
  buf=min(buf,abs(s-2+cn))
print(buf)
# Judge status: Wrong Answer
S = input()
if S[0]==S[1]==S[2]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))#モンスター数
b=list(map(int,input().split()))#勇者キャパ
sm=0
c=0
for i in range(n):
  if c >=a[i]:
    sm+=a[i]
    c=b[i]
  elif b[i]+c>=a[i]:
    sm+=a[i]
    c=-a[i]+c+b[i]
  else:
    sm+=b[i]+c
    c=0
sm+=min(c,a[-1])
print(sm)
# Judge status: Accepted
n = int(input())
number = ""

while n != 0:
    n = n - 1
    number += (chr(n % 26 + 97))
    n = n // 26
number = number[::-1]
print(number)
# Judge status: Accepted
s=input()

w=['SUN','MON','TUE','WED','THU','FRI','SAT',]
w=w[::-1]

for i in range(7):
    if w[i]==s:
        print(i+1)
        break
# Judge status: Accepted
n, k = map(int,input().split())
a = list(map(int,input().split()))
l = [0]*n
i=0
cnt=0
while l[i]==0:
    l[i] = a[i]
    i = a[i]-1 
    cnt += 1
start = i+1
i = 0
pre = 0
while i+1!=start:
    i = a[i]-1
    pre += 1
loop = cnt-pre
if pre+loop<k:
    k=(k-pre)%loop+pre
i = 0
for _ in range(k):
    i = a[i]-1
print(i+1)
# Judge status: Wrong Answer
n = int(input())
t = 10**3 + 1
ans = 0
for i in range(1, t+1):
    if i > n:
        break
    if (i*i) <= (n-1):
        ans += 1
    for j in range(i+1, t+1):
        if (i*j) <= (n-1):
            ans += 2
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
from functools import reduce

x, y = map(int, input().split())

mod = 10**9 + 7


def cmb(n, r, m):
    def mul(a, b):
        return a * b % m

    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return (over * pow(under, m - 2, m))%m


r = abs(x - y)
l = (min(x, y) - r) // 3
r += l
if (x+y)%3 < 1 and l >= 0:
    print(cmb(r + l, l, mod))
else:
    print(0)
# Judge status: Accepted
A, B, K = list(map(int, input().split()))

nth = 0
max_divider = min(A, B)
for divider in range(max_divider, 0, -1):
    is_dividable_both = A % divider == 0 and B % divider == 0
    if is_dividable_both:
        nth += 1
    if nth == K:
        break

print(divider)
# Judge status: Wrong Answer
def main():

	
	a,b,c = map(int,input().split())

	print(c-a+b)


 
if __name__ == '__main__':
	main()
# Judge status: Wrong Answer
o = input()
e = input()

ans = ""
for i,j in zip(o, e):
    ans += (i+j)

print(ans if len(o) - len(e) == 0 else ans+e[-1])
# Judge status: Accepted
n=int(input())
ans = [0]*10050
for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v = i*i + j*j + k*k + i*j + i*k + j*k
            if v<10050:
                ans[v]+=1
for i in range(1,n+1):
    print(ans[i])
# Judge status: Wrong Answer
import collections
n = int(input())
a = [int(i) for i in input().split()]
dic = collections.defaultdict(int)

for i in range(n):
  dic[a[i]] += 1
ans = 0
ls = list(dic.keys())
ls.sort()
ans_ls = []

for i in range(len(ls)-1,-1,-1):
  if dic[ls[i]] >= 2:
    ans_ls.append(ls[i])
if len(ans_ls) < 2:
  print(0)
else:
  print(ans_ls[0] * ans_ls[1])
# Judge status: Wrong Answer
A = input()
N=len(str(A))
for i in range(N-2):
  if i ==0:
    B=A[i:i+3]
    V=int(B)
  else:
    B=int(A[i:i+3])
    if abs(753-B)<=abs(753-V):
      V=B
print(V)
# Judge status: Accepted
N=int(input())
A=[int(input()) for i in range(N)]
B=sorted(A)
A0=B[N-1]
A1=B[N-2]
for i in range(N):
  if A[i]!=A0:
    print(A0)
  else:
    print(A1)
# Judge status: Accepted
n = int(input())
li = list(map(int,input().split()))
match = 1
for i in li:
    if i == match:
        match += 1
if 1 in li:
    print(n-match + 1)
else:
    print(-1)
# Judge status: Accepted
from math import ceil
N, H = [int(i) for i in input().split()]
A = []
B = []
maxa = -1
for i in range(N):
    a, b = [int(i) for i in input().split()]
    maxa = max(maxa, a)
    A.append(a)
    B.append(b)

sb = []
for b in B:
    if b >= maxa:
        sb.append(b)

sb.sort(reverse=True)

c = 0
for i in sb:
    H -= i
    c += 1
    if H <= 0:
        print(c)
        quit()

print(c+ceil(H/maxa))
# Judge status: Accepted
A = sorted(list(map(int, input().split())))
K = int(input())

for i in range(K):
    A[-1] *= 2

print(sum(A))
# Judge status: Wrong Answer
N = int(input())
a = []
a = list(map(int,input().split()))
index = 0
count = 0
searchNum = 1
for j in range(N+1):
    if searchNum ==1:
        if not searchNum in a:
            searchNum = N +1
            break
    if not searchNum in a[index:N]:
        searchNum -= 1
        break
    else:
        index = a.index(searchNum)
        searchNum += 1
        continue

print(int(N -searchNum))
# Judge status: Accepted
h,w=map(int,input().split())

if w==1 or h==1:
  print(1)
elif h%2==0:
  print((h//2)*w)
else:
  if w%2==0:
    print(h*(w//2))
  else:
    print(h*(w//2)+(h//2)+1)
# Judge status: Accepted
import itertools as it

N,M,X=map(int,input().split())
book = [[int(_) for _ in input().split()] for i in range(N)]

combs = it.product([0, 1], repeat=N)
prices = []
for comb in combs:
	bag = [0] * (M+1)
	for i in range(N):
		if comb[i] == 0:
			continue
		else:
			for j in range(M+1):
				bag[j]+=book[i][j]
	if min(bag[1:]) < X:
		continue
	else:
		prices.append(bag[0])

if len(prices) == 0:
	print(-1)
else:
	print(min(prices))
# Judge status: Accepted
x, a, b = map(int, input().split())
if a >= b:
  print('delicious')
elif b - a <= x:
  print('safe')
else:
  print('dangerous')
# Judge status: Wrong Answer
a, b = map(int, input().split())
ans = 0
for i in range(a, b):
    l, rl = list(str(i)), list(reversed(str(i)))
    if l == rl:
        ans += 1

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

mbits = []

while abs(n) > 0:
    mbits.append(n % 2)
    n = n // 2 * (-1)

if len(mbits) == 0:
    mbits = [0]

ans = map(str, reversed(mbits))
ans = ''.join(ans)
print(ans)
# Judge status: Accepted
D = int(input())
c = [0]+list(map(int, input().split()))
s = [[0]]+[[0]+list(map(int, input().split())) for _ in range(D)]
ans = 0
last = [0]*(27)
for d in range(1,D+1):
    Ans = []
    for x in range(1,27):
        A = ans + s[d][x]
        l = last.copy()
        l[x] = d
        for i in range(1,27):
            A -= c[i] * (d-l[i])
        Ans.append(A)
    print(Ans.index(min(Ans))+1)
    last[Ans.index(min(Ans))+1] = d
# Judge status: Wrong Answer
N = int(input())

print(1000 - 1000 % N)
# Judge status: Wrong Answer
import math
N=int(input())
X=[0]*N
Y=[0]*N
S=0
T=math.factorial(N)
for i in range(N):
    X[i],Y[i]=map(int,input().split())

for j in range(N-1):
    for k in range(j+1,N):
        print(math.sqrt((X[j]-X[k])**2+(Y[j]-Y[k])**2))
        S+=math.sqrt((X[j]-X[k])**2+(Y[j]-Y[k])**2)
print(S*2/N)
# Judge status: Wrong Answer
n,k = map(int,input().split())

B = input()
happy = 0
for i in range(n):
  if B[i]=="L" and i != 0 :
    if B[i-1] == "L":
      happy +=1
  if B[i]=="R" and i != n-1 :
    if B[i-1] == "R":
      happy +=1
print(min(happy+2*k, n-1))
# Judge status: Wrong Answer
n=int(input())
v=sorted(map(int,input().split()))
ans=0
for i in range(n-1):
    ans += (v[i]+v[i+1])/2
print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
k1 = b-a
k2 = c-b

if k1==k2:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
X, Y = map(int, input().split())

ans = 0

while X <= Y:
    Y /= 2
    ans += 1
print(ans)
# Judge status: Accepted
x,a,b = map(int,input().split())
if b <= a:
    print('delicious')
elif b - a <= x:
    print('safe')
else:
    print('dangerous')
# Judge status: Accepted
import bisect
N = int(input())
L = list(map(int, input().split()))
L.sort()
res = 0
for i in range(N): #aを決定
    for j in range(i+1, N): #bを決定
        c = L[i] + L[j] #cの最大値を決定
        pos = bisect.bisect_left(L, c)
        res += max(0, pos-j-1)
print(res)
# Judge status: Wrong Answer
n = int(input())
if(n < 10):
  print(n)
elif(n < 100):
  print(9)
elif(n < 1000):
  print(9 + n - 99)
elif(n < 10000):
  print(908)
elif(n < 100000):
  print(908 + n- 9999)
else:
  print(90909)
# Judge status: Accepted
# D - Floor Function
def main():
    A, B, N = map(int, input().split())
    f = lambda x: (A * x) // B - A * (x // B)
    print(f(min(B - 1, N)))


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)

if A[0] >= 1:
  print(-1)
  exit()

ret = 1
children = 1 - A[0]
bottom -= A[0]
 
for i in range(N):
    children = children * 2 - A[i+1]
    if children <= -1:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
print(ret)
# Judge status: Accepted
k = int(input())
s = str(input())

if len(s) <= k:
    print(s)
else:
    print(s[0:k] + '...')
# Judge status: Accepted
N,A,B,C,D=map(int,input().split())
S=input()
if '##' in S[A-1:C] or '##' in S[B-1:D]:
    print('No')
    exit()

if C<D:
    print('Yes')
else:
    cnt=0
    for i in range(B-1,D):
        if S[i-1]==S[i] and S[i]==S[i+1] and S[i]=='.':
            print('Yes')
            exit()
    print('No')
# Judge status: Wrong Answer
A,B,X = map(int,input().split())
print("YES" if A+B == X or A == X else "NO")
# Judge status: Accepted
sa = [i for i in input()]
sb = [i for i in input()]
sc = [i for i in input()]
d = {"a":sa, "b":sb, "c":sc}
turn = "a"
while(True):
    if len(d[turn]) == 0:
        break
    turn = d[turn].pop(0)
print(turn.upper())
# Judge status: Accepted
import math
a, b = map(int, input().split())

print(math.ceil((a+b)/2))
# Judge status: Accepted
N = int(input())
if N == 1:
    print(0)
elif N == 2:
    print(2)
else:
    a = 10 ** N % (10 **9 + 7)
    m = (9 ** N)  * 2 % (10 **9 + 7) - (8 ** N)  % (10 **9 + 7)
    ans = (a - m ) % (10 **9 + 7)
    print(ans)
# Judge status: Accepted
N, K, S = map(int, input().split())
ans = list()
for _ in range(K):
  ans.append(S)

for _ in range(N - K):
  ans.append(S + 1 if S != 10 ** 9 else S - 1)
  
print(' '.join(map(str, ans)))
# Judge status: Wrong Answer
import copy

n, k = map( int, input().split() )
a = list( map( float, input().split() ) )

devide = [ 0 for _ in range( n ) ]
dev_len = copy.deepcopy( a )

for _ in range( k ):
    max_i = dev_len.index( max( dev_len ) )
    devide[ max_i ] += 1
    dev_len[ max_i ] = a[ max_i ] / ( devide[ max_i ] + 1 )

print( int( max( dev_len ) + 0.5 ) )
# Judge status: Wrong Answer
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
if n == 1:
    print(1)
elif n == 2:
    if abs(a[0] - a[1]) <= 2:
        print(2)
    else:
        print(1)
else:
    d = {}
    for i in range(max(a) + 3):
        d[i] = 0
    for i in a:
        d[i] += 1
    ans = 1
    pre = 0
    for i in range(max(a)):
        pre = d[i] + d[i + 1] + d[i + 2]
        if ans < pre:
            ans = pre
    print(ans)
# Judge status: Wrong Answer
S, T = input().split()
A, B = input().split()
U = input().split()
S = str(S)
T = str(T)
A = int(A)
B = int(B)
U = str(U)


if U == S:
    print(A-1,B)
else:
    print(A,B-1)
# 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
bef = -1
for i in A:
    ans += B[i-1]
    if i == bef+1:
        ans += C[i-2]
    bef = i

print(ans)
# Judge status: Wrong Answer
k, x = map(int, input().split())
L = []
for i in range(k):
    y = x + i
    z = x - i
    if y > 1000000:
        y = x
    L.append(y)
    if z < -1000000:
        z = x
    L.append(z)
print(set(L))
# Judge status: Accepted
import sys
X = int(input())
for i in range(-118,120):
  for j in range(-119,119):
    if i**5 - j**5 == X:
      print(i,j)
      sys.exit()
# Judge status: Accepted
N, K, S = map(int, input().split())
U = str(S + 1) if S != 10 ** 9 else "1"
S = str(S)
ans = [S if i <= K - 1 else U for i in range(N)]
print(" ".join(ans))
# Judge status: Wrong Answer
N=int(input())
S=input()
ans=0
for i in range(N):
    X=list(S[i:])
    Y=list(S[:i+1])
    ans=max(ans,len(set(X)&set(Y)))
    
print(ans)
# Judge status: Wrong Answer
s = input()
if s[0]=="A" and "C" in s[2:-2] and str(s[0]).isupper()== True and  str(s[1]).islower()==True and str(s[-2:]).islower() == True:
    a=s.index('C')
    if (s[2:a]+s[a+1:-2]).islower()== True:
        print('AC')
    else:
        print('AC')
else:
    print('WA')
# Judge status: Accepted
a,b,t=map(int,input().split())
ans=0
temp=a
while temp<t+0.5:
  ans=ans+b
  temp=temp+a
print(ans)