Harryxun/stf_run huggingface dataset:
N,A,B,C,D=map(int,input().split())
S=list(input())

if A<B<C<D:
    a=True
    for i in range(A-1,D-2):
        if S[i]==S[i+1]=="#":
            print("No")
            a=False
            break
    if a==True:
        print("Yes")
elif A<C<B<D:
    a=True
    for i in range(A-1,C-2):
        if S[i]==S[i+1]=="#":
            print("No")
            a=False
            break
    if a==True:
        for i in range(B-1,D-2):
            if S[i]==S[i+1]=="#":
                print("No")
                a=False
                break
    if a==True:
        print("Yes")
elif A<B<D<C:
    a=True
    for i in range(A-1,C-2):
        if S[i]==S[i+1]=="#":
            print("No")
            a=False
            break
    if a==True:
        b=True
        for i in range(B-2,D-2+1):
            if S[i]==S[i+1]==S[i+2]:
                b=False
                break
    if b==False:
        print("Yes")
    elif b==True:
        print("No")
        

### FIXED CODE ###

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

if A<B<C<D:
    a=True
    for i in range(A-1,D-2):
        if S[i]==S[i+1]=="#":
            print("No")
            a=False
            break
    if a==True:
        print("Yes")
elif A<C<B<D:
    a=True
    for i in range(A-1,C-2):
        if S[i]==S[i+1]=="#":
            print("No")
            a=False
            break
    if a==True:
        for i in range(B-1,D-2):
            if S[i]==S[i+1]=="#":
                print("No")
                a=False
                break
    if a==True:
        print("Yes")
elif A<B<D<C:
    a=True
    for i in range(A-1,C-2):
        if S[i]==S[i+1]=="#":
            b=True
            a=False
            break
    if a==True:
        b=True
        for i in range(B-2,D-2+1):
            if S[i]==S[i+1]==S[i+2]:
                b=False
                break
    if b==False:
        print("Yes")
    elif b==True:
        print("No")
a,b=input().split()
if (a * b ) % 2 == 0:
  print "Even"
else:
  print "Odd"

### FIXED CODE ###

import sys
a,b=input().split()
a = int(a)
b = int(b)
if (a * b) % 2 == 0:
  print("Even")
else:
  print("Odd")
a,b,c = map(int,input().split())
if a<=x and x<=a+b:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a,b,x = map(int,input().split())
print("YES" if a<=x<=a+b else "NO")
n = int(input())
q = int(input())
s = input()
s = list(s)
cnt = []
l = []
r = []
for i in range(q):
  l.append(int(input()))
  r.append(int(input()))
  cnt.append(0)
for i in range(q):
  for j in range(l[i], r[i]):
    if j == len(s)-1:
      break
    if s[j-1] == 'A' and s[j] == 'C':
      cnt[i] += 1
for i in range(len(cnt)):
  print(cnt[i])

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
input=()
print(N*N*N)

### FIXED CODE ###

N =input()
print(int(N)**3)
#D問題
NM=40
ABM=10
MM=400

N,M1,M2=map(int,input().split())
A=[]
B=[]
C=[]
for i in range(N):
    a,b,c=map(int,input().split())
    A.append(a)
    B.append(b)
    C.append(c)
cmax=max(C)
CM=N*cmax
dp=[[[CM for broop in range(401)] for aroop in range(401)] for nroop in range(NM)]
dp[0][0][0]=0
for i in range(N):
    for cb in range(401):
        for ca in range(401):
            if dp[i][ca][cb]==CM:
                continue
            dp[i+1][ca][cb]=min(dp[i+1][ca][cb],dp[i][ca][cb])
            if ca+A[i]<400 and cb+B[i]<400: 
                dp[i+1][ca+A[i]][cb+B[i]]=min(dp[i+1][ca+A[i]][cb+B[i]],dp[i][ca][cb]+C[i])

ans=CM
for cb in range(400):
    CB=cb+1
    for ca in range(400):
        CA=ca+1
        if ca*M2 == cb*M1:
            ans=min(ans,dp[N][CA][CB])

if ans == N*cmax:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

#D問題
NM=40
ABM=10
MM=400

N,M1,M2=map(int,input().split())
A=[]
B=[]
C=[]
for i in range(N):
    a,b,c=map(int,input().split())
    A.append(a)
    B.append(b)
    C.append(c)
cmax=max(C)
CM=N*cmax+10
dp=[[[CM for broop in range(401)] for aroop in range(401)] for nroop in range(N+1)]
dp[0][0][0]=0
for i in range(N):
    for cb in range(401):
        for ca in range(401):
            if dp[i][ca][cb]==CM:
                continue
            dp[i+1][ca][cb]=min(dp[i+1][ca][cb],dp[i][ca][cb])
            if ca+A[i]<401 and cb+B[i]<401:
                dp[i+1][ca+A[i]][cb+B[i]]=min(dp[i+1][ca+A[i]][cb+B[i]],dp[i][ca][cb]+C[i])

ans=CM
for cb in range(400):
    for ca in range(400):
        CB=cb+1
        CA=ca+1
        if CA*M2 == CB*M1:
            ans=min(ans,dp[N][CA][CB])

if ans == CM:
    print(-1)
else:
    print(ans)
# -*- coding: utf-8

while True:
   a = map(int,raw_input().split())
   print('#'*a[1])
   for i in range(a[0]-2):
      b = a[1]-2
      print('#''*'*b'#')
   print('#'*a[1])
   if a == [0,0]
      break


### FIXED CODE ###

# -*- coding: utf-8

while True:
   a = map(int,raw_input().split())
   if a == [0,0]:
      break
   print('#'*a[1])
   for i in range(a[0]-2):
      b ='.'*(a[1]-2)
      print('#'+b+'#')
   print('#'*a[1])
   print('')
N=int(input())

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

H[0]-=1

s=0

if H[0]>H[1]:
    s=1
    
for i in range(1,N-1):
    if H[i]>H[i-1]:
        H[i]-=1
    if H[i]>H[i+1]:
        s=1

if s==1:
    print('No')
else:
    print('Yes')


### FIXED CODE ###

N=int(input())

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

H[0]-=1

s=0

if N>1:
    if H[0]>H[1]:
        s=1
    
    for i in range(1,N-1):
        if H[i]>H[i-1]:
            H[i]-=1
        if H[i]>H[i+1]:
            s=1


if s==1:
    print('No')
else:
    print('Yes')
import sys
import heapq
input = sys.stdin.readline

n, m = map(int, input().split())
li = list(map(int, input().split()))

for _ in range(m):
	heapq._heapify_max(li) 
	x = heapq._heappop_max(li)
	heapq.heappush(li, x // 2)
print(sum(list(li)))



### FIXED CODE ###

import sys
import heapq
input = sys.stdin.readline

n, m = map(int, input().split())
li = [-int(i) for i in input().split()]
li = sorted(li)

for _ in range(m):
	x = heapq.heappop(li)
	#print(x)
	if x % 2 == 0:
		heapq.heappush(li, x // 2)
	else:
		heapq.heappush(li, x // 2 + 1)
	#print(li)
print(-sum(list(li)))
#38
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
last = 9
time = 0
cou = 0
#l = [[A,"A"],[B,"B"],[C,"C"],[D,"D"],[E,"E"]]
l = [A,B,C,D,E]
for i in l:
    if i%10 !=0 :
        if last%10 > i%10:
            last = i

l.remove(last)
l.append(last)
for i in range(5):
    time += l[i]
    if i == 4:
        break
    while time%10 != 0:
        time += 1
        
    
print(time)
        

### FIXED CODE ###

#38
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
last = 9
time = 0
cou = 0
check = 0
#l = [[A,"A"],[B,"B"],[C,"C"],[D,"D"],[E,"E"]]
l = [A,B,C,D,E]
for i in l:
    if i%10 !=0 :
        if last%10 >= i%10:
            last = i
            check +=1
if check !=0:
    l.remove(last)
    l.append(last)
for i in range(5):
    time += l[i]
    if i == 4:
        break
    while time%10 != 0:
        time += 1
        
    
print(time)
import math
n, p = map(int ,input().split())
#引数　n, 返り値nまでの素数をリストで返す
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    #根号
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
ff = primes(int(math.sqrt(p) + 1))
ans = 1
factorized = dict(zip(ff, [0 for i in range(len(ff))]))
div = 2
if n == 1:
    print(p)
    exit()
while p != 1:
    while p % div == 0:
        p /= div
        factorized[div] += 1
    div += 1
for i in factorized.keys():
    if factorized[i] >= n :
        ans *= i*(factorized[i] // n)
print(ans)


### FIXED CODE ###

import math
n, p = map(int ,input().split())
#引数　n, 返り値nまでの素数をリストで返す
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    #根号
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
ff = primes(int(math.sqrt(p) + 1))
ans = 1
factorized = dict(zip(ff, [0 for i in range(len(ff))]))
if n == 1:
    print(p)
    exit()
for i in factorized.keys():
    while p % i == 0:
        p /= i
        factorized[i] += 1
    
for i in factorized.keys():
    if factorized[i] >= n :
        ans *= i**(factorized[i] // n)
print(ans)
#解説放送見てからの書き直し
import sys
import os

INF = 10**12
ans = INF
N, M = map(int,input().split())
A = [0 for _ in range(M)]
B = [0 for _ in range(M)]
C = []
for i in range(M):
    a, b = map(int,input().split())
    A[i] = a  #鍵の金額
    B[i] = b  #開けられる宝箱の種類数
    tmp = list((map(int,input().split())))
    s = 0
    for j in range(b):
        t = tmp.pop(0)-1
        s |= 1 << t
    C.append(s)
dp = [INF]*(1<<N) #2^N
dp[0] = 0
for s in range(1<<N):
    for j in range(M):
        t = s | C[j]
        cost = dp[s] + A[j]
        dp[t] = min(dp[t],cost)
ans = dp[-1]
if ans == INF:
    ans = -1
print(ans)


### FIXED CODE ###

import sys
import os
import math

N  = int(input())
if N%2==0:
    print((N/2)/N)
else:
    print(math.ceil(N/2)/N)
x = int(input())
if x = (3 or 5 or 7):
    print("YES")
else:
    print("NO")


### FIXED CODE ###

x = int(input())
if x == 3 or x == 5 or x == 7:
    print("YES")
else:
    print("NO")
input()
S = input()
K = int(input())
for s in S:(s if s == S[k-1] else *, end="")

### FIXED CODE ###

input()
S=input()
k=int(input())
for s in S:print(s if s==S[k-1] else "*",end="")
import sys
input=sys.stdin.readline

N,D,A=map(int,input().split())
L=[]
for i in range(N):
    x,h=map(int,input().split())
    L.append([x,h])
L.sort()

import math

ans=0
S=0
P=0
RL=[]
RC=[]
cnt=0
for i in range(N):
    while P<i and RL[P]<L[i][0]:
        cnt+=RC[P]
        P+=1
    if L[i][1]-S+cnt>0:
        ans+=math.ceil((L[i][1]-S+cnt)/A)
        RL=RL[:len(RL)-1]
        RC=RC[:len(RC)-1]
        RL+=[L[i][0]+2*D]
        RC+=[math.ceil((L[i][1]-S+cnt)/A)*A]
        S+=math.ceil((L[i][1]-S+cnt)/A)*A
    #print(i,ans,P)
print(ans)

### FIXED CODE ###

import sys
input=sys.stdin.readline

N,D,A=map(int,input().split())
L=[]
for i in range(N):
    x,h=map(int,input().split())
    L.append([x,h])
L.sort()

import math

ans=0
S=0
P=0
RL=[0]
RC=[0]
cnt=0
for i in range(N):
    for j in range(P,len(RL)):
        if RL[P]<L[i][0]:
            cnt+=RC[P]
            P+=1
        else:
            break
    if L[i][1]-S+cnt>0:
        ans+=math.ceil((L[i][1]-S+cnt)/A)
        
        RL+=[L[i][0]+2*D]
        RC+=[math.ceil((L[i][1]-S+cnt)/A)*A]
        S+=math.ceil((L[i][1]-S+cnt)/A)*A
    #print(i,ans,P,RL,RC,S,cnt)
print(ans)
sum = input()
cnt = 0
  
if sum[1] == '1' :
  cnt =+ 1
 
if sum[2] == '1':
  cnt =+ 1
 
if sum[3] == '1':
  cnt =+ 1

print(cnt)

### FIXED CODE ###

sum = input()
cnt = 0
  
if sum[0] == '1' :
  cnt += 1
 
if sum[1] == '1':
  cnt += 1
 
if sum[2] == '1':
  cnt += 1

print(cnt)
s = input()
n = s.size()
ans=""
 
half = s[0:(n-1)/2]
 
if s==s[::-1] and half==half[::-1]:
	ans = "Yes"
else:
	ans = "No"
  
print(ans)

### FIXED CODE ###

s = input()
n = len(s)
ans=""
 
half = s[:int((n-1)/2)]
 
if s==s[::-1] and half==half[::-1]:
	ans = "Yes"
else:
	ans = "No"
  
print(ans)
# ABC175 D
import bisect

N,K=map(int,input().split())
P=list(map(int,input().split()))
C=list(map(int,input().split()))

F=[0]*N

def op(n):
    C_n=[]
    P_n=[]
    m=n
    while 1:
        C_n.append(C[m-1])
        P_n.append(m)
        F[m-1]=1
        m=P[m-1]
        if m==n:
            break
    sum_C_n=sum(C_n)
    C_n=C_n[:]+C_n[:]
    n=len(P_n)
    res=[]
    for k in range(1,min(n+1,K)):
        res_k=[]
        for i in range(n):
            res_k.append(sum(C_n[i:i+k]))
        p=max(res_k)
        if K-k>=n and sum_C_n>=0:
                p+=sum_C_n*(K-k)//n
        res.append(p)
    return max(res)
    
res=-float('inf')
while 0 in F:
    n=bisect.bisect_right(F,0)
    res=max(op(n),res)
print(res)

### FIXED CODE ###

# ABC175 D
import bisect

N,K=map(int,input().split())
P=list(map(int,input().split()))
C=list(map(int,input().split()))

F=[0]*N

def search(n):
    res=[]
    l=0
    m=n
    tmp_res=0
    isloop=0
    if F[n-1]:
        s,L=F[n-1]
    while 1:
        m=P[m-1]
        tmp_res+=C[m-1]
        l+=1
        if F[n-1]==0:
            res.append((tmp_res,l))
        else:
            res.append(tmp_res+s*((K-l)//L) if s>0 and K>=l else tmp_res)
        if m==n:
            isloop=1
            break
        if l==K:
            break
    if F[n-1]==0:
        if isloop:
            s,L=res[-1]
            if not F[n-1]:
                m=n
                while 1:
                    F[m-1]=(s,L)
                    m=P[m-1]
                    if m==n:
                        break
        else:
            s=-1
        p=max([p+s*((K-k)//len(res)) if s>0 and K>=k else p for p,k in res])
    else:
        p=max(res)
    return p

res=-float('inf')
for i in range(N):
    res=max(res,search(i+1))
print(res)
s = (int(x) for i in input())
count = 0
if[i for i in s if i == 1]:
	count+=1
print(count)

### FIXED CODE ###

#-*- coding:utf-8 -*-

a,b,c = (int(x) for x in input())
list = [a, b, c]
count = 0
for i in list:
	if i == 1:
		count += 1
print(count)
n, q = map(int, input().split())
s = input()
flag = False
count = 0
li = []

for i in range(n):
    if s[i] == "A":
        flag = True
    if s[i] == "C" and flag is True:
        count += 1
        flag = False
    li.append(count)
    print(li)

for i in range(q):
    l, r = map(int, input().split())
    print(li[r-1] - li[l-1])


### FIXED CODE ###

n, q = map(int, input().split())
s = input()
flag = False
count = 0
li = []

for i in range(n):
    if s[i] == "A":
        flag = True
    elif s[i] == "C" and flag is True:
        count += 1
        flag = False
    else:
        flag = False
    li.append(count)

for i in range(q):
    l, r = map(int, input().split())
    print(li[r-1] - li[l-1])
a = int(input())
b = int(input())
c = int(input())
d = int(input())

if a - b <= d and b - c <= d or a - c <= d:
    print"Yes"
else:
    print"No"


### FIXED CODE ###

a = input().split()
if (abs(int(a[0]) - int(a[1])) <= int(a[3]) and abs(int(a[1]) - int(a[2])) <= int(a[3])) or abs(int(a[0]) - int(a[2])) <= int(a[3]):
    print("Yes")
else:
    print("No")
S = input()
g = 10 ** 9 + 7
x = 1
DP = [None for _ in range(2)]
DP[0] = [0] * 13
DP[0][0] = 1
for i in range(len(S)):
    DP[1] = DP[0].copy()
    DP[0] = [0] * 13
    for j in range(13):
        if S[i] == "?":
                for k in range(10):
                    DP[0][(j*10+k)%13] += DP[1][j]
        else:
            DP[0][(j*10+int(S[i]))%13] += DP[1][j]

print(DP[0][5] % g)


### FIXED CODE ###

S = input()
g = 10 ** 9 + 7
x = 1
DP = [[0] * 13 for _ in range(2)]
DP[0][0] = 1
for i in range(len(S)):
    for j in range(13):
        DP[1][j] = DP[0][j] % g
        DP[0][j] = 0
    for j in range(13):
        if S[i] == "?":
            for k in range(10):
               DP[0][(j*10+k)%13] += DP[1][j]
        else:
            DP[0][(j*10+int(S[i]))%13] += DP[1][j]

print(DP[0][5] % g)
# 三井住友信託銀行プログラミングコンテスト 2019 D - Lucky PIN
N = int(input())
S = str(input())

ans = 0
for i in range(10):
    code1 = S.find(str(i))
    if code1 == -1:
        continue
    for j in range(10):
        code2 = S.find(str(j), code1 + 1)
        if code2 == -1:
            continue
        for k in range(10):
            code3 = S.find(str(k), code2 + 1)
            if code3 != -1:
                ans += 1

print(ans)
b v

### FIXED CODE ###

# 三井住友信託銀行プログラミングコンテスト 2019 D - Lucky PIN

import sys


def main():
    N = int(input())  # 桁数
    S = str(input())

    ans = set()

    digit1 = set()

    for i in range(0, N - 2):
        if S[i] in digit1:
            continue
        digit1.add(S[i])
        digit2 = set()

        for j in range(i + 1, N - 1):
            if S[j] in digit2:
                continue
            digit2.add(S[j])
            digit3 = set()
            for k in range(j + 1, N):
                if len(digit3) == 10:
                    break
                code = S[i] + S[j] + S[k]
                ans.add(code)

    print(len(ans))


if __name__ == '__main__':
    main()
S = str(input())
S = S.sort()
if S.count(S[0]) == 2 and S.count(S[2]) == 2:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S = str(input())
S = sorted(S)
if S.count(S[0]) == 2 and S.count(S[2]) == 2:
  print("Yes")
else:
  print("No")
class BIT:
    def __init__(self, size):
        self.size = size
        self.bit = [0] * (size + 1)

    # sum [0, i)
    def sum(self, i):
        s = 0
        while (i > 0):
            s += self.bit[i]
            i -= i & -i
        return s

    # sum [i, j)
    def sum_sec(self, i, j):
        return self.sum(j) - self.sum(j)

    def add(self, i, x):
        i += 1
        while (i <= self.size):
            self.bit[i] += x
            i += i & -i

n, q = map(int, raw_input().split())
bit = BIT(n)
for i in xrange(q):
    c, x, y = map(int, raw_input().split())
    if c == 0: bit.add(x - 1, y)
    else: print bit.sum(x - 1, y)

### FIXED CODE ###

class BIT:
    def __init__(self, size):
        self.size = size
        self.bit = [0] * (size + 1)

    # sum [0, i)
    def sum(self, i):
        s = 0
        while (i > 0):
            s += self.bit[i]
            i -= i & -i
        return s

    # sum [i, j)
    def sum_sec(self, i, j):
        return self.sum(j) - self.sum(i)

    def add(self, i, x):
        i += 1
        while (i <= self.size):
            self.bit[i] += x
            i += i & -i

n, q = map(int, raw_input().split())
bit = BIT(n)
for i in xrange(q):
    c, x, y = map(int, raw_input().split())
    if c == 0: bit.add(x - 1, y)
    else: print bit.sum_sec(x - 1, y)
# -*- coding: utf-8 -*-

from sys import stdin, setrecursionlimit
import math
from functools import reduce

setrecursionlimit(10000)

n,x = [int(x) for x in stdin.readline().split()]
limit = int(math.pow(x, (1.0/n)))

def factorize(x, g):

    p = 2
    if x % p == 0:
        p_n = math.pow(p, n)
        if x % p_n == 0:
            g = factorize(x / p_n, g)
            g.append(p)
            return g

    for p in range(3, limit, 2):
        if x % p == 0:
            p_n = math.pow(p, n)
            if x % p_n == 0:
                g = factorize(x / p_n, g)
                g.append(p)
                return g
    return g

if x == 1:
    print(1)
elif n == 1:
    print(x)
else:
    g = factorize(x, [])
    ans = reduce(lambda a,b: a*b, g)
    print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-

from sys import stdin

n,x = [int(i) for i in stdin.readline().split()]
limit = int(x ** (1.0/n)) + 1

def devide_counter(x, p):
    count = 1
    x /= p
    while x % p == 0:
        count += 1
        x /= p
    return x, count

def factorize(x):
    ans = 1

    p = 2
    if x % p == 0:
        x, count = devide_counter(x, p)
        if count >= n:
            ans = ans * (p ** (count // n))

    for p in range(3, limit, 2):
        if x % p == 0:
            x, count = devide_counter(x, p)
            if count >= n:
                ans = ans * (p ** (count // n))
        if x < p * p:
            break
    return ans

if x == 1:
    print(1)
elif n == 1:
    print(x)
else:
    ans = factorize(x)
    print(ans)
a,b,c = map(int, imput().split())

if (a+b) >= c:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

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

if (a+b) >= c:
  print('Yes')
else:
  print('No')
a = input()
b = input()
if a * b % 2 == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a,b = map(int,input().split())
if a * b % 2 == 0:
    print("Even")
else:
    print("Odd")
s=input()
n=len(s)
a=l.find("0")
b=l.rfind("0")
c=l.find("1")
d=l.rfind("1")
x=max(a,n-b-1)
y=max(c,n-b-1)
print(min(x,y,n-a,n-b))

### FIXED CODE ###

s=input()
n=len(s)
ans=n
for i in range(n-1):
    if s[i]!=s[i+1]:
        t=max(i+1,n-i-1)
        ans=min(ans,t)

print(ans)
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
bit_cnt = 2 ** N # 箱は最大で12個
INF = 10 ** 10
dp = [INF] * bit_cnt
dp[0] = 0
for _ in range(M):
    price, b = lr()
    open = sum([2 ** (x-1) for x in lr()]) # 1と3の箱を開ける鍵なら101となる
    for j in range(bit_cnt):
        if dp[j|open] > dp[j] + price:
            dp[j|open] = dp[j] + price

if dp[-1] == INF:
    prnit(-1)
else:
    print(dp[-1])
# 解き直し08

### FIXED CODE ###

def main():
    N, M = map(int, input().split())
    b_cnt = 2 ** N #箱の数は最大12個
    INF = 10 ** 9
    dp = [INF] * b_cnt
    dp[0] = 0

    for i in range(M):
        a, b = map(int, input().split())
        c = sum([2 ** (int(x)-1) for x in list(input().split())])
        for j in range(b_cnt):
            if dp[j|c] > dp[j] + a:
                dp[j|c] = dp[j] + a

    if dp[-1] == INF:
        print(-1)
    else:
        print(dp[-1])

if __name__ == '__main__':
    main()
A,B,X = int(input())
if A < X and X < A+B:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

A,B,X = map(int,input().split())
if A <= X and X <= A+B:
    print("YES")
else:
    print("NO")
n = input()
 
d = [1000 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
 
def BFS(s):
  q = []
  q.append(s)
  d[s] = 0
  while q.length != 0:
    u = q[0]
    q.pop(0)
    for v in range(n):
      if M[u][v] == 0 and d[v] != 1000:
        d[v] = d[u] + 1
        q.append(v)
  for i in range(n):
    print i+1, d[i]
 
for i in range(n):
  G = map(int, raw_input().split())
  for j in range(G[1]):
    M[G[0]-1][G[2+j]-1] = 1
 
BFS(0)

### FIXED CODE ###

n = input()
  
d = [-1 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
color = [0 for i in range(n)]
  
def BFS(s):
  color[0] = 1
  q = []
  q.append(s)
  d[s] = 0
  while len(q) != 0:
    u = q[0]
    q.pop(0)
    for v in range(n):
      if M[u][v] == 1 and color[v] == 0:
        color[v] = 1
        d[v] = d[u] + 1
        q.append(v)
  color[u] = 2
  for i in range(n):
    print i+1, d[i]
  
for i in range(n):
  G = map(int, raw_input().split())
  for j in range(G[1]):
    M[G[0]-1][G[2+j]-1] = 1
  
BFS(0)
K = int(input())
S = input()
MOD = 10**9 + 7


def cmb(n, r, MOD):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % MOD


N = 10**6+1
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % MOD)
    inverse.append((-inverse[MOD % i] * (MOD//i)) % MOD)
    g2.append((g2[-1] * inverse[-1]) % MOD)

ans = 0
for i in range(len(S), len(S)+K+1):
    ans += cmb(i-1, len(S)-1, MOD)*pow(25, i-len(S), MOD) * \
        pow(26, len(S)+K-i, MOD)
    ans %= MOD
print(ans)


### FIXED CODE ###

K = int(input())
S = input()
MOD = 10**9 + 7


def cmb(n, r, MOD):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % MOD


N = 3*10**6
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % MOD)
    inverse.append((-inverse[MOD % i] * (MOD//i)) % MOD)
    g2.append((g2[-1] * inverse[-1]) % MOD)

ans = 0
for i in range(len(S), len(S)+K+1):
    ans += cmb(i-1, len(S)-1, MOD)*pow(25, i-len(S), MOD) * \
        pow(26, len(S)+K-i, MOD)
    ans %= MOD
print(ans)