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

import collections
N = int(input())
A = []
for i in range(N):
  A.append(int(input()))

ans = 0
for i in set(A):
  if A.count(i) % 2 != 0:
    ans += 1

print(ans)

### FIXED CODE ###

import collections
N = int(input())
A = [int(input()) for _ in range(N)]
count = collections.Counter(A)

l = []
for i in list(count):
  if count[i] % 2 != 0:
    l.append(count[i])

print(len(l))
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    b.append(a[i])
    b.reverse()
map_b=map(str,b)
v=" ".join(map_b)
print(v)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a.reverse()
ans=[]
re_ans=[]
if n==1:
    print(a[0])
else:
    ans=a[::2]
    re_ans=a[1::2]
    re_ans.reverse()
    ans.extend(re_ans)
    map_ans=map(str,ans)
    v=" ".join(map_ans)
    print(v)
### BUGGY CODE ###

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

d = []
for i in range(n):
    lst = [0 for _ in range(n)]
    temp = i+1
    umeru = 1
    while temp <= n-1:
        lst[temp] = umeru
        umeru += 1
        temp += 1
    temp = i-1
    umeru = 1
    while temp >= 0:
        lst[temp] = umeru
        umeru += 1
        temp -= 1
    d.append(lst)

d[x-1][y-1] = 1
d[y-1][x-1] = 1

lst = [x-1, y-1]
for k in lst:
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j],d[i][k] + d[k][j])

ans = [0 for _ in range(n)]
for i in range(n):
    for j in range(i+1, n):
        ans[d[i][j]] += 1

for i in range(1, n):
    print(ans[i])

### FIXED CODE ###

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

d = []
for i in range(n):
    lst = [0 for _ in range(n)]
    temp = i+1
    umeru = 1
    while temp <= n-1:
        lst[temp] = umeru
        umeru += 1
        temp += 1
    temp = i-1
    umeru = 1
    while temp >= 0:
        lst[temp] = umeru
        umeru += 1
        temp -= 1
    d.append(lst)

d[x-1][y-1] = 1
d[y-1][x-1] = 1

lst = [x-1, y-1]
for k in lst:
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j],d[i][k] + d[k][j])

ans = [0 for _ in range(n)]
for i in range(n):
    for j in range(i+1, n):
        ans[d[i][j]] += 1

for i in range(1, n):
    print(ans[i])
### BUGGY CODE ###

H, W = map(int, input().split())
X = [[[0, 1][a=="#"] for a in input()] for i in range(H)]
def r(X):
    Y = [[0 for x in range(len(X))] for xx in range(len(X[0]))]
    for i in range(len(X[0])):
        for j in range(len(X)):
            # print(i,j)
            Y[i][j] = X[len(X)-j-1][i]
    return Y
    
    
c = 0
for t in range(4):
    X = r(X)
    for i in range(len(X)):
        for j in range(len(X[0])):
            if X[i][j] > 0:
                for n in range(1, min(i+1, len(X[0])-j)):
                    if i-n >= 0 and i-n < len(X) and j+n >= 0 and j+n < len(X[0]):
                        if X[i-n][j+n] > 0:
                            for m in range(n):
                                if i-n-m >= 0 and i-n-m < len(X) and j-n+m >= 0 and j-n+m < len(X[0]):
                                    if X[i-n-m][j-n+m] > 0:
                                        #print (i,j,n,m, "get1")
                                        c += 1
print (c)

### FIXED CODE ###

H, W = map(int, input().split())
I = [input() for _ in range(H)]
X = [[[0, 1][a=="#"] for a in inp] for inp in I]
k = 32
def r():
    global H, W, I
    I = ["".join([I[H - 1 - j][i] for j in range(H)]) for i in range(W)]
    H, W = W, H
def st1(s):
    return int(s.replace("#", "1" * k).replace(".", "0" * k), 2)
def st2(s):
    return int(s.replace("#", "0" * (k - 1) + "1").replace(".", "0" * k), 2)
def getsum(x):
    for i in range(8):
        x += x >> (k << i)
    return x & ((1 << k) - 1)

ans = 0
for _ in range(4):
    A1 = [st1(inp) for inp in I]
    A2 = [st1("".join([I[i][j] for i in range(H)])) for j in range(W)]
    B = [st2(inp[::-1]) for i, inp in enumerate(I)]
    C = [[0] * W for _ in range(H)]
    for j in range(W):
        s = 0
        m = (1 << j * k) - 1
        for i in range(H)[::-1]:
            s <<= k
            s += B[i] >> (j+1) * k
            s &= m
            C[i][j] = s
    for i in range(1, H):
        for j in range(1, W):
            ans += A1[i] >> (W - j) * k & A2[j] >> (H - i) * k & C[i][j]
    r()
            
print(getsum(ans))
### BUGGY CODE ###

def main():
    n = int(input())
    # d,t,s = map(int, input().split())
    a = list(map(int, input().split()))
    # s = input()

    sm = 0
    for i in range(len(a)):
        for j in range(i+1, len(a)):
            sm += (a[i] * a[j]) % (10**9+7)

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


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input())
    # d,t,s = map(int, input().split())
    a = list(map(int, input().split()))
    # s = input()
    mod = 10**9+7

    s = sum(a)

    sm = 0

    for i in a:
        s -= i
        sm += i * s % mod

    print(sm % mod)


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

n = int(input())

d = [0] * (n+1)
for i in range(1, n+1):
   for j in range(i, n+1, i):
      d[j] += 1
print(sum([k * d[k] for k in range(n+1)]))

### FIXED CODE ###

n = int(input())

ans = 0
for i in range(1, n+1):
   num = n // i
   end = i * num
   ans += (num/2) * (end + i)
print(int(ans))
### BUGGY CODE ###

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

def abp(a, b, p):
    if b == 0:
        return 1
    if b % 2 == 0:
        tmp = abp(a, b // 2, p)
        return (tmp * tmp) % p
    if b % 2 == 1:
        return (a * abp(a, b - 1, p)) % p
 
def nCr(n, r, p):
    total = 1
    for i in range(r):
        total *= (n - i) * abp(r - i, p - 2, p)
        total %= p
    return total

p = 1000000007
total = (2 ** n - 1) % p
total = (total - nCr(n, a, p) - nCr(n, b, p)) % p
print(total)

### FIXED CODE ###

def abp(a, b, p):
    if b == 0:
        return 1
    if b % 2 == 0:
        tmp = abp(a, b // 2, p)
        return (tmp * tmp) % p
    if b % 2 == 1:
        return (a * abp(a, b - 1, p)) % p

def nCr(n, r, p):
    total = 1
    for i in range(r):
        total *= (n - i) * abp(r - i, p - 2, p)
        total %= p
    return total

n, a, b = map(int, input().split())
p = 1000000007
ret = abp(2, n, p) - nCr(n, a, p) - nCr(n, b, p) - 1
print(ret % p)
### BUGGY CODE ###

H,W = map(int,input().split())
A = []
C = []
for i in range(H):
	tmp = [s for s in input()]
	indexes = [k for k, x in enumerate(tmp) if x == "#"]
	A.append(tmp)
	for k in indexes:
		C.append((i,k))

for i in range(H):
	for j in range(W):
		if A[i][j] == ".":
			tmp = H+W
			for x,y in C:
				if tmp > abs(x-i) + abs(y-j):
					tmp = abs(x-i)+abs(y-j)
			A[i][j] = tmp

tmp = 0
for i in range(H):
	for j in range(W):
		if A[i][j] != "#" and A[i][j] > tmp:
			tmp = A[i][j]
print(tmp)

### FIXED CODE ###

import numpy as np

H,W = map(int,input().split())
A = []
for i in range(H):
	A.append([0 if s == "#" else H+W for s in input()])

A = np.array(A)
for x in range(W - 1):
	A[:,x+1] = np.minimum(A[:, x]+1,A[:, x+1])
for x in range(W - 1, 0 , -1):
	A[:,x-1] = np.minimum(A[:, x-1],A[:, x]+1)
for y in range(H -1):
	A[y+1,:] = np.minimum(A[y, :]+1,A[y+1, :])
for y in range(H -1, 0, -1):
	A[y-1,:] = np.minimum(A[y-1, :],A[y, :]+1)

print(np.max(A))
### BUGGY CODE ###

import sys
from collections import Counter

n = int(sys.stdin.readline())
ct = Counter()
a_ls = dict()
for i in range(n):
    inp = [int(i) - 1 for i in sys.stdin.readline().split()]
    a_ls[i] = inp
cnt = 0
remain = list(range(n))
rest = n * (n - 1) / 2
while rest:
    combis = set()
    no_ls = []
    flg = False
    for i in remain:
        if len(a_ls[i]) == 0:
            no_ls.append(i)
            continue
        target = a_ls[i][0]
        if (i, target) in combis or (target, i) in combis:
            rest -= 1
            if len(a_ls[i]) > 0:
                a_ls[i].pop(0)
            if len(a_ls[target]) > 0:
                a_ls[target].pop(0)
            flg = True
        else:
            combis.add((i, target))
    remain = list(set(remain) - set(no_ls))
    if not flg:
        cnt = -1
        break
    cnt += 1
print(cnt)

### FIXED CODE ###

import sys
from collections import Counter
import copy

n = int(sys.stdin.readline())
ct = Counter()
a_ls = dict()
for i in range(n):
    inp = [int(i) - 1 for i in sys.stdin.readline().split()]
    a_ls[i] = inp
cnt = 0
candidate = list(range(n))
rest = n * (n - 1) / 2
combis = set()
while rest:
    no_ls = []
    next_candidate = []
    flg = False
    for i in candidate:
        if len(a_ls[i]) == 0:
            continue
        target = a_ls[i][0]
        if (i, target) in combis or (target, i) in combis:
            next_candidate.append(i)
            next_candidate.append(target)
            rest -= 1
            if len(a_ls[i]) > 0:
                a_ls[i].pop(0)
            if len(a_ls[target]) > 0:
                a_ls[target].pop(0)
            flg = True
        else:
            combis.add((i, target))
    candidate = next_candidate
    if not flg:
        cnt = -1
        break
    cnt += 1
print(cnt)
### BUGGY CODE ###

MOD=998244353
N,M,K=map(int,input().split())

f,invf=[1],[1]*N
for i in range(1,N):
    f.append(f[i-1]*i)
invf[N-1]=pow(f[N-1],MOD-2,MOD)
for i in range(N-1,0,-1):
    invf[i-1]=(invf[i]*i)%MOD
ans=0
c=[1]*(N)
for i in range(1,N):
    c[i]=c[i-1]*(M-1)%MOD
for i in range(K+1):
    ans+=M*c[N-i-1]*f[N-1]*invf[N-i-1]*invf[i]
    ans%=MOD
print(ans)

### FIXED CODE ###

mod=998244353

class Combination:
    def __init__(self, N):
        self.fac = [1] * (N + 1)
        for i in range(1, N + 1):
            self.fac[i] = (self.fac[i - 1] * i) % mod
        self.invmod = [1] * (N + 1)
        self.invmod[N] = pow(self.fac[N], mod - 2, mod)
        for i in range(N, 0, -1):
            self.invmod[i - 1] = (self.invmod[i] * i) % mod
 
    def calc(self, n, k):  # nCk
        return self.fac[n] * self.invmod[k] % mod * self.invmod[n - k] % mod

N,M,K=map(int,input().split())

C=Combination(N)
ans=0
c=[1]*(N)
for i in range(1,N):
    c[i]=c[i-1]*(M-1)%mod
for i in range(K+1):
    tmp=M*c[N-i-1]*C.calc(N-1,N-i-1)%mod
    ans=(ans+tmp)%mod
print(ans)
### BUGGY CODE ###

from functools import reduce
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))
 
MOD = 10 ** 9 + 7
 
lcm = reduce(lambda x,y: x*y//gcd(x,y), A)
 
answer = sum(lcm//x for x in A)
answer %= MOD
print(answer)

### FIXED CODE ###

from functools import reduce
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))
 
MOD = 10 ** 9 + 7
 
lcm = reduce(lambda x,y: x*(y//gcd(x,y)), A)
lcm %= MOD

coef = sum(pow(a, MOD-2, MOD) for a in A)
ans = lcm * coef % MOD

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

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


for i in range(n):
    if 0 in a:
        f = 0
    else:
        f *= a[i]
    
if f <= 10**18:
    print(f)
else:
    print(-1)

### FIXED CODE ###

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

if 0 in a:
    print(0)
else:
    for i in a:
        ans *= i
        
        if ans > 10**18:
            print(-1)
            exit()
            
    print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
a_s = set(a)
ans = 0
for i in range(n):
    l = a[i]
    a[i] = 'X'
    ans = 0
    for j in a_s:
        c = a.count(j)
        ans += c * (c-1) // 2
    print(ans)
    a[i] = l

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int,input().split()))

c = Counter(a)
key = c.keys()
comb = 0
for i in key:
    comb += (c[i]) * (c[i]-1) // 2

for i in a:
    ans = comb - (c[i]-1)
    print(ans)
### BUGGY CODE ###

N = input().split()
P = []
for i in range(int(N[1])):
    P.append(list(map(int, input().split())))
#print(P)
K = sorted(P)
#print(K)
for i, n in enumerate(P):

#	print("K,n",K,n[1])
#	print(K.index(n))
	tmp = 0;
	for i in range(0,K.index(n)+1):
		#print("K[i]",K[i])
		if K[i][0] == n[0]:
			tmp+=1
	print("{:0=6}".format(int(n[0]))+"{:0=6}".format(tmp))
	#print(n[0])

### FIXED CODE ###

N = input().split()
count = [0] * int(int(N[0])+1)
P = []
ans = []
for i in range(int(N[1])):
	p,y = map(int, input().split())
	P.append((y,p,i))
# print(P)
K = sorted(P)
# print(K)
for y,p,i in K:
	count[p] += 1
	ans.append((i,p,count[p]))

ans.sort()
for i,p,count in ans:
	print("{:0=6}".format(int(p))+"{:0=6}".format(count))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
n,m = map(int, input().split())
i=0
lst = []
x = set()
while i < m: 
    l = list(map(int, input().split()))
    l.append(i)
    x.add(l[0])
    lst.append(l)
    i+=1
ll=sorted(lst)
j=1
for i in sorted(list(x)):
    for k in ll:
        if i == k[0]:
            k[1]=i*1000000+j
            j+=1
        else:
            j=1
#ans
for ans in sorted(ll, key=lambda x:x[2]):
    print('{0:012d}'.format(ans[1]))



### FIXED CODE ###

# -*- coding: utf-8 -*-
n,m = map(int, input().split())
i=0
lst = []
while i < m: 
    lst.append(list(map(int, input().split())) + [i])
    i+=1
lst = sorted(lst)
j=0
i=1
for k in lst:
    if i != k[0]:
        i=k[0]
        j=1
        k[1]=i*1000000+j
    else:
        j+=1
        k[1]=i*1000000+j

#ans
for ans in sorted(lst, key=lambda x:x[2]):
    print('{0:012d}'.format(ans[1]))
### BUGGY CODE ###

import math
a,b,n = map(int,input().split())
x = 0
max_f = 0
for i in range(n+1):
    f = math.floor(a * x / b) - a * math.floor(x/b)
    if f > max_f:
        max_f = f
    x += 1
print(max_f)

### FIXED CODE ###

import math
a,b,n = map(int,input().split())

f_max = 0
if n >= b-1:
    f_max = b-1
else:
    f_max = n
print(math.floor(a * f_max / b) - a * math.floor(f_max/b))
### BUGGY CODE ###

def dfs(n):
    table =[]
    i = 2
    while n >= i**2:
    # nのその数自身を除いた素因数は√n以下であることから。
        while n % i == 0:
            table.append(i)
            n /= i
        i += 1
    if n > 1:
        table.append(int(n))
# 最後に残った、最大の素因数をリストに入れる。
    return table

N = int(input())
f_list = dfs(N)
if len(f_list) == 1:
  print(f_list[0] - 1)
  exit()
elif len(f_list) == 2:
  s = 0
  for f in f_list:
    s += f
  print(s - 2)
  exit()
ans = float('inf')
for x in range(10**12):
  if x + 1 > N:
    break
  for y in range(10**12):
    if (x + 1) * (y + 1) > N:
      break
    if (x + 1) * (y + 1) == N:
      ans = min((x + y), ans)
print(ans)

### FIXED CODE ###

N = int(input())
from math import sqrt
def get_divs(n):
  divs = []
  for i in range(1, int(sqrt(n)) + 1):
    if n % i == 0:
      divs.append((i, n // i))
  return divs

divs = get_divs(N)
ans = float('inf')
for x, y in divs:
  ans = min(ans, (x + y - 2))
print(ans)
### BUGGY CODE ###

from collections import deque

[H, W] = [int(i) for i in input().split()]
S = [0]*(H+2)
S[0] = ['#']*(W+2)
S[H+1] = ['#']*(W+2)

for i in range(1, H+1):
    row = ['#'] + list(input()) + ['#']
    S[i] = row
    
def bfs(p, q, c):
    distance = {(p, q):0}
    que = deque([(p, q)])
    reached = {(p, q):1}
    
    while len(que) > 0: 
        (y, x) = que.popleft()
        if c[y][x] == '#':
            continue
        
        reached[(y, x)] = 1
        try:
            if reached[(y+1, x)] == 1:
                pass
        except KeyError:
            if c[y+1][x] == '.':
                que.append((y+1, x))
                distance[(y+1, x)] = distance[(y, x)] + 1
        
        try:
            if reached[(y-1, x)] == 1:
                pass
        except KeyError:
            if c[y-1][x] == '.':
                que.append((y-1, x))
                distance[(y-1, x)] = distance[(y, x)] + 1
        
        try:
            if reached[(y, x+1)] == 1:
                pass
        except KeyError:
            if c[y][x+1] == '.':
                que.append((y, x+1))
                distance[(y, x+1)] = distance[(y, x)] + 1
        
        try:
            if reached[(y, x-1)] == 1:
                pass
        except KeyError:
            if c[y][x-1] == '.':
                que.append((y, x-1))
                distance[(y, x-1)] = distance[(y, x)] + 1
        
    distances = list(distance.values())
    return max(distances)

anss = [0]*(H*W)
times = 0

for i in range(1, H+1):
    for j in range(1, W+1):
        if S[i][j] == '.':
            anss[times] = bfs(i, j, S)
        times += 1

print(max(anss))


### FIXED CODE ###

from collections import deque

[H, W] = [int(i) for i in input().split()]
S = [list(input()) for _ in range(H)]
dy, dx = [1, 0, -1, 0], [0, 1, 0, -1]

def bfs(sy, sx):
    if S[sy][sx] == '#':
        return 0
        
    reached = [[-1]*W for _ in range(H)]
    que = deque([[sy, sx]])
    reached[sy][sx] = 0
    
    while que:
        [y, x] = que.pop()
        for i in range(4):
            yy, xx = y + dy[i], x + dx[i]
            if yy < 0 or xx < 0 or yy > H-1 or xx > W-1 or S[yy][xx] == '#' or reached[yy][xx] != -1:
                continue
            else:
                reached[yy][xx] = reached[y][x] + 1
                que.appendleft([yy, xx])
                
    distance = 0
    for i in range(H):
        for j in range(W):
            distance = max(distance, reached[i][j])
            
    return distance

ans = 0
for a in range(H):
    for b in range(W):
        ans = max(ans, bfs(a, b))

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

from math import log2
N, K = map(int, input().split())
a = list(map(int, input().split()))
x = 0
if K == 0:
    x = 0
else:
    for i in range(int(log2(K))+1)[::-1]:
        cnt_1 = 0
        for _a in a:
            if _a & 2**i == 2**i:
                cnt_1 += 1
        if cnt_1 <= len(a)/2 and (x + 2**i) <= K:
            x += 2**i
            
ans = 0
for _a in a:
    ans += x ^ _a
print(ans)

### FIXED CODE ###

import math
N, K = map(int, input().split())
a = list(map(int, input().split()))
x = 0
if K == 0:
    x = 0
else:
    for i in range(41)[::-1]:
        cnt_1 = 0
        for _a in a:
            if _a & 2**i == 2**i:
                cnt_1 += 1
        if cnt_1 <= len(a)/2 and (x + 2**i) <= K:
            x += 2**i

ans = 0
for _a in a:
    ans += x ^ _a
print(ans)
### BUGGY CODE ###

from collections import deque


h, w = map(int, input().split())
grid = [input() for _ in range(h)]
cost = [[float("inf")] * w for _ in range(h)]
nb = [(-1, 0), (0, -1), (1, 0), (0, 1)]

q = deque()
for i in range(h):
    for j in range(w):
        if grid[i][j] == "#":
            q.append((i, j))
            cost[i][j] = 0

while q:
    x, y = q.popleft()
    for dx, dy in nb:
        nx = x + dx
        ny = y + dy
        if 0 <= nx and nx < h and 0 <= ny and ny < w and cost[nx][ny] == float("inf"):
            cost[nx][ny] = cost[x][y] + 1
            q.append((nx, ny))


print(max([max(c) for c in cost]))

### FIXED CODE ###

from collections import deque
 
H, W = map(int, input().split())
A = [input() for i in range(H)]
q = deque()
c = [[-1] * W for i in range(H)]
for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            q.append((i, j))
            c[i][j] = 0
D = [[0, 1], [1, 0], [0, -1], [-1, 0]]
while q:
    y, x = q.popleft()
    for dy, dx in D:
        ny, nx = y+dy, x+dx
        if 0 <= ny < H and 0 <= nx < W and c[ny][nx] == -1:
            q.append((ny, nx))
            c[ny][nx] = c[y][x]+1
print(max([max(l) for l in c]))
### BUGGY CODE ###

import bisect
import sys

sys.setrecursionlimit(10000)
INF = float('inf')

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B, C = zip(*[list(map(int, input().split())) for _ in range(M)])

A.sort()

for b, c in zip(B, C):
    ci = bisect.bisect_left(A, c)
    A = (A[:ci] + [c] * b + A[ci:])[-N:]

print(sum(A))


### FIXED CODE ###

import sys

sys.setrecursionlimit(10000)
INF = float('inf')

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
CB = [list(map(int, reversed(input().split()))) for _ in range(M)]

A.sort()
CB.sort()

ans = 0
for _ in range(N):
    a = A[-1] if A else -INF
    c, b = CB[-1] if CB else (-INF, -INF)
    if a > c:
        ans += a
        A.pop()
    else:
        ans += c
        CB[-1][1] -= 1
        if CB[-1][1] <= 0:
            CB.pop()
print(ans)
### BUGGY CODE ###

N, K = map(int,input().split())
ls_pass = list(map(int,input().split()))
ls_pass.insert(0,0)
a=1
b=0
ls_past=[1]
for i in range(1,N+1):
  b=a
  a=ls_pass[a]
  if b==a:
    print(a)
    break
  elif a in ls_past:
    c=ls_past.index(a)
    ls_cicle=ls_past[c:i]
    print(ls_cicle[(K-i)%(i-c)])
    break
  elif i==K:
    print(a)
    break
  else:
    ls_past.append(a)

### FIXED CODE ###

N, K = map(int,input().split())
ls_pass = [0]+list(map(int,input().split()))
a=1
b=0

ls=["ンゴ"]+[0]+["ンゴ"]*(N-1)
ls_past=[1]
for i in range(1,N*3):
  b=a
  a=ls_pass[a]
  if ls[a]!="ンゴ":
    ls_cicle=ls_past[ls[a]:i]
    print(ls_cicle[(K-i)%len(ls_cicle)])
    break
  elif i==K:
    print(a)
    break  
  else:
    ls_past.append(a)
    ls[a]=i
### BUGGY CODE ###

n,m=map(int,input().split())
l=[]
for i in range(n):
  a,b=map(int,input().split())
  l.append([a,b])
l.sort()
l.append([0,0])
ans=0
k=[]
j=0
for i in range(1,m+1):
  while j<=n and l[j][0]<=i:
    k.append(l[j][1])
    j+=1
  if len(k)!=0:
  	ans+=max(k)
  	k.remove(max(k))
print(ans)

### FIXED CODE ###

import heapq
n,m=map(int,input().split())
l=[]
for i in range(n):
  a,b=map(int,input().split())
  l.append([a,b])
l.sort()
l.append([0,0])
ans=0
k=[]
j=0
for i in range(1,m+1):
  while j<=n and l[j][0]<=i:
    heapq.heappush(k, -1*l[j][1])
    j+=1
  if len(k)!=0:
  	ans+=-1*k[0]
  	heapq.heappop(k)
print(ans)
### BUGGY CODE ###

from collections import deque
h,w=map(int,input().split())
field=[list(input()) for _ in range(h)]
graph=[[float('inf')]*w for _ in range(h)]
queue=deque()
count=0
for i in range(h):
    for j in range(w):
        if field[i][j]=='#':
            queue.append([i,j])
            graph[i][j]=0

def bfs():
    x,y=queue.popleft()
    for dx,dy in [[1,0],[-1,0],[0,1],[0,-1]]:
        if 0<=x+dx<h and 0<=y+dy<w:
            if graph[x+dx][y+dy]==float('inf'):
                graph[x+dx][y+dy]=graph[x][y]+1
                queue.append([x+dx,y+dy])
while queue:
    bfs()
print(max(max(graph[s]) for s in range(h)))
    

### FIXED CODE ###

import numpy as np
h,w=map(int,input().split())
graph=[[0 if i=='#' else float('inf') for i in list(input())] for _ in range(h)]
graph=np.array(graph)
for x in range(w-1):
    graph[:,x+1]=np.minimum(graph[:,x]+1,graph[:,x+1])
for x in range(w-1,0,-1):
    graph[:,x-1]=np.minimum(graph[:,x]+1,graph[:,x-1])
for y in range(h-1):
    graph[y+1,:]=np.minimum(graph[y,:]+1,graph[y+1,:])
for y in range(h-1,0,-1):
    graph[y-1,:]=np.minimum(graph[y,:]+1,graph[y-1,:])

print(int(np.max(graph)))
### BUGGY CODE ###

MOD = 10 ** 9 + 7
INF = 10 ** 15

K = int(input())
S = input()

M = len(S)
N = M + K
MAXN = N + 2
fact = [1]
for i in range(1,MAXN + 1):
    fact.append(fact[-1]*i%MOD)
inv_fact = [-1] * (MAXN + 1)
inv_fact[-1] = pow(fact[-1],MOD - 2,MOD)
for i in range(MAXN - 1,-1,-1):
    inv_fact[i] = inv_fact[i + 1]*(i + 1)%MOD

nck = lambda N,K: 0 if K > N or K < 0 else fact[N]*inv_fact[N - K]*inv_fact[K]%MOD

power25 = [1]
power26 = [1]
for i in range(N):
    power25.append(power25[-1]*25%MOD)
    power26.append(power26[-1]*26%MOD)

ans = 0
for i in range(M,N + 1):
    ans += nck(i - 1,M - 1) * power25[i - M] * power26[N - i] % MOD
    ans %= MOD
print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    K = int(input())
    S = input()
    
    M = len(S)
    N = M + K
    MAXN = N + 2
    fact = [1]
    for i in range(1,MAXN + 1):
        fact.append(fact[-1]*i%MOD)
    inv_fact = [-1] * (MAXN + 1)
    inv_fact[-1] = pow(fact[-1],MOD - 2,MOD)
    for i in range(MAXN - 1,-1,-1):
        inv_fact[i] = inv_fact[i + 1]*(i + 1)%MOD
    
    nck = lambda N,K: 0 if K > N or K < 0 else fact[N]*inv_fact[N - K]*inv_fact[K]%MOD
    
    power25 = [1]
    power26 = [1]
    for i in range(N):
        power25.append(power25[-1]*25%MOD)
        power26.append(power26[-1]*26%MOD)
    
    ans = 0
    for i in range(M,N + 1):
        ans += nck(i - 1,M - 1) * power25[i - M] * power26[N - i] % MOD
        ans %= MOD
    print(ans)
if __name__ == '__main__':
    main()