Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

N = int(input())
E = [tuple(map(int,input().split())) for _ in range(N-1)]
#print(E)
V = [set() for _ in range(N+1)]
for a,b in E:
  V[a].add(b)
  V[b].add(a)
#print(V)
maxc = 0
for v in V:
  maxc = max(maxc,len(v))
#print(maxc)
CM = set(range(1,maxc+1))
CE = {}
for e in E:
  CE[e] = 0
#print(CE)

def dfs(u,t,c):
  CC = CM.copy()
  if t > 0:
    CE[(min(u,t),max(u,t))] = c
    CC.remove(c)
  for v in V[u]:
    if CE[(min(u,v),max(u,v))] == 0:
      dfs(v,u,CC.pop())

dfs(1,0,1)
print(maxc)
for e in E:
  print(CE[e])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

N = int(input())
E = [tuple(map(int,input().split())) for _ in range(N-1)]
#print(E)
V = [set() for _ in range(N+1)]
for a,b in E:
  V[a].add(b)
  V[b].add(a)
#print(V)
maxc = 0
for v in V:
  maxc = max(maxc,len(v))
#print(maxc)
CE = {}
for e in E:
  CE[e] = 0
#print(CE)

def dfs(u,t,c):
  if t > 0:
    CE[(min(u,t),max(u,t))] = c
  cc = c+1
  if cc > maxc:
    cc = 1
  for v in V[u]:
    if CE[(min(u,v),max(u,v))] == 0:
      dfs(v,u,cc)
      cc += 1
      if cc > maxc:
        cc = 1

dfs(1,0,1)
print(maxc)
for e in E:
  print(CE[e])
### BUGGY CODE ###

import math

N, C, K = map(int, input().split())
t_dic = {}
for i in range(N):
    t_num = int(input())
    num = t_dic.get(t_num, 0)
    t_dic[t_num] = num + 1

t_list = t_dic.keys()
removed_man_dic = {}
total_car = 0
for key, value in sorted(t_dic.items(), key=lambda x: x[0]):
    limit = key + K
    limit_num = t_dic[key] - removed_man_dic.get(key, 0)
    if limit_num == 0:
        continue
    car_num = int(math.ceil(limit_num / C))
    total_car += car_num
    passenger = C * car_num
    remaining_seat = passenger - limit_num
    removed_man_dic = {}
    for i in range(key + 1, limit + 1):
        if i not in t_list:
            continue
        num = t_dic.get(i, 0)
        if num <= remaining_seat:
            remaining_seat -= num
            removed_man_dic[i] = num
        else:
            removed_man_dic[i] = remaining_seat
            break

print(total_car)


### FIXED CODE ###

N, C, K = map(int, input().split())
t_sorted = [int(input()) for _ in range(N)]
t_sorted.sort()

car = 0
passenger = 0
target_t, limit = 0, 0
for i, t in enumerate(t_sorted):
    if target_t == 0:
        target_t = t
        limit = t + K
    passenger += 1
    if passenger == C:
        car += 1
        passenger = 0
        target_t = 0
        continue
    if i != N - 1:
        if t_sorted[i + 1] > limit:
            car += 1
            passenger = 0
            target_t = 0
            continue
if passenger > 0:
    car += 1

print(car)
### BUGGY CODE ###

n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
result=0
for i in range(len(a)+1):
    for j in range(len(b)+1):
        if sum(a[:i]) + sum(b[:j]) <= k:
            if result < i+j:
                result=i+j
print(result)

### FIXED CODE ###

import sys
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))

a_=[0]
b_=[0]
tmp = 0
for i in a:
    tmp += i
    a_.append(tmp)
tmp = 0
for i in b:
    tmp += i
    b_.append(tmp)

ans=0
j = m
for i in range(n+1):
    if a_[i] > k:
        continue
    while b_[j] + a_[i] > k:
        j -= 1
    ans = max(ans,i+j)
print(ans)
### BUGGY CODE ###

N = int(input())
n = N
mydict = {}
L = []
cnt = 0

for i in range(2, n+1):
    while n%i == 0:
        n = n/i
        cnt += 1
    if cnt != 0:
        mydict[i] = cnt
    cnt = 0

for i in range(2, N+1):
    if i in mydict:
        for j in range(mydict[i]):
            L.append(i)

print(str(N) + ': ' + ' '.join(map(str, L)))

#print(str(N) + ':', end = '')

#for i in range(2, N+1):
#    if i in mydict:
#        for j in range(mydict[i]):
#            print(' ' + str(i), end='')



### FIXED CODE ###

N = int(input())
n = N
m = N ** 0.5
L = []
i = 3

print(str(N) + ': ', end = '')

while n%2 == 0:
    n = n/2
    L.append(2)

while i <= m:
    while n%i == 0:
        n = n/i
        L.append(i)
    i += 2

if n not in L:
    L.append(int(n))  

if 1 in L:
    L.remove(1)

if len(L) == 0:
    L.append(N)

print(' '.join(map(str, L)))
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
answer = 1
for i in range(len(A)):
    answer *= A[i]

if answer <= 1000000000000000000:
    print(answer)
else:
    print(-1)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
answer = 1
if 0 in A:
    print(0)
    exit()

for i in range(len(A)):
    if len(str(answer)) + len(str(A[i])) <= 20:
        answer *= A[i]
    else:
        print(-1)
        exit()

if answer <= 1000000000000000000:
    print(answer)
else:
    print(-1)
### BUGGY CODE ###

import bisect
n = int(input())
a = [int(input()) for _ in range(n)]
tree = [a[0]]

for i in range(1,n):
  tmpmin = tree[0]
  if a[i] <= tmpmin:
    bisect.insort(tree, a[i])
  else:
    index = bisect.bisect_left(tree, a[i])
    del tree[index - 1]
    bisect.insort(tree, a[i])
  #print(tree)
    
print(len(tree))

    


    
    

### FIXED CODE ###

import bisect
from collections import deque
n = int(input())
a = [int(input()) for _ in range(n)]
tree = deque([]) 
tree.append(a[0])

for a in a[1:]:
  index = bisect.bisect_left(tree, a)
  if index == 0:
    tree.appendleft(a)
  else:
    tree[index-1] = a
print(len(tree))
### BUGGY CODE ###

import math

n = int(input())

start = int(math.sqrt(n)+0.5)

for i in range(start ,n+1):
    if n % i == 0:
        a = i
        b = n // i
        break

print(a + b -2)

### FIXED CODE ###

import math

n = int(input())

start = int(math.sqrt(n)+0.5)
l =[]
for i in range(1,start+1):
    if n % i == 0:
        a = i
        b = n // i
        l.append(a+b-2)

print(min(l))
### BUGGY CODE ###

n,*l = map(int, open(0).read().split())

for i in range(n):
    min = 1001
    min_j = -1
    for j in range(i, n):
        if l[j] < min:
            min = l[j]
            min_j = j
    l[i], l[min_j] = l[min_j], l[i]
    
ans = 0
for i in range(n):
    for j in range(i+1, n):
        big = l[i]+l[j]
        
        if l[i] > l[j]:
            small = l[i] - l[j]
        else:
            small = l[j] - l[i]
        
        ch_max = n
        ch_min = j+1
        
        while ch_min < ch_max:
            ch_i = (ch_min + ch_max) // 2
            if l[ch_i] < big:
                ch_min = ch_i + 1
            else:
                ch_max = ch_i
                
        big_i = ch_max
        
        ch_max = n
        ch_min = j+1
        
        while ch_min < ch_max:
            ch_i = (ch_min + ch_max) // 2
            if l[ch_i] < small:
                ch_min = ch_i + 1
            else:
                ch_max = ch_i
                
        small_i = ch_min
        
        ans += big_i - small_i

        if i < big_i and i >= small_i:
            ans -= 1
        if j < big_i and j >= small_i:
            ans -= 1
                
print(ans)

### FIXED CODE ###

n = int(input())
l = sorted(map(int, input().split()))
 
ans = 0
for i in range(n):
    for j in range(i+1, n):
        big = l[i]+l[j]
    
        ch_max = n
        ch_min = j+1
        
        while ch_min < ch_max:
            ch_i = (ch_min + ch_max) // 2
            if l[ch_i] < big:
                ch_min = ch_i + 1
            else:
                ch_max = ch_i
                
        big_i = ch_max
        
        ans += big_i - (j + 1)
                
print(ans)
### BUGGY CODE ###

from collections import deque
import sys

read = sys.stdin.read
readline = sys.stdin.readline

h, w, k = map(int, readline().split())
x1, y1, x2, y2 = map(int, readline().split())
x1, y1, x2, y2 = x1 - 1, y1 - 1, x2 - 1, y2 - 1

field = [readline() for _ in range(h)]

visited = [[False] * w for _ in range(h)]
costs = [[-1] * w for _ in range(h)]

q = deque([(x1, y1)])
costs[x1][y1] = 0

while q:
    x, y = q.popleft()
    if visited[x][y]:
        continue
    visited[x][y] = True
    for dx, dy in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
        for i in range(1, k + 1):
            px, py = x + dx * i, y + dy * i
            if not(0 <= px < h and 0 <= py < w) or field[px][py] == '@' or visited[px][py]:
                break
            if costs[px][py] == -1 or costs[px][py] > costs[x][y] + 1:
                costs[px][py] = costs[x][y] + 1
                q.append((px, py))

print(costs[x2][y2])


### FIXED CODE ###

from collections import deque
import sys

read = sys.stdin.read
readline = sys.stdin.readline

h, w, k = map(int, readline().split())
x1, y1, x2, y2 = map(int, readline().split())
x1, y1, x2, y2 = x1 - 1, y1 - 1, x2 - 1, y2 - 1

field = [readline() for _ in range(h)]
costs = [[-1] * w for _ in range(h)]

q = deque([(x1, y1)])
costs[x1][y1] = 0

while q:
    x, y = q.popleft()
    for dx, dy in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
        for i in range(1, k + 1):
            px, py = x + dx * i, y + dy * i
            if not(0 <= px < h and 0 <= py < w) or field[px][py] == '@':
                break
            if 0 <= costs[px][py] < costs[x][y] + 1:
                break
            if costs[px][py] == -1:
                q.append((px, py))
            costs[px][py] = costs[x][y] + 1

print(costs[x2][y2])
### BUGGY CODE ###

import numpy as np
N,K=map(int,input().split())
L=np.array([list(map(int, input().split()))]).reshape(-1)
M=0
M_IND=0

for i in range(len(L)-(K-1)):
  tmp = sum(L[i:i+K])
  #print(tmp)
  if M < tmp:
    M = tmp
    M_IND=i
#print(M_IND)
#for k in range(L[M_IND,M_IND+K])
ANS=0
MEMO=[0]*(max(L[M_IND:M_IND+K])+1)
MEMO_MIN=0
for i in L[M_IND:M_IND+K]:
  #print(i)
  ex = 0
  p = 1/i
  if MEMO[i] == 0:
    for x in range(i+1):
        px = p*x
        ex += px
    MEMO[i] = ex
  else:
    ex = MEMO[i]
  ANS += ex
print(ANS)


### FIXED CODE ###

def kitai(n):
  return (int(n)+1)/2

import numpy as np
n,k=map(int,input().split())

L=np.array([list(map(kitai, input().split()))]).reshape(-1)

from itertools import accumulate

acc = [0]+ list(accumulate(L)) # 0を忘れずに
ans = 0
for i in range(n-k+1):
  ans = max(ans,acc[i+k]-acc[i])
print(ans)
### BUGGY CODE ###

n=int(input())
l=list(map(int,input().split()))
l.sort()
chols={}
ansls={}
ans=0
for i in range(n):
  s=l[i]
  st=s//2
  flag=True
  for j in range(ans):
    if s%ansls[j]==0:
      if s==ansls[j]:
        chols[s]=1
      flag=False
      break
    if ansls[j]>st:
      if ansls[ans-1]==s:
        flag=False
        chols[s]=1
      break
  if flag:
    ansls[ans]=s
    ans+=1
de=chols.keys()

print(ans-len(de))

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
l.sort()
p=[1]*(l[-1]+1)
ans=0
for i in range(n):
  a=l[i]
  if p[a]==1:
    b=a
    while a<=l[-1]:
      p[a]=0
      a+=b
    if i<n-1:
      if l[i]==l[i+1]:
        pass
      else:
        ans+=1
    else:
      ans+=1
print(ans)
### BUGGY CODE ###

a,b,c,d = map(int,input().split())
turn = 0
while a > 0 or c > 0:
  if turn%2 == 0:
    c -= b
  else:
    a -= d
print('Yes' if a > 0 else 'No')

### FIXED CODE ###

a,b,c,d = map(int,input().split())
turn = 0
while a > 0 and c > 0:
  if turn%2 == 0:
    c -= b
  else:
    a -= d
  turn += 1
print('Yes' if a > 0 else 'No')
### BUGGY CODE ###

from collections import defaultdict
import sys
input = sys.stdin.readline
inpl = lambda: list(map(int,input().split()))

N, M = inpl()
uv = [ set() for _ in range(N) ]
for _ in range(M):
    u, v = inpl()
    uv[u-1].add(v-1)
S, T = inpl()
S -= 1
T -= 1

cur = set({S})
for i in range(3*N-2):
    if i % 3 == 0 and T in cur:
        print(i//3)
        break
    prev = cur
    cur = set()
    for p in prev:
        cur |= uv[p]
else:
    print(-1)

### FIXED CODE ###

import sys
input = sys.stdin.readline
inpl = lambda: list(map(int,input().split()))

N, M = inpl()
uv = [ set() for _ in range(3*N) ]
vu = [ set() for _ in range(3*N) ]
for _ in range(M):
    u, v = inpl()
    for k in range(3):
        uv[u-1 + k*N].add(v-1 + ((k+1)%3)*N)
        vu[v-1 + ((k+1)%3)*N].add(u-1 + k*N)
S, T = inpl()
S -= 1
T -= 1

cur = set({S})
for i in range(3*N):
    if i % 3 == 0 and T in cur:
        print(i//3)
        break
    elif len(cur) == 0:
        print(-1)
        break
    prev = cur
    cur = set()
    for u in prev:
        for fr in vu[u]:
            uv[fr].remove(u)
        cur |= uv[u]
else:
    print(-1)
### BUGGY CODE ###

import queue
from collections import deque
h,w = map(int,input().split())

#aij = [input() for i in range(h)]

moji = [[0 for i in range(w)] for j in range(h)]

dist = [[-1]*w for _ in range(h)]

for i in range(h):
    aij = input()
    #print(aij)
    for j in range(w):
        moji[i][j] = aij[j]

#moji = aij
#print(moji,aij)
#exit()

#print(aij)
vx = [0,1,0,-1]
vy = [1,0,-1,0]

ans = 0
q = deque()

for i in range(h*w):
    y = i//w
    x = i%w
    #print(i)
    if moji[y][x] == '#':
        q.append(i)
        dist[y][x] = 0

#ans = -1

ans = 0

while q:
    #print(q.qsize())
    tmp = q.popleft()
    y = tmp//w
    x = tmp%w
    d = dist[y][x]
    #print(tmp,num)
    for j in range(4):
        nx = x+vx[j]
        ny = y+vy[j]
        #print(ny,nx)
        if nx < 0 or nx >= w or ny < 0 or ny >= h:
            continue
        if dist[ny][nx] == -1:
            dist[ny][nx] = d+1
            #moji[ny][nx] = '#'
            q.append(ny*w+nx)
    #ans += 1
    ans = max(d,ans)

print(ans)


### FIXED CODE ###

import queue
from collections import deque
h,w = map(int,input().split())

#aij = [input() for i in range(h)]

moji = [[0 for i in range(w)] for j in range(h)]

dist = [[-1]*w for _ in range(h)]

for i in range(h):
    aij = input()
    #print(aij)
    for j in range(w):
        moji[i][j] = aij[j]

#moji = aij
#print(moji,aij)
#exit()

#print(aij)
vx = [0,1,0,-1]
vy = [1,0,-1,0]

ans = 0
q = deque()

for i in range(h*w):
    y = i//w
    x = i%w
    #print(i)
    if moji[y][x] == '#':
        q.append(i)
        dist[y][x] = 0

#ans = -1

ans = 0

while q:
    #print(q.qsize())
    tmp = q.popleft()
    y = tmp//w
    x = tmp%w
    d = dist[y][x]
    #print(tmp,num)
    for j in range(4):
        nx = x+vx[j]
        ny = y+vy[j]
        #print(ny,nx)
        if nx < 0 or nx >= w or ny < 0 or ny >= h:
            continue
        if dist[ny][nx] == -1:
            dist[ny][nx] = d+1
            #moji[ny][nx] = '#'
            q.append(ny*w+nx)
    #ans += 1
    ans = max(d,ans)

print(ans)
### BUGGY CODE ###



def main():


   N = int(input())
   seList = input()
   ans = len(seList)
   tmp = ans

   for i in range(N):
      tmp = seList[:i].count('W')+seList[i:].count('E')
      if tmp < ans:
         ans = tmp
   print(ans)







if __name__== "__main__":
    main() 



### FIXED CODE ###



def main():

   N = int(input())
   seList = input()
   a_seList = []
   ans = len(seList)-1
   reW = seList.count('W')
   reE = seList.count('E')
   if seList[0] == 'W':
      reW -= 1
      a_seList.append(1+reE-reW)
   else:
      reE -= 1
      a_seList.append(-1+reE-reW)
   
   for k,i in enumerate(seList[1:]):
      if i=='W':
         reW -= 1
         a_seList.append(a_seList[k]+1)
      else :
         reE -= 1
         a_seList.append(a_seList[k]-1)
         
   
   leader = a_seList.index(min(a_seList))         
   ans=seList[:leader].count('W')+seList[leader+1:].count('E')
   print(ans)








if __name__== "__main__":
    main()
### BUGGY CODE ###

k=int(input())
s=0
import fractions
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            g=fractions.gcd(fractions.gcd(a,b),c)
            s+=g
print(s)

### FIXED CODE ###

k=int(input())
s=0
import math
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            s+=math.gcd(math.gcd(a,b),c)
print(s)
### BUGGY CODE ###

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

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

gates = [list(map(int, input().split())) for _ in range(m)]

passed = [1 for _ in range(n)]

for card in range(1,n+1):
    for gate in gates:
        if not gate[0] <= card <= gate[1]:
            passed[card-1] = 0
            break

print(sum(passed))


### FIXED CODE ###

import numpy as np
N,M=map(int,input().strip().split())
LR=np.array([list(map(int,input().strip().split())) for _ in range(M)])
print(max(min(LR[:,1])-max(LR[:,0])+1,0))
### BUGGY CODE ###

from scipy.sparse import*;n,*t=map(int,open(0).read().split());b=csgraph.dijkstra;c=csr_matrix(([1]*~-n,(t[::2],t[1::2])),[n+1]*2);print('SFeicrosntd'[b(c,0,b(c,0,1)[1:].argmax()+1)[1:].max()%3!=1::2])

### FIXED CODE ###

from collections import*
def s(s):
  f=[1]*-~n
  f[s]=0
  q=deque([(s,0)])
  while q:
    t,c=q.popleft()
    for v in e[t]:
      if f[v]:
        f[v]=0
        q.append((v,c+1))
  return t,c
n,*t=map(int,open(0).read().split())
e=[[]for _ in range(n+1)]
for a,b in zip(t[::2],t[1::2]):
  e[a].append(b)
  e[b].append(a)
print('SFeicrosntd'[s(s(1)[0])[1]%3!=1::2])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

_n, _t = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(_n)]
AB.sort()


def dp(t, ablist):
    ans = 0
    table = [0] * t
    for a, b in ablist:
        ans = max(ans, max(table) + b)
        if a >= t:
            continue

        rlist = [0] * (t - a)
        for i in range(t - a):
            rlist[i] = max(table[i] + b, table[a + i])

        for i in range(a, t):
            table[i] = rlist[i - a]

    return ans


print(dp(_t, AB))


### FIXED CODE ###

import sys
import numpy as np
input = sys.stdin.readline

_n, _t = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(_n)]
AB.sort()


def dp(t, ablist):
    ans = 0
    table = np.zeros(t, int)
    for a, b in ablist:
        ans = max(ans, max(table) + b)
        np.maximum(table[:-a] + b, table[a:], out=table[a:])

    return ans


print(dp(_t, AB))
### BUGGY CODE ###

def main():
    a, b = input().split(" ")
    i = int(a * int(b))
    j = int(b * int(a))
    numbers = [k for k in range(1, (max(i, j) + 1))]
    i_index = numbers.index(i)
    j_index = numbers.index(j)
    if i_index > j_index:
        print(i)
    else:
        print(j)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    a, b = map(int, input().split(" "))
    if a < b:
        print(str(a) * b)
    else:
        print(str(b) * a)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

colorn = list(map(int, input().split()))
color = colorn[0:3]
n = colorn[-1]
color.sort()

a, b, c = color[2], color[1], color[0]

a_max = n // a
cnt = 0

for i in range(a_max + 1):
    b_max = (n - a * i) // b
    for j in range(b_max + 1):
        c_max = (n - a * i - b * j) // c
        for k in range(c_max, c_max + 2):
            if a * i + b * j + c * k == n:
                cnt += 1
            elif a * i + b * j + c * k > n:
                break     
print(cnt)

### FIXED CODE ###

colorn = list(map(int, input().split()))
color = colorn[0:3]
n = colorn[-1]
color.sort()

a, b, c = color[2], color[1], color[0]

a_max = n // a
cnt = 0
ip, jp, kp = -1, -1, -1

for i in range(a_max + 1):
    b_max = (n - a * i) // b
    d = n - a * i
    flag = 0
    for j in range(b_max + 1):
        c_max = (n - a * i - b * j) // c
        for k in range(c_max, c_max + 2):
            if a * i + b * j + c * k == n:
                cnt += 1
                if ip == i:
                    dj = j - jp
                    cnt += ((d // b - j) // dj)
                    flag = 1
                    break
                else:
                    ip, jp, kp = i, j, k
            elif a * i + b * j + c * k > n:
                break
        if flag == 1:
            break
print(cnt)
### BUGGY CODE ###

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7

fac = [1, 1]     # 元テーブル

def prepare(n, mod):
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)

def modcmb(n, r, mod):
    if n < 0 or r < 0:
        return 0
    if r > n:
        return 0

    return fac[n] * pow(fac[r], MOD-2, MOD) * pow(fac[n-r], MOD-2, MOD) % mod


def main():
    K = int(readline())
    S = readline().strip()
    N = len(S)

    prepare(N + K + 10, MOD)

    ans = 0
    for i in range(K+1):
        ans += modcmb(N-1+i, i, MOD) * pow(25, i, MOD) * pow(26, K-i, MOD) % MOD
        ans %= MOD

    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7

fac = [1, 1]     # 元テーブル
f_inv = [1, 1]   # 逆元テーブル
inv = [0, 1]     # 逆元テーブル計算用テーブル

def prepare(n, mod):
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod//i)) % mod)
        f_inv.append((f_inv[-1] * inv[-1]) % mod)

def modcmb(n, r, mod):
    if n < 0 or r < 0:
        return 0
    if r > n:
        return 0

    return fac[n] * f_inv[r] * f_inv[n-r] % mod


def main():
    K = int(readline())
    S = readline().strip()
    N = len(S)

    prepare(N + K + 10, MOD)

    ans = 0
    for i in range(K+1):
        ans += modcmb(N-1+i, i, MOD) * pow(25, i, MOD) * pow(26, K-i, MOD) % MOD
        ans %= MOD

    print(ans)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

s=input()
n=len(s)

ss=s

def change(x):
    if x=="0":
        ans="1"
    else:
        ans="0"
    return ans

count_1=0
#1枚目をそのまま使う
for i in range(1,n):
    if s[i-1]==s[i]:
        if i!=n-1:
            s=s[:i]+change(s[i])+s[i+1:]
        else:
            s=s[:i]+change(s[i])
        count_1+=1

count_2=1
ss=change(ss[0])+ss[1:]
for i in range(1,n):
    if ss[i-1]==ss[i]:
        if i!=n-1:
            ss=ss[:i]+change(ss[i])+ss[i+1:]
        else:
            ss=ss[:i]+change(ss[i])
        count_2+=1

if count_1>count_2:
    print(count_2)
else:
    print(count_1)


### FIXED CODE ###

s=input()
n=len(s)

s1=s[0]
count_1=0
#1枚目をそのまま使う
for i in range(1,n):
    if i%2==0:
        if s[i]!=s1:
            count_1+=1
    else:
        if s[i]==s1:
            count_1+=1

count_2=1
for i in range(1,n):
    if i%2==0:
        if s[i]==s1:
            count_2+=1
    else:
        if s[i]!=s1:
            count_2+=1

if count_1>count_2:
    print(count_2)
else:
    print(count_1)
### BUGGY CODE ###

N = int(input())
ans = 0
for i in range(1, N+1):
    for j in range(1, i+1):
        if i%j==0:
            ans+=i
print(ans)


### FIXED CODE ###

N = int(input())
ans = 0
for X in range(1, N+1):
  Y = N // X
  ans += Y * (Y + 1) // 2 * X
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000000)
NQ = input().split(' ')
N = int(NQ[0])
Q = int(NQ[1])
candidate_list = []
tree_list = [[]] * N
out_put_list = [0] * N
def f(p,x):
    out_put_list[p] += x
    for idx in tree_list[p]:
        f(idx,x)

for i in range(N-1):
    ab = input().split(' ')
    a = int(ab[0])
    b = int(ab[1])
    tree_list[a-1] = tree_list[a-1] + [b-1]

for _ in range(Q):
    px = input().split(' ')
    p = int(px[0])
    x = int(px[1])
    f(p-1,x)

print(*out_put_list)

### FIXED CODE ###


NQ = input().split(' ')
N = int(NQ[0])
Q = int(NQ[1])
out_put_list = [0] * N
tree_list = {}
for i in range(N):
    tree_list[i] = []

for i in range(N-1):
    ab = input().split(' ')
    a = int(ab[0]) -1
    b = int(ab[1]) -1
    tree_list[a].append(b)

for _ in range(Q):
    px = input().split(' ')
    p = int(px[0])
    x = int(px[1])
    out_put_list[p-1] += x

for i in range(len(tree_list)):
    for num in tree_list[i]:
        out_put_list[num] += out_put_list[i]

print(*out_put_list)
### BUGGY CODE ###

num_all = int(input())
list = input().split(" ")

i = 1
while i <= num_all:
  data = list.count(str(i))
  #print(i)
  print(data)
  i = i+1

### FIXED CODE ###

n=int(input())
#l=list(map(int,input().split()))  #inputした数値列をintにしてlistを作成 けどなぜか使えない
list = input().split(" ")
list_int = []
for i in list:
  list_int.append(int(i)) 
k = [0]*n                         #大きさnのリスト
for i in list_int:
  k[i-1] = k[i-1]+1
for j in range(n):
  print(k[j])