Harryxun/stf_run huggingface dataset:
n,x= map(int,input().split())
L = list(map(int,input().split()))


coordinate=0
for i in range(len(L)):
    coordinate+=L[i]
    if coordinate>x:
        ans = i+1
        break
    
print(ans)

### FIXED CODE ###

#coding:utf-8
n,x= map(int,input().split())
L = list(map(int,input().split()))


coordinate=0
ans = 1
for e in L:
    if coordinate+e<=x:
        ans+=1
        coordinate+=e
    else:
        break

print(ans)
def main():
    N, K = map(int, input().split())
    x = list(map(int, input().split()))
    s = N * (10 ** 8)
    for i in range(N-K):
        if x[i] * x[K - 1 + i] < 0:
            s = min(s, min(x[K - 1 + i], abs(x[i])) * 2 + max(x[K - 1 + i], abs(x[i])))
        else:
            s = min(s, max(abs(x[K - 1 + i], x[i])))
    print(s)
main()


### FIXED CODE ###

def main():
    N, K = map(int, input().split())
    x = list(map(int, input().split()))
    s = 5 * (10 ** 8)
    for i in range(N-K+1):
        if x[i] * x[K - 1 + i] < 0:
            s = min(s, min(x[K - 1 + i], abs(x[i])) * 2 + max(x[K - 1 + i], abs(x[i])))
        else:
            s = min(s, max(abs(x[K - 1 + i]), abs(x[i])))
    print(s)
main()
import math
mod = 10**9+7

def stairs(n):
    a = 1/math.sqrt(5)
    b = (1+math.sqrt(5))/2
    c = (1-math.sqrt(5))/2
    return int(a*(b**(n+1)-c**(n+1)))%mod

def main():
    n,m = map(int,input().split(' '))
    a=[-1]
    a_list=[]
    ans = 1
    if m !=0:
        for i in range(m):
            a.append(int(input()))
        a.append(n+1)
        for i in range(m+1):
            a_list.append(a[i+1]-a[i]-2)
        for i in a_list:
            if i <0:
                ans = 0
                break
            ans *= stairs(i)
            ans %= mod
        print(ans)
    else:
        print(stairs(n)%mod)

main()

### FIXED CODE ###

import sys
mod = 10**9+7
def main():
    n,m=map(int,input().split(' '))
    if m > 0:
        aaa = set(map(int,sys.stdin))
    else:
        aaa = set()

    dp = [0] * (n+1)
    dp[0] = 1
    dp[1] = 1 if 1 not in aaa else 0
    for i in range(2,n+1):
        if i in aaa:
            continue
        dp[i] = dp[i-1]+dp[i-2]

    print(dp[n]%mod)

main()
a,b=input().split()
if a==3,b==1 :
  print(2)
elif a==1,b==2 :
  print(3)
elif a==2,b==3 :
  print(1)

### FIXED CODE ###

a=int(input())
b=int(input())
if a==3 and b==1 :
  print(2)
elif a==1 and b==2 :
  print(3)
elif a==2 and b==3 :
  print(1)
elif a==3 and b==2 :
  print(1)
elif a==1 and b==3 :
  print(2)
elif a==2 and b==1 :
  print(3)
A,B,C,D,E,F = map(int,input().split())
M = []
S = []

# 100A,100B の水
for a in range(1 + F // 100):
    for b in range(1 + F // 100):
        if 100 * (a * A + b * B) <= F:
            M.append(100 * (a * A + b * B))

# c,d の砂糖
for c in range(1 + F // C):
    for d in range(1 + F // D):
        if c * C + d * D <= F:
            S.append(c * C + d * D)

M=list(set(M))
S=list(set(S))
M.sort()
S.sort()

x = 0
for m in M:
  for s in S:
    if m != 0 and s != 0 and m + s <= F:
        sol = 100 * s / m
        if sol > x and sol <= E:
            x = sol
            X, Y = m + s, s

print(X,Y)


### FIXED CODE ###

A,B,C,D,E,F = map(int,input().split())
W = []
S = []

# 100A,100B の水
for a in range(1 + F // 100):
    for b in range(1 + F // 100):
        water = 100 * (a * A + b * B)
        if 0 < water <= F:
            W.append(water)

# c,d の砂糖
for c in range(1 + F // C):
    for d in range(1 + F // D):
        sugar = c * C + d * D
        if sugar <= F:
            S.append(sugar)

W = list(set(W))
S = list(set(S))

x = -1
for w in W:
    for s in S:
        if w + s <= F:
            sol = 100 * s / w
            if x < sol <= E:
                x = sol
                X, Y = w + s, s

print(X,Y)
from operator import add
import numpy as np
import functools


n = int(input())
m = int(input())
list_homework = input().split(" ")
list_homework = [int(list_homework[i]) for i in range(len(list_homework))]  

rest_day = n - functools.reduce(add, list_homework)

if rest_day >= 0:
    print(rest_day)
else:
    print("-1")

### FIXED CODE ###

from operator import add
import functools


n = input().split(" ")

list_homework = input().split(" ")
list_homework = [int(list_homework[i]) for i in range(len(list_homework))]  

rest_day = int(n[0]) - functools.reduce(add, list_homework)

if rest_day >= 0:
    print(rest_day)
else:
    print("-1")
n,q = map(int,input().split())
dic = {}

for _ in range(n-1):
    a, b = map(int, input().split())
    if not (a in dic):
        dic[a] = []
    dic[a].append(b)

v_list = [0 for _ in range(n)]


def add_v(num, value):
    v_list[num-1] = v_list[num-1]+value
    if num in dic:
        for root in dic[num]:
            add_v(root, value)


for i in range(q):
    p,x=map(int,input().split())
    add_v(p, x)

print(*v_list)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

n, q = map(int, input().split())
dic = {}

for _ in range(n - 1):
    a, b = map(int, input().split())
    if not (a in dic):
        dic[a] = []
    dic[a].append(b)

v_list = [0 for _ in range(n)]

for _ in range(q):
    a, b = map(int, input().split())
    v_list[a-1] += b

key_list = list(dic.keys())
key_list.sort()

for a in key_list:
    for b in dic[a]:
        v_list[b-1] = v_list[a-1] + v_list[b-1]

print(*v_list)
a=int(input())
a.replace("/","")
print("Heisei" if a<=2019430 else "TBD")

### FIXED CODE ###

a=input()
print("Heisei" if int(a.replace("/", ""))<=20190430 else "TBD")
import bisect as bs
import sys

n = int(input())
array = []

for i in range(n):
  a,b = map(int, input().split())
  array.append((a,b,False))
  
for j in range(n):
  c,d = map(int, input().split())
  array.append((c,d,True))
  
array.sort()

blue = []

count = 0 
for v in array:
  if v[2]:
    index = bs.bisect_left(blue, v[1])
    if index != 0:
      blue[index-1] = sys.maxsize
      count += 1
      blue.sort()
      
  else:
    blue.append(v[1])
    blue.sort()
    
print(count)import bisect as bs
import sys

n = int(input())
array = []

for i in range(n):
  a,b = map(int, input().split())
  array.append((a,b,False))
  
for j in range(n):
  c,d = map(int, input().split())
  array.append((c,d,True))
  
array.sort()

blue = []

count = 0 
for v in array:
  if v[2]:
    index = bs.bisect_left(blue, v[1])
    if index != 0:
      blue[index-1] = sys.maxsize
      count += 1
      blue.sort()
      
  else:
    blue.append(v[1])
    blue.sort()
    
print(count)

### FIXED CODE ###

import bisect as bs
import sys

n = int(input())
array = []

for i in range(n):
  a,b = map(int, input().split())
  array.append((a,b,False))
  
for j in range(n):
  c,d = map(int, input().split())
  array.append((c,d,True))
  
array.sort()

blue = []

count = 0 
for v in array:
  if v[2]:
    index = bs.bisect_left(blue, v[1])
    if index != 0:
      blue[index-1] = sys.maxsize
      count += 1
      blue.sort()
      
  else:
    blue.append(v[1])
    blue.sort()
    
print(count)
a=[[[0]*10]*3]*4
for _ in range(int(input())):
 b,f,r,v=map(int,input().split())
 a[b-1][f-1][r-1]+=v
for i in range(4):
 for j in range(3):
  print(' '.join(a[i][j]))
 if i!=3:print('#'*20)

### FIXED CODE ###

a=[[10*[0]for _ in[0]*3]for _ in[0]*4]
for _ in[0]*int(input()):
 b,f,r,v=map(int,input().split())
 a[b-1][f-1][r-1]+=v
for i in range(4):
 for j in range(3):print('',*a[i][j])
 if i<3:print('#'*20)
print((int(input() + 1) // 2)

### FIXED CODE ###

print(-(-int(input()) // 2))
import numpy as np 
 
N,K = map(int, input().split())
 
A_array = np.array(list(map(int, input().split())))
 
if K > 500:
   K = 500

for k in range(K):
 
    B_list = list()
 
    inf_array = np.array(range(N)) + 0.5 - A_array
    sup_array = np.array(range(N)) + 1.5 + A_array
        
    B_list = [((inf_array <= m+1) & (m+1<=sup_array)).sum() for m in range(N)]
 
    A_array = np.array(B_list)
    
print(' '.join(map(str, A_array)))    

### FIXED CODE ###

S = input()
nick = str()
for n in range(3):
  nick = nick + S[n]    

print(nick)
X = [for int(i) in input().split()]
for c, x in enumerate(X):
  if x == 0:
  	print(c)


### FIXED CODE ###

X = [int(i) for i in input().split()]
for c, x in enumerate(X):
  if x == 0:
  	print(c+1)
n=int(input())
a=list(map(int,input().split()))

value=max(a)
index=a.index(max(a))

for i in range(n):
  if i==index:
    b=a.pop(i)
    print(max(a))
  else:
      print(value)

### FIXED CODE ###

n=int(input())
a=[]

for j in range(0,n):
  a.append(int(input()))
  
x=max(a)
y=a.index(x)
del a[y]
z=max(a)

for i in range(0,n):
  if i!=y:
    print(x)
  else:
    print(z)
import numpy as np
from itertools import combinations
N = int(input())
A = np.array(list(map(int, input().split())), dtype= int)
X = A.sum()
A1 = np.cumsum(A)
mincost = -1
for r1, r2, r3 in combinations(range(1,N), 3):
    P = A1[r1]
    Q = Y - A1[r1]
    R = A1[r3]-Y
    S = X-A1[r3]
    cost = max(P,Q,R,S) - min(P,Q,R,S)
    if mincost < 0 or mincost >  cost:
        mincost = cost
print(mincost)

### FIXED CODE ###

from itertools import accumulate
input()
*s, = accumulate(map(int, input().split()))
l,r,t = 0,2,s[-1]
c = t
for m in s[1:-2]:
    while t+m > s[r]+s[r+1]:
        r += 1
    while m > s[l]+s[l+1]:
        l += 1
    x = sorted([s[l],m-s[l],s[r]-m,t-s[r]])
    c = min(c,x[-1]-x[0])
print(c)
import sys
sys.setrecursionlimit(1000000)
def rec(n):
    if n == 1: 
        return 1
    return rec(n/2)*2+1

n = int(input())
print(rec(n))

### FIXED CODE ###

import math
h = int(input())
l = 1

while (h != 1):
    h = math.floor(h / 2)
    l += 1
ans = 0

for i in range(l):
    ans += 2**i
print(ans)
from itertools import combinations_with_replacement

N, K, S = [int(n) for n in input().split()]
ans = []
for i in rrange(N-K):
    ans.append(1)
for j in range(K):
    ans.append(S)
print(ans)


### FIXED CODE ###

N, K, S = [int(n) for n in input().split()]
ans = []
for i in range(N-K):
    ans.append(S+1 if S<10**9 else 1)
for j in range(K):
    ans.append(S)
print(" ".join([str(n) for n in ans]))
n,y = map(int,input().split())

import sys
flag = False
for i in range(n):
    for j in range(n-j):
        k = n - i - j
        if 10000 * i + 5000 * j + 1000 * k == y:
            flag = True
            print(i,j,k)
            sys.exit()
if flag == False:
    print(-1, -1, -1)

### FIXED CODE ###

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

import sys

for i in range(n+1):
    for j in range(n+1-i):
        k = n - i - j
        if 10000 * i + 5000 * j + 1000 * k == y:
            print(i,j,k)
            sys.exit()

print(-1, -1, -1)
a = [int(input()) for i in range(3)]
N=a[0]
A=a[1]
B=a[2]

if N==1:
    print('Hello World')
else:
    print(A+B)


### FIXED CODE ###

N = int(input())
if N == 1:
	print("Hello World")
else:
	A = int(input())
	B = int(input())
	print(A + B)
import math

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

L = [list(input().split())]

print(math.gcd_list(L))

### FIXED CODE ###

import fractions
from functools import reduce
 
N, X = map(int, input().split())
 
L = []

def minus_X(n):
  return abs(n - X)

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

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

L2 = map(minus_X, L)
 
print(gcd_list(L2))
kazulist = []
for i in range(100):
    kazulist.append(i+1)
 
a = list(input().split(" "))
target = int(a[0])
syokyo = int(a[1])
 
b = list(input().split(" "))
for i in b:
    kazulist.remove(int(i))
 
saisyosa = 100
kotae = 0
for i in kazulist:
    sa = target - int(i)
    if sa < 0:
        sa *= -1
    if sa < saisyosa:
        saisyosa = sa
        kotae = i
 
print(kotae)

### FIXED CODE ###

kazulist = []
for i in range(-100,200):
    kazulist.append(i)
 
a = list(input().split(" "))
target = int(a[0])
syokyo = int(a[1])

if syokyo != 0:
    b = list(input().split(" "))
    for i in b:
        kazulist.remove(int(i))
 
saisyosa = 100
kotae = 0
for i in kazulist:
    sa = target - int(i)
    #print(sa)
    if sa < 0:
        sa *= -1
    if sa < saisyosa:
        saisyosa = sa
        kotae = i
 
print(kotae)
import math

a,b=map(int,input().split())
print(a*b//math.gcd(a,b))

### FIXED CODE ###

import fractions

a,b=map(int,input().split())
print(a*b//fractions.gcd(a,b))
s = input().replace("eraser","").replace("erase"."").replace("dreamer"."").replace("dream","")
if s:
    print("NO")
else:
    print("YES")

### FIXED CODE ###

s = input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
    print('NO')
else:
    print('YES')
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n = int(input())

l = list(range(1,n+1))

ans = 0
for i in range(n):
    ans += l[i] % l[i-n+1]

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n = int(input())

ans = int(n*(n-1)//2)

print(ans)
s = input()
if s = "SUN":
  print (7) 
elif s= "MON":
  print (6)
elif s= "TUE":
  print (5)
elif s= "WED":
  print (4)
elif s= "THU":
  print (3)
elif s= "FRI":
  print (2)
else:
  print(1)

### FIXED CODE ###

s = input()
days = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
print (days[s])
while True:
    n = int(input())
    a = list(map(int, input().split()))
    l = list()

    for i in range(1, n-1):
        for j in range(i+1,n):
            l.append(abs(a[i]-a[j]))
    if l = []:
        break
    if n == 0:
        break
    print(min(l))



### FIXED CODE ###

while True:
    n = int(input())#人数の受け取り
    if n == 0:#０人or何も入力しないなら終了
        break
    a = list(map(int, input().split()))#各人の成績の受け取り
    l = list()#出力の受け取り用
    for i in range(0, n):#成績の比較
        for j in range(0, n):
            if i == j:
                continue
            l.append(abs(a[i]-a[j]))#絶対値を受け取り用のlistに入力
    else:#listが完成したら
        print(min(l))#成績の一番近い生徒の差を出力
n, k = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]

l = []
a = 0

for i in range(30):
    if k > 2 ** i:
        a = i

for i in range(2 ** a, k):
    ans = 0
    for j in range(n):
        if i == ab[j][0] | i:
            ans += ab[j][1]
        l.append(ans)

print(max(l))


### FIXED CODE ###

n, k = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]

l = []

kb = bin(k)
ll = [k]

for i in range(len(kb) - 2):
    if kb[i + 2] == '1':
        ll.append(int(kb[:i + 2] + '0' + '1' * (len(kb) - (i + 3)), 2))

for i in ll:
    ans = 0
    for j in range(n):
        if i == ab[j][0] | i:
            ans += ab[j][1]
        l.append(ans)

print(max(l))
import sys
input = sys,sydin.readline

S = input().strip()
a = ['A', 'T', 'G', 'C']

ans = 0
j = []
for i in range(len(S)):
  j = i
  count = 0
  while True:
    if j >= len(S):
      break
    if S[j] in a:
      count += 1
      j += 1
    else:
      ans = max(ans, count)
      break
  
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

S = input().strip()
a = ['A', 'T', 'G', 'C']

ans = 0
j = []
for i in range(len(S)):
  j = i
  count = 0
  while True:
    ans = max(ans, count)
    if j >= len(S):
      break
    if S[j] in a:
      count += 1
      j += 1
    else:
      break
  
print(ans)
def resolve():
    '''
    code here
    '''
    N = int(input())
    As = [int(item) for item in input().split()]

    deff_list = [0]
    for i in range(1,N):
        deff_list.append(As[i] - As[i-1])

    res_list = []
    is_first = True
    any_plus = False
    for i in range(1,N):
        if is_first and any_plus and deff_list[i] < 0 :
            res_list.append([i-1, As[i-1]])
            is_first = False

        if deff_list[i-1] > 0 and deff_list[i] < 0:
            res_list.append([i-1, As[i-1]])
        
        if deff_list[i] > 0:
            any_plus = True

    else:
        if deff_list[N-1] > 0:
            res_list.append([N-1, As[N-1]])

    prev = 0
    res = 1000
    for i, val in res_list:
        temp_min = min(As[prev:i])
        temp_num = res //  temp_min
        res = temp_num * val + res % temp_min
        prev = i

    print(res)



if __name__ == "__main__":
    resolve()


### FIXED CODE ###

def resolve():
    '''
    code here
    '''
    N = int(input())
    As = [int(item) for item in input().split()]

    deff_list = [0]
    for i in range(1,N):
        deff_list.append(As[i] - As[i-1])

    prev = 1000
    res = 1000
    for i in range(1, N):
        if deff_list[i] >= 0:
            res = (prev // As[i-1]) * As[i] + prev % As[i-1]
        
        prev = res
    
    print(res)



if __name__ == "__main__":
    resolve()
S = list(str,input())
S[3] = str(8)
print(S)

### FIXED CODE ###

S = list(input())
S[3] = "8"
print("".join(S))
a, b = map(int,input().split())
if (a - b) % 2 == 0:
  print(a-(a-b//2)
else:
  print("IMPOSSIBLE")


### FIXED CODE ###

a, b = map(int,input().split())
if (a - b) % 2 == 0:
  print(a-(a-b)//2)
else:
  print("IMPOSSIBLE")
s = input()
k = int(input())
ans = []
for i in range(1,len(s)):
  for j in range(len(s)):
    if j+i > len(s): break

    ans.append(s[j:j+i])

ans = list(sorted(set(ans))) #setはsortedではソートできる。リストでソートしてsetに帰ると順序は保証されない

print((ans[k-1]))

### FIXED CODE ###

s = input()
k = int(input())
ans = []
for i in range(1,k+1):
  for j in range(len(s)):
    if j+i > len(s): break

    ans.append(s[j:j+i])


ans = list(sorted(set(ans))) #setはsortedではソートできる。リストでソートしてsetにすると順序は保証されない

if k != 1:
  print((ans[k-1]))
else:
  print(min(list(s)))
n=int(input())
l=list(map(int,input().split()))
count=0
for i in range(1,6):
    if l[i-1]!=i:
        count+=1
print("YES" if count==0 or count==2 else "NO")

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
count=0
for i in range(1,n+1):
    if l[i-1]!=i:
        count+=1
print("YES" if count==0 or count==2 else "NO")
H,W=map(int,input().split())
h,w=map(int,input(),split())
print((H-h)*(W-w))

### FIXED CODE ###

H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*(W-w))
a,b=int(input()).split()
print(a*b+" "+(a*2+b*2))

### FIXED CODE ###

a,b=map(int,input().split())
s=a*b
l=(a+b)*2
print(s,l)
N, A, B, C, D = map(int, input().split())

A -= 1
B -= 1
C -= 1
D -= 1

S = str(input())

moziretu = S  # 保持しておく

# Bの人から動かす
zenhann = True
hoge = S[B+1]
for i in range(B+2, D):
    if hoge == S[i] and hoge == '#':
        zenhann = False
        break
    else:
        hoge = S[i]

if zenhann:
    str_list = list(S)
    str_list[D] = '#'
    S = "".join(str_list)

    hoge = S[A+1]
    for i in range(A+2, C):
        if hoge == S[i] and hoge == '#':
            zenhann = False
            break
        else:
            hoge = S[i]

kouhann = True
# Aの人から動かす
str_list = list(moziretu)
str_list[B] = '#'
moziretu = "".join(str_list)

hoge = moziretu[B]
for i in range(B+1, C+2):
    if hoge == moziretu[i] and hoge == '#':
        kouhann = False
        break
    else:
        hoge = moziretu[i]

fuga = moziretu[A+1]
for i in range(A+2, C):
    if fuga == moziretu[i] and fuga == '#':
        kouhann = False
        break
    else:
        fuga = S[i]
if kouhann:
    str_list = list(moziretu)
    str_list[C] = '#'
    moziretu = "".join(str_list)

    fuga = moziretu[B+1]
    for i in range(B+2, D):
        if fuga == moziretu[i] and fuga == '#':
            kouhann = False
            break
        else:
            fuga = moziretu[i]

if zenhann or kouhann:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

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

A -= 1
B -= 1
C -= 1
D -= 1

if '##' in S[A:C+1] or '##' in S[B:D+1]:
    print('No')  # そもそも移動経路の中に岩が二つ並んでいたら不可能ということ！
else:
    if C < D:  # この状態ならBにいる人をDに動かしてから、AをCに動かすだけでOK
        print('Yes')
    elif C > D:  # Aの目的地が、Bの目的地よりも右にあるなら
        # B-1からD+2にまでの中にBくんを退避させることが可能なスペースがあるか。
        # BくんはDまでしか動けない
        if "..." in S[B-1:D+2]:
            print('Yes')
        else:
            print('No')
X=int(input())
Y=[]
for i in range(1,X):
    for j in range(2,X):
        if pow(i,j)>X:
            break
        Y.append(pow(i,j))

print(max(Y))


### FIXED CODE ###

x = int(input())
 
m = 1
 
for i in range(1, 32):
    for j in range(2, 10):
        p = pow(i, j)
        if p > x:
            break
        if p > m:
            m = p
 
print(m)
n, x = map(int, input().split())
p = set(map(int, input().split()))

ans = 0
for i in range(1, 102):
  if i in p:
    continue
  if i < x:
    ans = i
  elif x - ans > i - x
  	ans = i
    break
print(ans)

### FIXED CODE ###

x, n = map(int, input().split())
p = set(map(int, input().split()))

ans = 0
diff = x
for i in range(1, 102):
  if i in p:
    continue
  tmp = abs(i - x)
  if tmp < diff:
    diff = tmp
    ans = i
print(ans)
from functools import lru_cache
import sys
sys.setrecursionlimit(10**6)


@lru_cache
def factorial(n):
    if n == 0:
        return 1
    return (n * factorial(n-1)) % MOD


@lru_cache
def ifactorial(n):
    return pow(factorial(n), MOD-2, MOD)


@lru_cache
def combination(n, k):
    ret = factorial(n) * ifactorial(k)
    ret %= MOD
    ret *= ifactorial(n - k)
    return ret % MOD


k = int(input())
s = input()
MOD = 10**9+7

ans = 0
for i in range(k + 1):
    tmp = combination(i + len(s) - 1, len(s) - 1)
    tmp *= pow(25, i, MOD)
    tmp *= pow(26, k - i, MOD)
    tmp %= MOD
    ans += tmp
    ans %= MOD
print(ans)


### FIXED CODE ###

MOD = 10**9+7

k = int(input())
s = input()
MAX = k + len(s)

factorial = [0] * (MAX + 1)
factorial[0] = 1
for i in range(1, MAX + 1):
    factorial[i] = factorial[i-1] * i % MOD


ifactorial = [0] * (MAX + 1)
ifactorial[MAX] = pow(factorial[MAX], MOD - 2, MOD)
for i in range(MAX, 0, -1):
    ifactorial[i - 1] = ifactorial[i] * i % MOD

pow25 = [1] * (k + 1)
pow26 = [1] * (k + 1)
for i in range(k):
    pow25[i + 1] = pow25[i] * 25
    pow25[i + 1] %= MOD
    pow26[i + 1] = pow26[i] * 26
    pow26[i + 1] %= MOD


def combination(n, k):
    ret = factorial[n] * ifactorial[k] * ifactorial[n - k]
    return ret % MOD


ans = 0
for i in range(k + 1):
    tmp = combination(i + len(s) - 1, len(s) - 1)
    tmp *= pow25[i]
    tmp %= MOD
    # tmp *= pow(25, i, MOD)
    tmp *= pow26[k - i]
    # tmp *= pow(26, k - i, MOD)
    tmp %= MOD
    ans += tmp
    ans %= MOD
print(ans)
dishes = []
serve = []
for i in range(5):
    dish = int(input())
    dishes.append(dish)
    if dish % 10 != 0:
        time = 10 - dish%10
        serve.append(time)
sort_serve = sorted(serve)
sort_serve.remove(sort_serve[len(sort_serve)-1])
ans = sum(dishes) + sum(sort_serve)
print(ans)

### FIXED CODE ###

dishes = []
serve = []
for i in range(5):
    dish = int(input())
    dishes.append(dish)
    if dish % 10 != 0:
        time = 10 - dish%10
        serve.append(time)
if serve == []:
    print(sum(dishes))
else:
    sort_serve = sorted(serve)
    sort_serve.remove(sort_serve[len(sort_serve)-1])
    ans = sum(dishes) + sum(sort_serve)
    print(ans)
n,k = map(int,input().split())
s = list(input())
if s[0] == "1":
    cnt_list = []
else:
    cnt_list = [0]
cnt = 1
for i in range(n-1):
    if s[i] == s[i+1]:
        cnt += 1
    else:
        cnt_list.append(cnt)
        cnt = 1
cnt_list.append(cnt)
if s[-1] == '0':
    cnt_list.append(0)
print(cnt_list)
sum_list = [0]
for i in range(len(cnt_list)):
    sum_list.append(sum_list[i] + cnt_list[i])
left = 0
right = max(len(sum_list)-2*k, 1)
ans = 0
for i in range(0,right,2):
    ans = max(ans,sum_list[i+2*k+1]-sum_list[i])
print(ans)

### FIXED CODE ###

n,k = map(int,input().split())
s = list(input())
if s[0] == "1":
    cnt_list = []
else:
    cnt_list = [0]
cnt = 1
for i in range(n-1):
    if s[i] == s[i+1]:
        cnt += 1
    else:
        cnt_list.append(cnt)
        cnt = 1
cnt_list.append(cnt)
if s[-1] == '0':
    cnt_list.append(0)
#print(cnt_list)
sum_list = [0]
for i in range(len(cnt_list)):
    sum_list.append(sum_list[i] + cnt_list[i])
ans = 0
for i in range(0,len(sum_list),2):
    right = min(i+2*k+1,len(sum_list)-1)
    ans = max(ans,sum_list[right]-sum_list[i])
print(ans)
import numpy as np
import matplotlib.pyplot as plt

def main():
	a = int(input())
	p = int(input())

	tips = a * 3 + p
	pie = int(tips / 2)

	print(pie)

if __name__ == '__main__':
	main()

### FIXED CODE ###

a,p = map(int,input().split())

tips = a * 3 + p
pie = tips // 2

print(pie)
a=int(input())

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

### FIXED CODE ###

a=(input())

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