Harryxun/stf_run huggingface dataset:
mod=10**9+7
n,k=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr,reverse=True,key=lambda x:abs(x)) #絶対値の順にソートする
if k==n: #k=nのときはすべてを掛け合わせるほかない
 ans=1
 for i in range(n):
   ans*=arr[i]
   ans%=mod
 print(ans)
else:
 if k%2==1 and max(arr)<0: #答えが負になる場合は絶対値の小さい順にK個掛け合わせる
   ans=1
   for i in range(k):
     ans*=arr[n-1-i]
     ans%=mod
   print(ans)
 else:
   ans=1
   cnt=0
   for i in range(k): #絶対値の大きい順にK個掛け合わせる
     if arr[i]<0: #負数を掛けた回数を数えておく
       cnt+=1
     ans*=arr[i]
     ans%=mod
   if cnt%2==0: #負数を偶数回掛けていれば答えは非負なのでそのまま出力
     print(ans)
   else: #そうでなければ調整を行う
     min_plus=-1
     min_minus=1
     for i in range(k): #絶対値の大きい順にK個を見て最小の非負の数・負の数を探す
       if arr[i]>=0:
         min_plus=arr[i]
       else:
         min_minus=arr[i]
     max_plus=-1
     max_minus=1
     for i in range(k,n): #残るN-K個を見て最大の非負の数・負の数を探す
       if arr[i]>=0 and max_plus==-1:
         max_plus=arr[i]
       if arr[i]<0 and max_minus==1:
         max_minus=arr[i]
     if min_plus==-1: #もし最小の非負の数がなければ、最小の負の数を取り除くしかない
       arr.remove(min_minus)
       ans=1
       for i in range(k-1):
         ans*=arr[i]
         ans%=mod
       ans*=max_plus
       ans%=mod
     elif min_minus==1: #もし最小の負の数がなければ、最小の非負の数を取り除くしかない
       arr.remove(min_plus)
       ans=1
       for i in range(k-1):
         ans*=arr[i]
         ans%=mod
       ans*=max_minus
       ans%=mod
     elif min_plus*max_plus>=min_minus*max_minus: #そうでなければより倍率の大きいほうを選ぶ
       arr.remove(min_minus)
       ans=1
       for i in range(k-1):
         ans*=arr[i]
         ans%=mod
       ans*=max_plus
       ans%=mod
     else:
       arr.remove(min_plus)
       ans=1
       for i in range(k-1):
         ans*=arr[i]
         ans%=mod
       ans*=max_minus
       ans%=mod
     print(ans)

### FIXED CODE ###

n=int(input())
ans=0
for i in range(1,n+1): #頂点数の総和を求める
 ans+=i*(n-i+1)
for _ in range(n-1): #各辺についてu*(n-v+1)を頂点数の総和から引く
 u,v=map(int,input().split())
 if u>v: #上記ではu<vを仮定しているのでu>vのときuとvを入れ替える
   u,v=v,u
 ans-=u*(n-v+1)
print(ans)
n = ni()

ans = 0
for i in range(1,n+1):
    ans += (i*(n//i)*(n//i + 1))//2
print(ans)

### FIXED CODE ###

import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()

ans = 0
for k in range(1,n+1):
    ans += (k*(n//k)*(n//k + 1))//2
print(ans)
x,n=map(int,input().split())
if(n!=0):
    a=list(map(int,input().split()))
else:
    a=[]
if not x in a:
    print(x)
else:
    a.sort()
    i=a.index(x)-1
    j=i+2
    d=1
    ans=0
    while(True):
        if(a[i]!=x-d):
            ans=a[i]
            break
        else:
            i-=1
        if(a[j]!=x+d):
            ans=a[j]
            break
        else:
            j+=1
        d+=1
    print(ans)


### FIXED CODE ###

x,n=map(int,input().split())
if(n!=0):
    a=list(map(int,input().split()))
else:
    a=[]

if x not in a:
    print(x)
else:
    a.sort()
    idx=a.index(x)
    i=max(idx-1,0)
    j=min(idx+1,n-1)
    d=1
    ans=0
    while(True):
        if(a[i]!=x-d):
            ans=x-d
            break
        else:
            i=max(i-1,0)
        if(a[j]!=x+d):
            ans=x+d
            break
        else:
            j=min(j+1,n-1)
        d+=1
    print(ans)
While True:
    m,f,r=map(int,input().split())
    if m==f==r==-1:break
    a=m+f
    if a >= 80:print('A')
    elif a >= 65:print('B')
    elif a >= 50:print('C')
    elif a >= 30:
        if r >= 50:print('C')
        else:print('D')
    else:print('F')

### FIXED CODE ###

while True:
    m,f,r=map(int,input().split())
    if m==f==r==-1:break
    a=m+f
    if m==-1 or f==-1:print('F')
    elif a >= 80:print('A')
    elif a >= 65:print('B')
    elif a >= 50:print('C')
    elif a >= 30:
        if r >= 50:print('C')
        else:print('D')
    else:print('F')
def o(a,b):
  if a>2*b:
    return a-2*b
  return 0
 
a=int(imput())
b=int(imput())
print(o(a,b))


### FIXED CODE ###

a,b=map(int, input().split())
if a>2*b:
  print(a-2*b)
else:
  print(0)
ans=[0]*n

for j in range(1,n+1):
    dict=[-1]*(n+1)
    que=deque()
    que.append(j)
    dict[j]=0
    while que:
        t=que.popleft()
        for k in map[t]:
            if dict[k]==-1:
                dict[k]=dict[t]+1
                que.append(k)
    for l in range(1,n+1):
        ans[dict[l]]+=1
for m in range(1,n):
    print(ans[m]//2)


### FIXED CODE ###

from collections import deque

n,x,y=map(int,input().split())
map=[[] for _ in range(n+1)]
for i in range(1,n):
    map[i].append(i+1)
    map[i+1].append(i)
map[x].append(y)
map[y].append(x)

ans=[0]*n

for j in range(1,n+1):
    dict=[-1]*(n+1)
    que=deque()
    que.append(j)
    dict[j]=0
    while que:
        t=que.popleft()
        for k in map[t]:
            if dict[k]==-1:
                dict[k]=dict[t]+1
                que.append(k)
    for l in range(1,n+1):
        ans[dict[l]]+=1
for m in range(1,n):
    print(ans[m]//2)
import numpy as np

N = int(input())
A = np.zeros(N)

for i in range(N):
    A[i] = int(input())

ind = A.argsort()[:2:-1]

first_a = A[ind[0]]
second_a = A[ind[1]]

for i, a in enumerate(A):
    if i == ind[0]:
        print(second_a)
    else:
        print(first_a)



### FIXED CODE ###

import numpy as np

N = int(input())
A = np.zeros(N)

for i in range(N):
    A[i] = int(input())

ind = A.argsort()[::-1][:2]

first_a = A[ind[0]]
second_a = A[ind[1]]

for i, a in enumerate(A):
    if i == ind[0]:
        print(int(second_a))
    else:
        print(int(first_a))
import sys
import math
N = int(input())
W = list(map(int,input().split()))

dif = math.inf

for i in range(1,N):
    tmp = abs(sum(W[:i]) - sum(W[i:]))
    print(i,tmp)
    if dif > tmp:
        dif = tmp
print(dif)


### FIXED CODE ###

import sys

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

dif = 9999999999

for i in range(1,N):
    tmp = abs(sum(W[:i]) - sum(W[i:]))
    if dif > tmp:
        dif = tmp
print(dif)
from itertools import product
s=input()
for b in list(product(["+","-"],repeat=3)):
    ans=s[0]+b[0]+s[1]+b[1]+s[2]+b[2]+s[3]
    if evel(ans)==7:
        print(ans+"7")
        break


### FIXED CODE ###

from itertools import product
s=input()
for b in list(product(["+","-"],repeat=3)):
    ans=s[0]+b[0]+s[1]+b[1]+s[2]+b[2]+s[3]
    if eval(ans)==7:
        print(ans+"=7")
        break
K,S = map(int,input().split())
import math
if K>=S:
  print(math.factorial(S+1))
else:
  count=0
  for i in range(0,K+1):
    for j in range(0,K+1):
      for h in range(0,K+1):
        if i+j+h==S:
          count+=1
print(count)

### FIXED CODE ###

k,s=map(int,input().split())
print(len([1 for z in range(k+1) for y in range(k+1) if 0<=s-y-z<=k]))
# -*- coding: utf-8 -*-
import re

qS = input()


def replace(s, count):
    matches = re.finditer('ABC', s)
    max_count = count
    for m in matches:
        m.span()
        max_count = max(max_count, replace(
            s[:m.span()[0]] + 'BCA' + s[m.span()[1]:], count + 1))
    return max_count


print(replace(qS, 0))


### FIXED CODE ###

# -*- coding: utf-8 -*-
s = input()

a_num = 0
bc_num = 0
ans = 0
i = 0
while i < len(s):
    if s[i] == 'A':
        a_num += 1
        i += 1
    elif s[i:i+2] == 'BC':
        ans += a_num
        i += 2
    else:
        a_num = 0
        b_num = 0
        i += 1

print(ans)
import itertools
A, B, C, D = list(input())

op = ['+','-']

for a,b,c in itertools.product(op,op,op):
  x = A + op1 + B + op2 + C + op3 + D
  if(eval(x) == 7):
    print(x + "=7")
    break

### FIXED CODE ###

import itertools
A, B, C, D = list(input())

op = ['+','-']

for op1,op2,op3 in itertools.product(op,op,op):
  x = A + op1 + B + op2 + C + op3 + D
  if(eval(x) == 7):
    print(x + "=7")
    break
import itertools
import numpy as np

def mod(n):
    return n % 2019


L, R = map(int, input().split())

a = list(range(L,R+1))
p = list(itertools.combinations(a, 2))
a1, a2 = map(list, zip(*p))
ans = np.array(a1)*np.array(a2)
ans = map(mod,ans)
print(min(ans))


### FIXED CODE ###

L, R = map(int, input().split())
if R-L>=2019:
    print(0)
else:
    print(min([((i*j)%2019) for i in range(L,R) for j in range(i+1,R+1)]))
counter = 0
for i  in range(0, len(candies)-1):
    counter += candies[i+1] + candies[i] - x
    candies[i+1] = x - candies[i]
print counter

### FIXED CODE ###

N, x = map(int, raw_input().split())
candies = map(int, raw_input().split())
counter = 0
for i  in range(0, len(candies)-1):
    delta = candies[i+1] + candies[i] - x
    if delta > 0:
        counter += delta
        candies[i+1] = x - candies[i]
        if candies[i+1] < 0:
            candies[i+1] = 0
print counter
a,b=input(a,b)


### FIXED CODE ###

s = raw_input().split()
a = int(s[0])
b = int(s[1])
print("{0} {1}".format(a*b, 2*(a+b)))
n = int(input())
print(len(set([input() for i in range(n)]))

### FIXED CODE ###

n = int(input())
d = {}
for i in range(n):
    s = input()
    try:d[s]+=1
    except:d[s]=1
print(len(d))
H, W, M = map(int, input().split())

B = [[0] * W for _ in range(H)]

for _ in range(M):
  i, j = map(int, input().split())
  B[i-1][j-1] = 1

ans = 0
  
for i in range(H):
  for j in range(W):

    tmp = sum(B[i])
    tmp -= B[i][j]
    for h in range(H):
      tmp += B[h][j]
      
    ans = max(ans, tmp)

print(ans)

### FIXED CODE ###

h,w,m=map(int,input().split())
item=[list(map(int,input().split())) for i in range(m)]
row=[0]*h
col=[0]*w
for i in range(m):
    x,y=item[i]
    row[x-1]+=1
    col[y-1]+=1
mr,mc=max(row),max(col)
xr=set([i for i in range(h) if row[i]==mr])
xc=set([i for i in range(w) if col[i]==mc])
check=len(xr)*len(xc)
for i in range(m):
    r,c=item[i]
    if r-1 in xr and c-1 in xc:
        check-=1
print(mr+mc if check>0 else mr+mc-1)
a, op, b = input().split()

if op == "+":
    print(a + b)
else:
    print(a - b)

### FIXED CODE ###

a, op, b = input().split()

if op == "+":
    print(int(a) + int(b))
if op == "-":
    print(int(a) - int(b))
#!/usr/bin/env python3

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

    n = I()
    V = []
    W = []
    m = min(n, 1 << 10)
    maxL = 10**5
    dp = [[0]*(maxL + 1) for _ in range(m + 1)]
    
    for i in range(1, m+1):
        v, w = LI()
        for j in range(maxL+1):
            if j < w:
                dp[i][j] = dp[i>>1][j]
            else:
                dp[i][j] = max(dp[i>>1][j], dp[i>>1][j - w] + v)
        V.append(v)
        W.append(w)
    
    q = I()
    for i in range(q):
        v, L = LI()
        if v <= m:
            print(dp[v][L])
            continue
        cnt = 0
        tmp = v
        v_ = []
        w_ = []
        while tmp > m:
            v_.append(V[tmp-1])
            w_.append(W[tmp-1])
            tmp >>= 1
            cnt += 1
        ret = dp[tmp-1][L]
        v_tmp = [0] * (1 << cnt)
        w_tmp = [0] * (1 << cnt)
        for b in range(1, 1 << cnt):
            lsb = b & -b
            l = lsb.bit_length()
            w_tmp[b] = w_tmp[b - lsb] + w_[l-1]
            if w_tmp[b] <= L:
                v_tmp[b] = v_tmp[b - lsb] + v_[l-1]
                ret = max(ret, v_tmp[b] + dp[tmp-1][L - w_tmp[b]])
        print(ret)
    return

if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3

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

    n = I()
    V = []
    W = []

    maxL = 10**5
    m = min(n, 1 << 10)
    dp = [[0]*(maxL + 1)]
    
    for i in range(n):
        v, w = LI()
        if i <= m:
            d_ = dp[(i+1)>>1][:]
            for j in range(w, maxL+1)[::-1]:
                d_[j] = max(d_[j], d_[j - w] + v)
            dp.append(d_)
        V.append(v)
        W.append(w)
    
    q = I()
    for i in range(q):
        v, L = LI()
        if v <= m:
            print(dp[v][L])
            continue
        cnt = 0
        v_ = []
        w_ = []
        while v > m:
            v_.append(V[v-1])
            w_.append(W[v-1])
            v >>= 1
            cnt += 1
        ret = dp[v][L]
        v_tmp = [0] * (1 << cnt)
        w_tmp = [0] * (1 << cnt)
        for b in range(1, 1 << cnt):
            lsb = b & -b
            l = lsb.bit_length()
            w_t = w_tmp[b - lsb] + w_[l-1]
            w_tmp[b] = w_t
            if w_t <= L:
                v_t = v_tmp[b - lsb] + v_[l-1]
                v_tmp[b] = v_t
                ret = max(ret, v_t + dp[v][L - w_t])
        print(ret)
    return

if __name__ == "__main__":
    main()
import sys
from collections import Counter
from operator import itemgetter, attrgetter
n=0
 
n = input()
d_list= list(map(int, input().split()))
cou=sorted(Counter(d_list).most_common())
total=len(d_list)
index=0
before=0
after=0
first=True
t=0
for c in cou:
    if first:
        before = c
        first=False
    before = after
    after = c
    t+=c[1]
    if t > total/2:
        break
    index+=1
if not(len(cou[index:]) == total/2):
    print(0)
else:
    print(after[0]-before[0])

### FIXED CODE ###

import sys
from collections import Counter
from operator import itemgetter, attrgetter
n=0
 
n = input()
d_list= list(map(int, input().split()))
cou=sorted(Counter(d_list).most_common())
total=len(d_list)
# print(n)
# print(cou)
# print(total)
index=0
before=0
after=0
first=True
t=0
for c in cou:
#     print(c)
    if first:
        before = c
        first=False
    else:
        before = cou[index-1]
    after = c
    t+=c[1]
    if t > total/2:
        break
    index+=1
# print(before)
# print(after)
# print(len(cou[index:]))
if not(sum(n for _, n in cou[index:]) == sum(n for _, n in cou[:index])):
    print(0)
else:
    print(after[0]-before[0])
a,b,k = map(int, input().split())
l = list(range(a,b+1))
for i in sorted(set(l[:k]+l[-k:])):
    print(i)

### FIXED CODE ###

a,b,k = map(int, input().split())
if b-a+1>k*2:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)
else:
    for i in range(a,b+1):
        print(i)
a,b,c = input().split()
if b =='+':
  print(int(a)+int(b))
else:
  print(int(a)-int(b))

### FIXED CODE ###

a,b,c = input().split()
if b =='+':
  print(int(a)+int(c))
else:
  print(int(a)-int(c))
N, K = map(int,input().split())
AB = sorted([[list(map(int,input().split())) for _ in range(N)]])
cnt = 0
for a, b in AB:
  if(cnt < K - b)
    cnt += b
  else:
    print(a)
    break


### FIXED CODE ###

N, K = map(int,input().split())
A = sorted([list(map(int,input().split())) for _ in range(N)])

cnt = 0
for a in A:
  if(cnt < K-a[1]):
    cnt += a[1]
  else:
    print(a[0])
    break
"""
unk buriburi
"""
#D
s = input()
count = 0
# print(len(s))
for left in range(len(s) - 1):
    for right in range(left + 1, len(s)):
        # print(left + 1, right + 1)
        if int(float(s[left:right+1])) % 2019 == 0:
            # print(s[left:right])
            count += 1
print(count)

### FIXED CODE ###

s = input()
ans = 0
a = [0] * 2019
a[0] = 1
k = 0
mod = 1
for i in range(len(s) - 1, -1, -1):
    k = (k + int(s[i]) * mod) % 2019
    mod = (mod * 10) % 2019
    a[k] += 1
for i in a:
    ans += i * (i - 1) * 0.5
print(int(ans))
[w,h,x,y]=[int(i) for i in input().split()]


if x*2==w and y*2==h:
    ans=int(1)
else ans=int(0)

print(double(w*h/2)+" "+ans)


### FIXED CODE ###

[w,h,x,y]=[int(i) for i in input().split()]

a=int(0)

if x*2==w and y*2==h:
    a=int(1)
else:
    a=int(0)

print(str(w*h/2)+" "+str(a))
A, B, H, M = map(float, input().split())

import math
PI = math.pi
radA = (2.0 * PI * (H + M / 60.0)) / 12.0
radB = (2.0 * PI * M) / 60.0
print(math.hypot(A * math.cos(radA) - B * math.cos(radB),
                 A * math.sin(radA) - B * math.sin(radB)))

### FIXED CODE ###

N = input()

last = list(N)[-1]
if int(last) in (2,4,5,7,9):
    print('hon')
elif int(last) in (0,1,6,8):
    print('pon')
else:
    print('bon')
from itertools import combinations

n, k = map(int, input().split())
star = []
max_k = (n - 1) * (n - 2) // 2
delta = max_k - k
cnt = 0
if k <= max_k:
    ans = []
    for i in range(2, n + 1):
        star.append((1, i))
        cnt += 1

    if delta > 0:
        kumiawase = list(combinations(range(2, n), 2))
        for j in range(delta):
            kumi = kumiawase[j]
            star.append(kumi)
            cnt += 1
    print(cnt)
    for pair in star:
        print(*pair, sep=" ")
else:
    print(-1)


### FIXED CODE ###

from itertools import combinations

n, k = map(int, input().split())
star = []
max_k = (n - 1) * (n - 2) // 2
delta = max_k - k
cnt = 0
if k <= max_k:
    ans = []
    for i in range(2, n + 1):
        star.append((1, i))
        cnt += 1

    if delta > 0:
        kumiawase = list(combinations(range(2, n+1), 2))
        for j in range(delta):
            kumi = kumiawase[j]
            star.append(kumi)
            cnt += 1
    print(cnt)
    for pair in star:
        print(*pair, sep=" ")
else:
    print(-1)
if __name__ == '__main__':
    n, m, k = map(int, input().strip().split())
    a = list(map(int, input().strip().split()))
    b = list(map(int, input().strip().split()))

    min = 0
    a_count = 0
    for i, a_min in enumerate(a):
        if a_min + min <= k:
            min += a_min
            a_count += 1
        else:
            break
    b_count = 0

    for i, b_min in enumerate(b):
        if b_min + min <= k:
            min += b_min
            b_count += 1
        else:
            break

    max_count = a_count + b_count
    if not max_count == n+m:
        for i in range(a_count, 0, -1):
            min -= a[i - 1]
            a_count -= 1
            while min + b[b_count] < k:
                min += b[b_count]
                b_count += 1
            if a_count + b_count > max_count:
                max_count = a_count + b_count
    print(max_count)


### FIXED CODE ###

if __name__ == '__main__':
    n, m, k = map(int, input().strip().split())
    a = list(map(int, input().strip().split()))
    b = list(map(int, input().strip().split()))

    min = 0
    a_count = 0
    for i, a_min in enumerate(a):
        if a_min + min <= k:
            min += a_min
            a_count += 1
        else:
            break
    b_count = 0

    for i, b_min in enumerate(b):
        if b_min + min <= k:
            min += b_min
            b_count += 1
        else:
            break

    max_count = a_count + b_count
    if not max_count == n + m and not b_count == m:
        for i in a[:a_count][::-1]:
            min -= i
            a_count -= 1
            while b_count < len(b) and min + b[b_count] <= k:
                min += b[b_count]
                b_count += 1
            if a_count + b_count > max_count:
                max_count = a_count + b_count
            if b_count >= len(b):
                break
    print(max_count)
a,b = map(int,input().split())
if a = b:
  print(a*2)
else:
  print(max([a,b])*2-1)

### FIXED CODE ###

a,b = map(int,input().split())
if a==b:
  print(a*2)
else:
  print(max([a,b])*2-1)
import math
a = 0
input_str = input()
input_str_list = []
for x in input_str:
    try:
       input_str_list.append(int(x))
    except:
       pass
if len(input_str_list) == 4:
  pass
else:
  print("NO")
  exit()

if math.modf(float(input_str))[0] == 0.0:
  pass
else:
  print("NO")
  exit()
  

for i in range(len(input_str)):
  if input_str[i] == '1':
    a+=1
  elif input_str[i] == '9':
    a+=1
  elif input_str[i] == '7':
    a+=1
  elif input_str[i] == '4':
    a+=1
if a==4:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

import math
a = 0
b = 0
c = 0
d = 0
input_str = input().split()
input_str_list = []

## 少数を省く
for x in input_str:
    try:
       input_str_list.append(int(x))
    except:
      print("NO")
      exit()

for i in range(len(input_str_list)):
  if input_str_list[i] == 1:
    a+=1
  elif input_str_list[i] == 9:
    b+=1
  elif input_str_list[i] == 7:
    c+=1
  elif input_str_list[i] == 4:
    d+=1
if a==1 and b==1 and c==1 and d==1:
  print("YES")
else:
  print("NO")
import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,A,B,C,D = I()
maze = list(s())
if maze[0] == maze[1] == '#':
    print('No')
    exit()
Flag = 0
supt = 0
hupt = 0
for i in range(N-2):
    if maze[i+1] == maze[i+2] == '#':
        print('No')
        exit()
    if maze[i] == maze[i+1] == maze[i+2] == '.':
        Flag = 1
        hupt = i+1
        break
if C > D:
    if Flag == 0:
        print('No')
        exit()
    if B-1 <= hupt <= C-1
        print('Yes')
    else:
        print('No')
else:
    print('Yes')


### FIXED CODE ###

import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,A,B,C,D = I()
maze = s()
Flag = 0
for i in range(A,max(C,D)):
    if maze[i-1:i+1] == '##':
        print('No')
        exit()
if C < D:
    print('Yes')
    exit()
for i in range(B-1,D):
    if maze[i-1:i+2] == '...':
        print('Yes')
        exit()
print('No')
# ???±????????????¢??´?¢(Depth First Search)
??
def DFS(i = 0, n = 1):
????????for j in range(n):
????????????????if A[i][j] == 1 and d[j] == 0:
????????????????????????time = time + 1
????????????????????????d[j] = time
????????????????????????DFS(j)
????????time = time + 1
????????f[i] = time
??
n = int(raw_input())
A = [0] * n
for i in range(n):
????????A[i] = [0] * n
??
for i in range(n):
????????value = map(int, raw_input().split())
????????u = value[0] - 1
????????k = value[1]
????????nodes = value[2:]
????????for i in range(k):
????????????????v = nodes[i] - 1
????????????????A[u][v] = 1
??
d = [0] * n
f = [0] * n
time = 1
d[0] = time
DFS(0, n)
??
for i in range(n):
????????print(str(i + 1) + " " + str(d[0]) + " " + str(f[0]))

### FIXED CODE ###


def DFS(n = 1, i = 0, time = 1):
    for j in range(n):
        if A[i][j] == 1 and d[j] == 0:
            time = time + 1
            d[j] = time
            time = DFS(n, j, time)
    time = time + 1
    f[i] = time
    return time

n = int(raw_input())
A = [0] * n
for i in range(n):
    A[i] = [0] * n

for i in range(n):
    value = map(int, raw_input().split())
    u = value[0] - 1
    k = value[1]
    nodes = value[2:]
    for j in range(k):
        v = nodes[j] - 1
        A[u][v] = 1

d = [0] * n
f = [0] * n

time = 0
for i in range(n):
    if d[i] == 0:
        time = time + 1
        d[i] = time
        time = DFS(n, i, time)

for i in range(n):
    print(str(i + 1) + " " + str(d[i]) + " " + str(f[i]))
n=int(input())
l = [int(x) for x in list(str(n))]
print(l.replace("1","9").replace("9","1"))


### FIXED CODE ###

print(input().replace("1","*").replace("9","1").replace("*","9"))