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

import sys
import heapq
from collections import Counter
import numpy as np

n = int(input())
a_s = [int(i) for i in sys.stdin.readline().split()]
a_s.sort()
ct = Counter(a_s)
cnt = 0
res = np.zeros(10**6+1)
for a in a_s:
    if res[a] == 1:
        cnt += 1
    elif ct[a] > 1:
        cnt += 1
    res[::a] = 1

print(n - cnt)

### FIXED CODE ###

import sys
import heapq
from collections import Counter
from math import sqrt

n = int(input())
a_s = [int(i) for i in sys.stdin.readline().split()]
a_s.sort()
_max = max(a_s)
ct = Counter(a_s)
cnt = 0
ls = [False] * (10**6+1)
for a in a_s:
    if ls[a]:
        cnt += 1
        continue
    elif ct[a] > 1:
        cnt += 1
    for i in range(a, _max+1, a):
        if ls[i]:
            continue
        if i % a == 0:
            ls[i] = True

print(n - cnt)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
if A[0] == 1:
  print("-1")
  quit()

if N == 2:
  if A[0] < A[1]:
    print("-1")
    quit()
  elif (A[0] + A[1]) % 2 == 1:
    print("-1")
    quit()
  else:
    half = (A[0] + A[1]) // 2
    print(int(A[0] - half))
    quit()

now = 0
for i in range(N):
  now = now ^ A[i]

if now == 0:
  print("-1")
else:
  a = A[0] ^ A[1]
  b = a ^ now
  T = True
  i = 0
  while T:
    now2 = (A[0] - i) ^ (A[1] + i)
    #print(now2, A[0] - i, A[1] + i, b)
    if not (now2 ^ b):
      print(i)
      quit()
    
    i += 1
    if (A[0] - i) < 0:
      T = False
      print("-1")
    
    
 

### FIXED CODE ###

#解説方針
import math
N = int(input())
A = list(map(int, input().split()))

all_xor = 0
for i in range(N):
  all_xor = all_xor ^ A[i]

fore = A[0] ^ A[1]#S
back = fore ^ all_xor #X
#a + b = (a xor b) + 2 * (a and b)
#a xor b = back, a + b = A[0] + A[1]

a_and_b = (A[0] + A[1] - back) / 2
#print(a_and_b, back)
#a_and_bは非負整数である必要がある
if (a_and_b % 1 != 0) or (a_and_b < 0):
  print(-1)
  quit()
a_and_b = int(a_and_b)

#print(a_and_b, back, a_and_b & back)
#a_and_bとbackには共通のbitがない
if (a_and_b & back) != 0:
  print(-1)
  quit()

ans = a_and_b
#print(math.log2(32))
if back == 0:
  if (ans == 0):
    print(-1)
  else:
    print(A[0] - ans)
  quit()
else:
  if ans > A[0]:
    print(-1)
    quit()
  nn = int(math.log2(back)) + 1
  #print(nn)
  #print(2 >> 1)
  #print(2 << 1)
  for i in range(nn + 1):
    #print(back, nn - i)
    if ((back >> (nn - i)) & 1):
      #print(ans, 2 << (nn - i))
      k = ans + (1 << (nn - i))
      #print("k", k, i)
      if k <= A[0]:
        ans = k 
  if (ans == 0):
    print(-1)
  else:
    print(A[0] - ans)
### BUGGY CODE ###

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

for i in range(N):
    tmp = A[i]
    A[i] = 0
    print(max(A))
    A[i] = tmp

### FIXED CODE ###

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

first = A2[-1]
second = A2[-2]

for i in range(N):
    if A[i] == first:
        print(second)
    else:
        print(first)
### BUGGY CODE ###

import fractions
from functools import reduce

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

if __name__ == '__main__':
  n = int(input())
  a_lst = [int(elem) for elem in input().split()]  
  res_lst = []
  for i, a in enumerate(a_lst):
    new_lst = list(a_lst)
    new_lst.pop(i)
    res = gcd_list(new_lst)
    res_lst.append(res)
  print(max(res_lst))

### FIXED CODE ###

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

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

left_gcd = [0]*(n+1)
right_gcd = [0]*(n+1)
left_gcd[1] = a[0]
right_gcd[1] = a[-1]

for i in range(1,n):
    left_gcd[i+1] = gcd(left_gcd[i],a[i])
    right_gcd[i+1] = gcd(right_gcd[i],a[-1-i])

ans = right_gcd[n-1]
for i in range(n):
    ans = max(ans,gcd(left_gcd[i],right_gcd[n-1-i]))
print(ans)
### BUGGY CODE ###

n = int(input())
arr = list(map(int, input().split()))

ans = 1
for x in arr:
    ans *= x

if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

n = int(input())
arr = list(map(int, input().split()))

ans = 1

for x in arr:
    if x == 0:
        ans = 0

if ans == 0:
    print(ans)
else:
    for x in arr:
        ans *= x
        if ans > 1000000000000000000:
            break
    if ans > 1000000000000000000:
        print(-1)
    else:
        print(ans)
### BUGGY CODE ###

N,Q = map(int,input().split())
line = list(input())
count_s = []
for i in range(Q):
    l,r = map(int,input().split())
    count = 0
    for i in range(l-1,r-1):
        if line[i] == 'A' and line[i+1] == 'C':
            count += 1
    count_s.append(count)
for c in count_s:
    print(c)

### FIXED CODE ###

N,Q = map(int,input().split())
S = input()
AC_cnt = [0] * N
for i in range(N-1):
  if S[i] == 'A' and  S[i+1] == 'C':
    AC_cnt[i+1] = AC_cnt[i] + 1
  else:
    AC_cnt[i+1] = AC_cnt[i]

for i in range(Q):
  begin, end = map(int,input().split())
  print(AC_cnt[end-1]-AC_cnt[begin-1])
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort()
p = 10**9 + 7
total = 0
for i in range(60):
    cnt_1, cnt_0 = 0, 0
    for j in range(N):
        if (A[j]>>i)&1:
            cnt_1 += 1
        else:
            cnt_0 += 1
    total += 2**i * cnt_0 * cnt_1
print(total%p)

### FIXED CODE ###

import sys
input = sys.stdin.readline
def main():

    N = int(input())
    A = list(map(int, input().split()))
    p = 10**9 + 7
    total = 0
    for i in range(60):
        cnt_1, cnt_0 = 0, 0
        for j in range(N):
            if (A[j]>>i)&1:
                cnt_1 += 1
            else:
                cnt_0 += 1
        total += pow(2, i, p) * cnt_0 * cnt_1 %p
    print(total%p)
main()
### BUGGY CODE ###

k,s = input().strip().split(' ')
k,s = [int(k),int(s)]
cnt = 0
for i in range(k+1):
	if i>s:	
		break;
	for j in range(k+1):
		if i+j>s:
			break;
		for l in range(k+1):			
			if i+j+l==s:
				cnt+=1
			elif i+j+l>s:
				break;		
print (cnt)

### FIXED CODE ###

k,s = input().strip().split(' ')
k,s = [int(k),int(s)]
cnt = 0
for i in range(k+1):
	if i>s:	
		break;
	for j in range(k+1):
		if i+j>s:
			break;
		elif s-i-j<=k:
			cnt+=1
print (cnt)
### BUGGY CODE ###

n, k, q = map(int,input().split())
List = [k for i in range(n)]
for _ in range(q):
  a = int(input())
  List[a-1] += 1
  List = [s -1 for s in List]

for t in range(n):
  if List[t] >=1:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

n, k, q = map(int,input().split())
List = [k for i in range(n)]
counter = 0
for _ in range(q):
  a = int(input())
  List[a-1] += 1
  counter -= 1

List = [s+counter for s in List]

for t in range(n):
  if List[t] >=1:
    print('Yes')
  else:
    print('No')
### BUGGY CODE ###

X = list(input())

q_num = X.count("?")
a_num = 0
c_num = X.count("C")
left_q_num = 0
right_q_num = q_num
# ある値を軸に その左にあるaの数 * (3 のはてなの数上)  + ?の数
# a_num
# left_q_num
# right_q_num
# c_num
ans = 0
if X[0] == "?":
    right_q_num -= 1
elif X[0] == "C":
    c_num -= 1
for i, x in enumerate(X):
    if x == "B" or x == "?":
        ans += (a_num * c_num)  * (3 ** (left_q_num + right_q_num))
        if left_q_num + right_q_num != 0:
            ans += (left_q_num * c_num ) * (3 ** (left_q_num + right_q_num - 1))
            ans += (right_q_num * a_num) * (3 ** (left_q_num + right_q_num - 1))
        if left_q_num + right_q_num >= 2:
            ans += (right_q_num * left_q_num) * (3 ** (left_q_num + right_q_num - 2))
    #print("i", i)
    #print(ans)    
    #print(a_num)
    if  i == len(X) - 1:
        break
    if x == "A":
        a_num += 1
    elif x == "?":
        left_q_num += 1
    if X[i + 1] == "C":
        c_num -= 1
    elif X[i + 1] == "?":
        right_q_num -= 1

print(ans % (10 ** 9 + 7))



### FIXED CODE ###

X = list(input())

q_num = X.count("?")
a_num = 0
c_num = X.count("C")
left_q_num = 0
right_q_num = q_num
ans = 0
len_x = len(X)
q_dict = []
b_ans = 0
q_ans = 0
q_dict = {}
q_dict[q_num - 1] = (3 ** (q_num - 1)) % (10 ** 9 + 7)
q_dict[q_num - 2] = (3 ** (q_num - 2)) % (10 ** 9 + 7)
q_dict[q_num - 3] = (3 ** (q_num - 3)) % (10 ** 9 + 7)
q_dict[q_num] = (3 ** (q_num)) % (10 ** 9 + 7)

if X[0] == "?":
    right_q_num -= 1
elif X[0] == "C":
    c_num -= 1
for i, x in enumerate(X):
    if x == "B" or x == "?":
        ans += (a_num * c_num)  * (q_dict[(left_q_num + right_q_num)])
        if left_q_num + right_q_num >= 2:
            ans += (right_q_num * left_q_num  + 3*(left_q_num * c_num) + 3*(right_q_num * a_num)) * (q_dict[(left_q_num + right_q_num - 2)])
        elif left_q_num + right_q_num == 1:
            ans += ((left_q_num * c_num) + (right_q_num * a_num)) * (q_dict[(left_q_num + right_q_num - 1)])
        ans = ans % (10 ** 9 + 7)
    if  i == len_x - 1:
        break
    if x == "A":
        a_num += 1
    elif x == "?":
        left_q_num += 1
    if X[i + 1] == "C":
        c_num -= 1
    elif X[i + 1] == "?":
        right_q_num -= 1

print(ans % (10 ** 9 + 7))
### BUGGY CODE ###

n, k = map(int , input().split())
hn = [int(num) for num in input().split()]

hn.sort(reverse = True)
for i in range(k):
  if len(hn) > 0:
    hn.pop(0)
    
print(sum(hn))

### FIXED CODE ###

n, k = map(int , input().split())
hn = [int(num) for num in input().split()]

hn.sort(reverse = True)
if len(hn) > k:
  print(sum(hn[k:]))
else :
  print(0)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = 1
for i in range (0, N):
  ans *= A[i]
if ans > 10 ** 18:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = 1
for i in range (0, N):
	if A[i] == 0:
		ans = 0
		break
	else:
		if ans > 0:
			ans *= A[i]
		if ans > 10 ** 18:
			ans = -1

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

import bisect

s = input()
k = int(input())

alpha_list = [chr(i) for i in range(97, 97+26)] #["a","b",...."c"]
dic = []
for i in range(len(s)):
    dic = sorted(dic)
    if k < bisect.bisect_left(dic,s[i]):
        continue
    for j in range(i+1, len(s)+1):
        s0 = s[i:j]
        if s0 not in dic:
            dic.append(s0)

print(sorted(dic)[k-1])

### FIXED CODE ###

import bisect

s = input()
k = int(input())

alpha_list = [chr(i) for i in range(97, 97+26)] #["a","b",...."c"]
dic = []
for i in range(len(s)):
    dic = sorted(dic)
    if k < bisect.bisect_left(dic,s[i]):
        continue
    for j in range(i+1, min(i+6, len(s)+1)):
        s0 = s[i:j]
        
        if s0 not in dic:
            dic.append(s0)

print(sorted(dic)[k-1])
### BUGGY CODE ###

n = int(input())
s = [input() for i in range(n)]
dist = set(s)
dic = {}
ans = []
[dic.update({i: s.count(i)}) for i in dist]
max_num = max(dic.values())
[ans.append(i) for i in dic if dic[i] == max_num]
for i in sorted(ans):
    print(i)

### FIXED CODE ###

from collections import Counter
n = int(input())
s = sorted([input() for i in range(n)])

counter = Counter(s)
max_num = max(counter.values())
ans_list = [i for i in counter if counter[i] == max_num]
for i in sorted(ans_list):
    print(i)
### BUGGY CODE ###

n = int(input())

c, s, f = [], [], []
for _ in range(n-1):
    x,y,z = map(int,input().split())
    c.append(x)
    s.append(y)
    f.append(z)

anss =[]
for i in range(n-1):
    tmp = 0
    for j in range(i, n-1):
        for k in range(10**8):
            if tmp <= s[j] + f[j] * k:
                tmp = s[j] + f[j] * k + c[j]
                break
    else:
        anss.append(tmp)
else:
    anss += [0]

for ans in anss:
    print(ans)

### FIXED CODE ###

n = int(input())

c, s, f = [], [], []
for _ in range(n-1):
    x,y,z = map(int,input().split())
    c.append(x)
    s.append(y)
    f.append(z)

anss =[]
for i in range(n-1):
    tmp = 0
    for j in range(i, n-1):
        k = 0
        while 1:
            if tmp <= s[j] + f[j] * k:
                tmp = s[j] + f[j] * k + c[j]
                break
            else:
                k += 1
    else:
        anss.append(tmp)
else:
    anss += [0]

for ans in anss:
    print(ans)
### BUGGY CODE ###

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

b = [0]*200000
c = []
ans = 0

for x in a:
    b[x-1] += 1

for x in b:
    if x > 0:
        c.append(x)

c.sort()

while len(c) > k:
    ans += c[0]
    c.pop(0)

print(ans)

### FIXED CODE ###

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

b = [0]*200000
c = []
ans = 0

for x in a:
    b[x-1] += 1

for x in b:
    if x > 0:
        c.append(x)

c.sort()

y = len(c) - k

if y > 0:
    ans = sum(c[:y])

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

N = int(input())
A = list(map(int, input().split()))
A.reverse()
sum = 0
check = []
num = []
sub = []
a = subb = 0
for i in range(1, N):
    sub_sum = 0
    if A[i] in check:
        a = check.index(A[i])
        for j in range(num[a], i):
            sub_sum += A[i] ^ A[j]
        subb = sub_sum + sub[a]
        sum += subb
        sub[a] = subb
    else:
        check.append(A[i])
        num.append(i)
        for j in range(i):
            sub_sum += A[i] ^ A[j]
        sum += sub_sum
        sub.append(sub_sum)
print(sum%1000000007)

### FIXED CODE ###

import numpy as np
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

ans = 0
twopow = 1
for n in range(60):
    tmp = A & 1
    one = np.count_nonzero(tmp)
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    A >>= 1
    twopow = twopow << 1 % MOD

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

from collections import deque

U, D, L, R = (-1, 0), (+1, 0), (0, -1), (0, +1)

is_good = lambda x, y, R, C: True if x < R and x >= 0 and y < C and y >= 0 else False


def traverse(grid, start, end):
  d = deque([(start, 0)])
  visited = set()
  while d:
    node, path = d.popleft()
    if node == end:
      break
    cx, cy = node
    for dx, dy in U, D, L, R:
      if is_good(cx + dx, cy + dy, len(grid), len(grid[0])) and grid[cx + dx][cy + dy] != '#' and (cx + dx, cy + dy) not in visited:
        nx, ny = cx + dx, cy + dy
        visited.add((nx, ny))
        d.append([(nx, ny), path+1])
  #print(start, end, path)
  return path


def bfs():
  R, C = tuple(map(int, input().split()))
  grid =[list(input()) for _ in range(R)]
  answer = 0
  for row in range(R):
    for col in range(C):
      if grid[row][col] != '#':
        start = (row, col)
      for rw in range(R):
        for cl in range(C):
          if grid[row][col] != '#':
            end = (rw, cl)
            answer = max(answer, traverse(grid, start, end))
  return answer


print(bfs())

### FIXED CODE ###

from collections import deque

U, D, L, R = (-1, 0), (+1, 0), (0, -1), (0, +1)

is_good = lambda x, y, R, C: True if x < R and x >= 0 and y < C and y >= 0 else False


def traverse(grid, start, distance_grid):
  d = deque([(start, 0)])
  tx, ty = start
  distance_grid[tx][ty] = 0
  #print(distance_grid)
  dis = 0
  visited = set([start])
  while d:
    node, path = d.popleft()
    cx, cy = node
    for dx, dy in U, D, L, R:
      if is_good(cx + dx, cy + dy, len(grid), len(grid[0])) and grid[cx + dx][cy + dy] != '#' and (cx + dx, cy + dy) not in visited:
        nx, ny = cx + dx, cy + dy
        visited.add((nx, ny))
        d.append([(nx, ny), path+1])
        distance_grid[nx][ny] = distance_grid[cx][cy]+1
  #print(distance_grid)
  for arr in distance_grid:
    dis = max(dis, max(arr))
  return dis

from copy import deepcopy

def bfs():
  R, C = tuple(map(int, input().split()))
  grid =[list(input()) for _ in range(R)]
  temp = [[-1 for _ in range(C)] for _ in range(R)]
  #print(grid)
  answer = 0
  for row in range(R):
    for col in range(C):
      if grid[row][col] != '#':
        start = (row, col)
        distance_grid = deepcopy(temp)
        answer = max(answer, traverse(grid, start, distance_grid))
  return answer


print(bfs())
### BUGGY CODE ###

n=int(input())
p=[]
total=0
for i in range(n,0,-1):
    p.append(i)
p.reverse()
for i in range(1,n):
    total+=i%p[i]
print(total)



### FIXED CODE ###

n=int(input())
print(n*(n-1)//2)
### BUGGY CODE ###

n = int(input())
a = [int(x) for x in input().split()]
c = 0
for i in range(n):
    for j in range(i - 1):
        if i - j == abs(a[i] + a[j]):
            c += 1
print(c)


### FIXED CODE ###

n = int(input())
l = {}
r = {}
xc = 0
for x in input().split():
    xi = int(x)
    lx = xc + xi
    if lx in l:
        l[lx] += 1
    else:
        l[lx] = 1
    rx = xc - xi
    if rx in r:
        r[rx] += 1
    else:
        r[rx] = 1
    xc += 1
c = 0
for x in l:
    if x in r:
        c += l[x] * r[x]
print(c)
### BUGGY CODE ###

input()
vals = map(int, input().split())
count = 0
start_val = sum(vals)
while True:
    if start_val % 2 == 1:
        break
    count += 1
print (count)

### FIXED CODE ###

N = int(input())
vals = list(map(int, input().split()))
count = 0
is_odd = False
while True:
    for i in range(0, N):
        if vals[i] % 2 == 1:
            is_odd = True
        vals[i] /= 2
    if is_odd:
        break
    count += 1
print (count)
### BUGGY CODE ###

def main():
    N = int(input())
    A = list(map(int,input().split()))

    count = 0
    flag = False

    '''
    for i in A:
        if(A.count(i) > 1):
            flag = True
            break

    if(flag):
        print('NO')
    else:
        print('YES')
    '''

    for i in A:
        for j in A:
            if(i == j):
                count += 1
            if(count > 1):
                flag = True
                break
        count = 0

        if(flag):
            break

    if(flag):
        print('NO')
    else:
        print('YES')

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    N = int(input())
    A = list(map(int,input().split()))

    count = 0
    flag = False

    set_A = set(A)

    if(len(set_A) == len(A)):
        print('YES')
    else:
        print('NO')
        
    '''
    for i in A:
        if(A.count(i) > 1):
            flag = True
            break

    if(flag):
        print('NO')
    else:
        print('YES')
    '''

'''
    for i in A:
        for j in A:
            if(i == j):
                count += 1
            if(count > 1):
                flag = True
                break
        count = 0

        if(flag):
            break

    if(flag):
        print('NO')
    else:
        print('YES')
        '''

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

import sys
input=sys.stdin.readline
n=int(input())
a=input().split()
ans=''
for i in range(n):
    if n%2==0:
        if i%2!=0:
            if i==1:
                ans=a[i]+ans
            else:
                ans=a[i]+' '+ans
        else:
            ans+=' '+a[i]
    else:
        if i%2==0:
            if i==0:
                ans=a[i]+ans
            else:
                ans=a[i]+' '+ans
        else:
            ans+=' '+a[i]
if n==1:
    ans=a[0]
print(ans)

### FIXED CODE ###

import sys
input=sys.stdin.readline
n=int(input())
a=input().split()
ans=[]

for i in range(n):
    if n%2==0:
        if i%2==0:
            ans.append(a[i])
    else:
        if i%2!=0:
            ans.append(a[i])
ans=ans[::-1]
for i in range(n):
    if n%2==0:
        if i%2!=0:
            ans.append(a[i])
    else:
        if i%2==0:
            ans.append(a[i]) 
ans=ans[::-1]
ans=' '.join(ans)
if n==1:
    ans=a[0]
'''
for j in range(n):
    ans.insert(0,a[j])
'''
print(ans)
### BUGGY CODE ###

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

n = input()
list = []
for i in xrange(n):
    command = raw_input().split()
    if command[0] == "insert":
        list.insert(0, command[1])
    elif command[0] == "delete":
        if command[1] in list:
            list.remove(command[1])
    elif command[0] == "deleteFirst":
        list.pop(0)
    elif command[0] == "deleteLast":
        list.pop()
        
print " ".join(list)

### FIXED CODE ###

# -*- coding: utf-8 -*-
n = input()
l = []
tail = 0
for i in xrange(n):
    cmd = raw_input().split()
    if cmd[0] == "insert":
        l.append(cmd[1])
    elif cmd[0] == "delete":
        try:
            l.pop(len(l) - l[::-1].index(cmd[1]) -1)
        except ValueError:
            pass
    elif cmd[0] == "deleteFirst":
        l.pop()
    elif cmd[0] == "deleteLast":
        tail += 1

print " ".join(l[tail:][::-1])
### BUGGY CODE ###

def C(n, r):
    global MOD
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % MOD
    

K = int(input())
S = input()
N = len(S)

MOD = 10 ** 9 + 7
ans = 0

fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, K + N + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)

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




### FIXED CODE ###

def C(n, r):
    global MOD
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % MOD
    

K = int(input())
S = input()
N = len(S)

MOD = 10 ** 9 + 7
ans = 0

fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, K + N + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)

for i in range(0, K + 1):
    ans += C(i + N - 1, N - 1) * pow(25, i, MOD) * pow(26, K - i, MOD)
    ans %= MOD
print(ans)
### BUGGY CODE ###

N,M = map(int,input().split())
if N > M//2+1:
    print(1)
else:
    maxa = 1
    for i in range(N,M//2+1):
        if M%i == 0:
            maxa = M//i
            break
    print(maxa)

### FIXED CODE ###

N,M = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
div = sorted(make_divisors(M))
div = [i for i in div if M//i >= N]
print(div[-1])
### BUGGY CODE ###

D,G=map(int,raw_input().split())
G=G/100

P=[map(int,raw_input().split()) for i in range(D)]

S=10**5+100
#S=30

dp=[ [ float("inf") for i in range(S)]  for j in range(D) ] 
a=P[0][0]
b=P[0][1]/100

for i in range(a+1):
	if i==a: dp[0][i+b]=i
	else: dp[0][i]=i

for j in range(D): dp[j][0]=0


for i in range(1,D):
	a=P[i][0]
	b=P[i][1]/100


	for s in range(S):
		for k in range(1,a):
			if s-(k*(i+1)) >=0:
				dp[i][s]=min( dp[i-1][s-(k*(i+1))]+k, dp[i-1][s] )
		if s-( a*(i+1)+b )>=0:
			dp[i][s]=min( dp[i-1][s-( a*(i+1)+b ) ]+a, dp[i-1][s] )


ans=float("inf")
for i in range(G,S):
	ans=min(ans,dp[D-1][i] )

print ans


### FIXED CODE ###

D,G=map(int,raw_input().split())

A=[map(int,raw_input().split()) for i in range(D)]

N=1000
dp=[ [ float("-inf") for i in range(N+100)]  for j in range(D) ] 

p=A[0][0]
c=A[0][1]


for i in range(1,p+1):
	if i==p: dp[0][i]=i*100+c
	else: dp[0][i]=i*100

for i in range(D):
	dp[i][0]=0



for k in range(1,D):
	p=A[k][0]    # number of problems per line
	c=A[k][1]    # bonus

	for i in range(N):		         #dp[k][i]
		for j in range(1,p+1):    #number of problems per line
			dp[k][i+j]=max( dp[k][i+j], dp[k-1][i]+j*(k+1)*100, dp[k-1][i+j] )
		dp[k][i+j]=max( dp[k][i+j], dp[k-1][i]+j*(k+1)*100+c,dp[k-1][i+j] )



for idx,i in enumerate(dp[D-1]):
	if i>=G:
		print idx
		quit()
### BUGGY CODE ###

if __name__ == '__main__':
    s = input()
    K = int(input())

    subs = []
    for i in range(len(s)):
        for j in range(len(s)):
            try:
                subs.append(s[i:i+j+1])
            except:
                break
    subs = set(subs)
    print(sorted(list(subs))[K-1])

### FIXED CODE ###

if __name__ == '__main__':
    s = input()
    K = int(input())

    subs = []
    for i in range(len(s)):
      for j in range(K):
            try:
                subs.append(s[i:i+j+1])
            except:
                break
    subs = set(subs)
    print(sorted(list(subs))[K-1])