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

n = int(input())

result = len(
    [str(x) for x in range(1, n+1)
     if '7' in str(x) and '5' in str(x) and '3' in str(x) and '0' not in str(x) and '1' not in str(x) and '2' not in str(x) and '4' not in str(x) and '6' not in str(x) and '8' not in str(x) and '9' not in str(x)]
)
print(result)


### FIXED CODE ###

# 753数を列挙したほうが速い

N = int(input())


def func(s):
    global N
    if int(s) > N:
        return 0

    ret = 1 if all(s.count(c) > 0 for c in '753') else 0

    for char in '753':
        ret += func(s + char)
    return ret


print(func('0'))
### BUGGY CODE ###

N = int(input())
S = input()
count = 0
def findb(ind,checker):
    global count
    b = S[ind:].count("B")
    if b > 0:
        if ind + checker < N:
            if S[ind+checker] == "B":
                b -= 1
        count += b
def findg(ind,checker):
    global count
    g = S[ind:].count("G")
    if g > 0:
        if ind + checker < N:
            if S[ind+checker] == "G":
                g -= 1
        count += g
def findr(ind,checker):
    global count
    r = S[ind:].count("R")
    if r > 0:
        if ind + checker < N:
            if S[ind+checker] == "R":
                r -= 1
        count += r
for i in range(N):
    if S[i] == "R":
        for j in [x for x, y in enumerate(S[i:]) if y == 'G']:
            findb(i+j,j)
        for j in [x for x, y in enumerate(S[i:]) if y == 'B']:
            findg(i+j,j)
    elif S[i] == "G":
        for j in [x for x, y in enumerate(S[i:]) if y == 'B']:
            findr(i+j,j)
        for j in [x for x, y in enumerate(S[i:]) if y == 'R']:
            findb(i+j,j)
    else:
        for j in [x for x, y in enumerate(S[i:]) if y == 'R']:
            findg(i+j,j)
        for j in [x for x, y in enumerate(S[i:]) if y == 'G']:
            findr(i+j,j)
print(count)

### FIXED CODE ###

N = int(input())
S = input()
r = S.count('R')
g = S.count('G')
b = S.count('B')
count = r * g * b
for i in range(N):
    for j in range(i+1,N-1):
        if 2*j - i <= N-1:
            l = set([S[i],S[j],S[2*j-i]])
            if len(l) == 3:
                count -= 1
print(count)
### BUGGY CODE ###

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

result = 0
mod = 10 ** 9 + 7

for i in range(K, N + 2):
    first = 0
    second = 0
    for j in range(i):
        first += j
        second += N - j
    result = (result + second - first + 1) % mod

print(result)

### FIXED CODE ###

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

first = 0
second = 0
result = 0
mod = 10 ** 9 + 7

for i in range(K):
    first += i
    second += N - i

result = (result + second - first + 1) % mod

for i in range(K, N + 1):
    first += i
    second += N - i
    result = (result + second - first + 1) % mod

print(result)
### BUGGY CODE ###

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

c = collections.Counter(a)

comon = c.most_common()
ans = 0

for i in c.values():
  if i != 1:
  	ans += (i*(i-1)//2)

for i in a:
    for j in comon:
      if i == j[0]:
        co = j[1]
        break
    print(ans-(co*(co-1)//2)+((co-1)*(co-2)//2))

      

### FIXED CODE ###

import collections
n = int(input())
a = list(map(str,input().split()))
ls = [i for i in range(2*10**5)]
c = collections.Counter(a)
comon = c.most_common()
ans = 0

for i in comon:
    if i != 1:
      ls[int(i[0])] = i[1]
      ans += (i[1]*(i[1]-1)//2)

for i in a:
    co = ls[int(i)]
    print(ans-(co*(co-1)//2)+((co-1)*(co-2)//2))
### BUGGY CODE ###

n = int(input())
for i in range(n):
    for j in range(n):
        if (i+1) / (j+1) == j+1:
            ans = i + 1
            break
print(ans)

### FIXED CODE ###

n = int(input())
for i in range(n):
    if (i+1)**2 > n:
        break
    elif (i+1)**2 <= n:
        ans = (i + 1)**2
print(ans)
### BUGGY CODE ###

import copy
n,m,q=map(int,input().split())
List=[]
for i in range(q):
  a,b,c,d=map(int,input().split())
  List.append([a,b,c,d])
List.sort()
s=-1
for i in range(2 ** q):
    l=[-1]*9
    l.insert(0,1)
    l.insert(0,1)
    point=0
    for j in range(q):
      if ((i >> j) & 1):
        point+=List[j][3]
        if l[List[j][0]]!=-1 and l[List[j][1]]!=-1 and l[List[j][1]]-l[List[j][0]]!=List[j][2]:
          l[0]=-2
          break
        else:
          if l[List[j][0]]==-1 and l[List[j][1]]!=-1:
            l[List[j][0]]=l[List[j][1]]-List[j][2]
          elif l[List[j][0]]!=-1 and l[List[j][1]]==-1:
            l[List[j][1]]=l[List[j][0]]+List[j][2]
          elif l[List[j][0]]==-1 and l[List[j][1]]==-1:
            if l[List[j][1]]!=l[List[j][1]]+List[j][2]:
              l[0]=-2
              break
    x=copy.deepcopy(l)
    while -1 in x:x.remove(-1)
    if 1<=min(x) and max(x)<=m:
          y=copy.deepcopy(x)
          x.sort()
          if x==y and point>s:
            s=point
print(s)


### FIXED CODE ###

import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a,b,c=mi()
l=[list(mi()) for i in range(c)]
x=list(itertools.combinations_with_replacement(range(1,b+1),a))
ans=0
for j in x:
  c=0
  for i in l:
    if j[i[1]-1]-j[i[0]-1]==i[2]:
      c+=i[3]
  if c>ans:
    ans=c
print(ans)
### BUGGY CODE ###

import sys

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

    B = []
    C = []
    for a in A:
        if a in B:
            C.append(a)
            B.remove(a)
        else:
            B.append(a)

    C = sorted(C, key=lambda x: -x)
    if len(C) < 2:
        return 0
    else:
        return C[0] * C[1]


if __name__ == '__main__':
    print(main())


### FIXED CODE ###

import sys
from collections import defaultdict

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

    d = defaultdict(lambda: 0)
    B = []
    for a in A:
        d[a] += 1

        if d[a] % 2 == 0:
            B.append(a)


    B = sorted(B, key=lambda x: -x)
    if len(B) < 2:
        return 0
    else:
        return B[0] * B[1]


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

import sys
sys.setrecursionlimit(1000000)

MAX = 200005
G = [[] for i in range(MAX)]
adds = [0] * MAX
ans = [0] * MAX

def dfs(c, p, count):
    count += adds[c]
    ans[c] += count
    for i in range(len(G[c])):
        if (G[c][i] != p):
            dfs(G[c][i], c, count)

n, q = map(int, input().split())
for i in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)
               
for i in range(q):
    p, x = map(int, input().split())
    p -= 1
    adds[p] += x

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


### FIXED CODE ###

MAX = 200005
G = [[] for i in range(MAX)]
adds = [0] * MAX
ans = [0] * MAX

# def dfs(c, p, count):
#     count += adds[c]
#     ans[c] += count
#     for i in range(len(G[c])):
#         if (G[c][i] != p):
#             dfs(G[c][i], c, count)

n, q = map(int, input().split())
for i in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)
               
for i in range(q):
    p, x = map(int, input().split())
    p -= 1
    adds[p] += x

# dfs(0, -1, 0)
stack = [(0, -1, adds[0])]
while len(stack) != 0:
    cur, par, count = stack.pop()
    ans[cur] += count
    for i in range(len(G[cur])):
        if G[cur][i] != par:
            stack.append((G[cur][i], cur, count + adds[G[cur][i]]))
            
for i in range(n):
    print(ans[i])
### BUGGY CODE ###

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

cnt=0
for i in range(1,n):
    
    # 条件満たすまでループ
    while True:
        #print(a)
    
        now_tmp = sum(a[:i])
        next_tmp = sum(a[:i+1])
        #print(i, now_tmp, next_tmp)
        
        # 符号が逆転していればOK かつ 現在までの総和が0でない
        #  異なる符号を掛けるとマイナスになる
        if now_tmp * next_tmp <0 and now_tmp !=0:
            break
        else:
            # 現在の合計がマイナスの場合
            if now_tmp < 0:
                a[i] += next_tmp+1
                cnt +=abs(next_tmp+1)

            # 現在の合計がプラスの場合
            elif now_tmp > 0 :
                a[i] += -next_tmp-1
                cnt +=abs(next_tmp+1)
            # 現在の合計が0の場合
            elif now_tmp == 0 :
                # 1個前がプラスの場合、
                if sum(a[:i-1]) > 0:
                    a[i] -=1
                    cnt +=1
                # 1個前がマイナスの場合
                else:
                    a[i] +=1
                    cnt +=1
                
print(cnt)

### FIXED CODE ###

n = list(input().split())

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

# flg:True プラスの想定
def chk(A, flg):
    #print("-------")
    # 初期値
    x=0
    ans =0
    for a in A:
        # 今までの合計
        x += a
        
        # 想定と違ったら、1との差分を増減する
        if flg==True and x < 1:
            ans +=1-x
            # xは1に変える
            x=1
        elif flg == False and x> -1:
            ans += x+1
            x=-1
        #print(x)
        flg = not flg

    return(ans)
print(min(chk(A, True),chk(A, False)))
### BUGGY CODE ###

n,a,b= map(int,input().split())
sh = sorted([int(input()) for i in range(n)])
sumh = sum(sh)
def nibu(t):
    rt=0
    for i in range(n):rt+=-1*(-1*max(0,sh[i]-t*b)//(a-b))
    return True if t>=rt else False
l,r=0,-1*(-1*sumh//b)
while r-l!=1:
    m = (l+r)//2
    if nibu(m):r=m
    else:l=m
print(r)


### FIXED CODE ###

n,a,b= map(int,input().split())
sh = sorted([int(input()) for i in range(n)],reverse=True)
sumh = sum(sh)
def nibu(t):
    rt=0
    for i in range(n):
        temp = -1*(-1*max(0,sh[i]-t*b)//(a-b))
        if temp>0:rt+=-1*(-1*max(0,sh[i]-t*b)//(a-b))
        else:break
        if rt>t:return False
    return True if t>=rt else False
l=max(sh)//a
r=max(sh)//b+1
while r-l!=1:
    m = (l+r)//2
    if nibu(m):r=m
    else:l=m
print(r)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
mod=10**9+7
A.sort()
ans=1
if N%2==1:
  i=1
  if A[0]!=0:
    print(0)
    exit()
  while i<N:
    if A[i]==A[i+1] and A[i]==(i//2+1)*2:
      i+=2
      ans*=2
      ans%=mod
    else:
      print(0)
      exit()
  print(ans)
else:
  i=0
  while i<N:
    if A[i]==A[i+1] and A[i]==(i//2)*2+1:
      i+=2
      ans*=2
      ans%=mod
    else:
      print(0)
  print(ans)

### FIXED CODE ###

def main():
  N=int(input())
  A=list(map(int,input().split()))
  mod=10**9+7
  ans=1
  A.sort()
  if N%2==0:
    for i in range(0,N,2):
      if A[i]!=A[i+1] or A[i]!=i+1:
        print(0)
        exit()
      ans=ans*2%mod
    print(ans)
  else:
    if A[0]!=0:
      print(0)
      exit()
    ans=1
    for i in range(1,N,2):
      if A[i]!=A[i+1] or A[i]!=i+1:
        print(0)
        exit()
      ans=ans*2%mod
    print(ans)
if __name__=='__main__':
  main()
### BUGGY CODE ###

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

ans=0

for i in range(N):
    cntA=0
    cntC=0
    for j in range(N):
        if B[i]>A[j]:
            cntA+=1
        if B[i]<C[j]:
            cntC+=1
    ans+=cntA*cntC
print(ans)

### FIXED CODE ###

import bisect
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

ans=0
A.sort()
B.sort()
C.sort()

for i in range(len(B)):
    ans+=bisect.bisect_left(A,B[i])*(len(C)-bisect.bisect_right(C,B[i]))
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""077-c"""

import sys
import pprint
import re

import itertools
pp = pprint.PrettyPrinter(indent=2)

def main():
    """Main function."""
    N = int(input())

    As = sorted(list(map(int, input().split(' '))))
    Bs = sorted(list(map(int, input().split(' '))))
    Cs = sorted(list(map(int, input().split(' '))))

    As_start_pos = [-1] * N
    Bs_start_pos = [-1] * N

    count = 0
    for idx_a, a in enumerate(As):
        if idx_a == 0:
            idx_a_ = 0
        else:
            idx_a_ = idx_a - 1
        if As_start_pos[idx_a_] == -1:
            pos_a = 0
        else:
            pos_a = As_start_pos[idx_a_]
        for idx_b, b in enumerate(Bs[pos_a:]):
            if a >= b:
                continue
            if idx_b == 0:
                idx_b_ = 0
            else:
                idx_b_ = idx_b - 1
            if As_start_pos[idx_a] == -1:
                As_start_pos[idx_a] = idx_b + pos_a
            if Bs_start_pos[idx_b_] == -1:
                pos_b = 0
            else:
                pos_b = Bs_start_pos[idx_b_]
            for idx_c, c in enumerate(Cs[pos_b:]):
                if b >= c:
                    continue
                else:
                    if Bs_start_pos[idx_b] == -1:
                        Bs_start_pos[idx_b] = idx_c + pos_b
                    count += len(Cs[pos_b:]) - idx_c
                    break

    print(count)




if __name__ == '__main__':
    sys.exit(main())

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""077-c"""

import sys
import pprint
import re
import itertools

import bisect

pp = pprint.PrettyPrinter(indent=2)

def main():
    """Main function."""
    N = int(input())

    As = sorted(list(map(int, input().split(' '))))
    Bs = map(int, input().split(' '))
    Cs = sorted(list(map(int, input().split(' '))))

    count = 0
    for b in Bs:
        i = bisect.bisect_left(As, b)
        k = N - bisect.bisect_right(Cs, b)
        count += i * k

    print(count)

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

import bisect

n = int(input())
length = list(map(lambda x:int(x), input().split()))
length.sort()
ans = 0
for i in range(n-2):  
    a = length[i]
    for j in range(i+1,n-1):
        b = length[j]
        if i >= j:
            continue
        else:
            c_candidates = length[j+1:]
            max_bar = bisect.bisect_left(c_candidates,a+b)
            ans += max_bar
            
print(ans)

### FIXED CODE ###

import bisect

n = int(input())
#length = list(map(lambda x:int(x), input().split()))
length = list(map(int, input().split()))
length.sort()
ans = 0
for i in range(n-2):  
    a = length[i]
    for j in range(i+1,n-1):
        b = length[j]
        if i >= j:
            continue
        else:
            max_bar = bisect.bisect_left(length,a+b)
            ans += max_bar - j - 1
            
print(ans)
### BUGGY CODE ###

n=int(input())
LL = [input() for x in range(n)]
LL = [x for x in LL if x[0] in ['M','A','R','C','H']]
import itertools
LL = list(itertools.combinations(LL, 3))
ANS = [x for x in LL if x[0][0] != x[1][0] and x[1][0] != x[2][0] and x[0][0] != x[2][0]]
print(len(ANS))

### FIXED CODE ###

n=int(input())
M=['M','A','R','C','H']
S = {'M':0,'A':0,'R':0,'C':0,'H':0}
for _ in range(n):
  a = input()
  if a[0] in S:
  	S[a[0]] +=1
ANS=0
for i in range(len(M)):
  for j in range(i+1,len(M)):
    for k in range(j+1,len(M)):
      ANS += (S[M[i]] * S[M[j]]* S[M[k]])
print(ANS)
### BUGGY CODE ###

import numpy as np
import fractions

from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def LI():
  return [int(s) for s in input().split()]

N = int(input())
A_s = LI()

mod = 10**9 + 7

l = lcm_list(A_s)

print(sum(map(lambda x : l//x, A_s)) % mod)

### FIXED CODE ###

import fractions
 
N = int(input())

def LI():
  return [int(s) for s in input().split()]

A_s = LI()
mod = 10**9 + 7

#l = lcm_list(A_s)
l = 1
for num in A_s:
    l = l * num // fractions.gcd(l,num)

count = 0
for a in A_s:
  count+=l//a
  
print(count % mod)
### BUGGY CODE ###

n, x = map(int, input().split())
a = list(map(int, input().split()))
d = a.copy()
ans = float('inf')
for i in range(n):
    ans = min(ans, sum(d) + x * i)
    for j in range(n):
        d[j] = min(d[j], a[(j - (i + 1) + n) % n])
print(ans)

### FIXED CODE ###

n, x = map(int, input().split())
a = list(map(int, input().split()))
d = a[:]
ans = float('inf')
for i in range(n):
    ans = min(ans, sum(d) + x * i)
    for j in range(n):
        d[j] = min(d[j], a[(j - (i + 1) + n) % n])
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n_dices, n_points = map(int, input().split())
points = sorted(list(map(int, input().split())))
if n_dices >= n_points:
    print(0)
    sys.exit()
interval_list = [points[i + 1] - points[i] for i in range(n_points - 1)]
for i in range(n_dices - 1):
    interval_list.pop(interval_list.index(max(interval_list)))
print(sum(interval_list))

### FIXED CODE ###

import sys
input = sys.stdin.readline
n_dices, n_points = map(int, input().split())
points = sorted(list(map(int, input().split())))
if n_dices >= n_points:
    print(0)
    sys.exit()
interval_list = [points[i + 1] - points[i] for i in range(n_points - 1)]
interval_list.sort(reverse = True)
print(sum(interval_list[n_dices - 1:]))
### BUGGY CODE ###

# E - Flatten

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

modulus = 10 ** 9 + 7
MAX = 10 ** 6

primefact = [0 for i in range(MAX + 1)]

def sieve():
    # cf. https://www.geeksforgeeks.org/lcm-of-n-numbers-modulo-m/
    for i in range(2, MAX + 1):
        if primefact[i] == 0:
            for j in range(i, MAX + 1, i):
                if primefact[j] == 0:
                    primefact[j] = i

def factorize(x):
    if primefact[2] == 0:
        sieve()

    vec = {}
    while x >= 2:
        d = primefact[x]
        if d not in vec:
            vec[d] = 0
        vec[d] += 1
        x //= d
    return vec

def value_div(x, y):
    p = 1
    for i in x:
        p = (p * (i ** (x[i] - (y[i] if i in y else 0)))) % modulus
    return p

fact = [factorize(x) for x in a]
fset = set()
for f in fact:
    fset.update(f.keys())

l = {}
for k in fset:
    l[k] = max(f[k] if k in f else 0 for f in fact)

s = sum(value_div(l, f) for f in fact) % modulus
print(s)


### FIXED CODE ###

# E - Flatten

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

modulus = 10 ** 9 + 7
binmod = (bin(modulus - 2))[2:]  # modulus - 2 in binary

MAX = 10 ** 6

primefact = [0 for i in range(MAX + 1)]

def sieve():
    # cf. https://www.geeksforgeeks.org/lcm-of-n-numbers-modulo-m/
    for i in range(2, MAX + 1):
        if primefact[i] == 0:
            for j in range(i, MAX + 1, i):
                if primefact[j] == 0:
                    primefact[j] = i

def factorize(x):
    if primefact[2] == 0:
        sieve()

    vec = {}
    while x >= 2:
        d = primefact[x]
        if d not in vec:
            vec[d] = 0
        vec[d] += 1
        x //= d
    return vec

def value(x):
    p = 1
    for i in x:
        p = (p * (i ** x[i])) % modulus
    return p

def inverse(x):
    p = 1
    for b in binmod:
        p = p * p % modulus
        if b == '1':
            p = p * x % modulus
    return p

def div(n, d):
    return n * inverse(d) % modulus

fact = [factorize(x) for x in a]

fset = set()
for f in fact:
    fset.update(f.keys())

l = {k: 0 for k in fset}
for f in fact:
    for k in f:
        l[k] = max(l[k], f[k])
lcm = value(l)

s = sum(div(lcm, x) for x in a) % modulus
print(s)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys 
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))

S1 = np.cumsum(A)
S2 = np.cumsum(A)
ans1 = 0
ans2 = 0
# 偶数項-,奇数項を+にする
for i in range(N):
    if i & 1: 
        if S1[i] >= 0:
            ans1 += S1[i]+1
            S1 -= S1[i]+1
        if S2[i] <= 0:
            ans2 += 1-S2[i]
            S2 += 1-S2[i]
    else: 
        if S1[i] <= 0:
            ans1 += 1-S1[i]
            S1 += 1-S1[i]
        if S2[i] >= 0:
            ans2 += S2[i]+1
            S2 -= S2[i]+1

print(min(ans1,ans2))   

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))

ans1 = 0
ans2 = 0
S1 = 0
S2 = 0
# 偶数項-,奇数項を+にする
for i in range(N):
    S1 += A[i]
    S2 += A[i]
    if i & 1: 
        if S1 >= 0:
            ans1 += S1+1
            S1 = -1
        if S2 <= 0:
            ans2 += 1-S2
            S2 = 1
    else: 
        if S1 <= 0:
            ans1 += 1-S1
            S1 = 1
        if S2 >= 0:
            ans2 += S2+1
            S2 = -1
print(min(ans1,ans2))
### BUGGY CODE ###

a = int(input())
b = list(map(int, input().split()))
for i in range(a):
        if sum(b[0:i-1]) == sum(b)/2:
            print(0)
            break
        if sum(b[0:i-1]) < sum(b)/2 < sum(b[0:i]):
                v = sum(b[0:i])- (sum(b)-sum(b[0:i]))
                u = (sum(b)-sum(b[0:i - 1]))-sum(b[0:i -1])
                print(min(v,u)) 
if a == 2:
     print(abs(b[0]-b[1]))

### FIXED CODE ###

a = int(input())
b = list(map(int, input().split()))
import bisect
ln = []
x = 0
for i in b:
    x += i
    ln.append(x)
index = bisect.bisect_left(ln, sum(b)/2)
if sum(b[0:index -1]) == sum(b)/2:
            print(0)
else:
                v =  sum(b[0:index + 1])- (sum(b)-sum(b[0:index + 1]))
                u = (sum(b)-sum(b[0:index]))-sum(b[0:index])
                print(min(v,u))
### BUGGY CODE ###

def cmb(n, r, p):
  if (r < 0) or (n < r):
    return 0
  r = min(r, n - r)
  return fac[n] * finv[r] * finv[n-r] % p

N = 2*pow(10,6)+100
MOD = pow(10,9)+7

fac = [-1]*(N+1); fac[0] = 1; fac[1] = 1
finv = [-1]*(N+1); finv[0] = 1; finv[1] = 1
inv = [-1]*(N+1); inv[0] = 0; inv[1] = 1
for i in range(2,N+1):
  fac[i] = fac[i-1]*i%MOD
  inv[i] = MOD - inv[MOD%i]*(MOD//i)%MOD
  finv[i] = finv[i-1]*inv[i]%MOD


K = int(input())
S = str(input())
s = len(S)

ans = 0
for i in range(K+1):#後ろが0個からK個まで
  factor = pow(25,K-i,MOD)*pow(26,i,MOD)%MOD
  ans = (ans + factor*cmb(s+K-i-1,s-1,MOD))%MOD

ans = ans %MOD
print(ans)
  
  

### FIXED CODE ###

def cmb(n, r, p):
  if (r < 0) or (n < r):
    return 0
  r = min(r, n - r)
  return fac[n] * finv[r] * finv[n-r] % p

N = 2*pow(10,6)+100
MOD = pow(10,9)+7

fac = [-1]*(N+1); fac[0] = 1; fac[1] = 1
finv = [-1]*(N+1); finv[0] = 1; finv[1] = 1
inv = [-1]*(N+1); inv[0] = 0; inv[1] = 1
for i in range(2,N+1):
  fac[i] = fac[i-1]*i%MOD
  inv[i] = MOD - inv[MOD%i]*(MOD//i)%MOD
  finv[i] = finv[i-1]*inv[i]%MOD


K = int(input())
S = str(input())
s = len(S)

ans = 0
for i in range(K+1):#後ろが0個からK個まで
  factor = pow(25,K-i,MOD)*pow(26,i,MOD)%MOD
  ans = (ans + factor*cmb(s+K-i-1,s-1,MOD))%MOD

ans = ans %MOD
print(ans)
### BUGGY CODE ###

from collections import defaultdict
n = int(input())
A = list(map(int, input().split()))
mod = pow(10,9) + 7
D = defaultdict(lambda:0)
for a in A:
    for i in range(61):
        D[1 << i] += bool(a & (1 << i))
ans = 0
for k, v in D.items():
    ans += k * (v * (n - v))
    ans %= mod
print(ans)

### FIXED CODE ###

from collections import defaultdict
n = int(input())
A = list(map(int, input().split()))
mod = pow(10,9) + 7
D = defaultdict(lambda:0)
for a in A:
    for i in range(61):
        D[1 << i] += bool(a & (1 << i))
ans = 0
for k, v in D.items():
    ans += k * (v * (n - v))
    ans %= mod
print(ans)
### BUGGY CODE ###

a = int(input())
ar = list(map(int,input().split(" ")))
cr = set(ar)
dr = sorted(cr,reverse=True)
br = []
for r in dr:
    if len(br) >= 2:
        break
    if ar.count(r) >= 4:
        br.append(r)
        br.append(r)
    elif ar.count(r) >= 2:
        br.append(r)
if len(br) == 0:
    print(0)
else:
    print(br[0] * br[1])

### FIXED CODE ###

import collections
a = int(input())
ar = list(map(int,input().split(" ")))
br = collections.Counter(ar)
cr = []
for k,v in br.items():
    if v >= 4:
        cr.append(k)
        cr.append(k)
    elif v >= 2:
        cr.append(k)
cr = sorted(cr,reverse=True)
if len(cr) < 2:
    print(0)
else:
    print(cr[0] * cr[1])