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

import math
import copy
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(int, input().split())
data = getInputListInt()

ans = 0

for i in range(n):
    tmp = []
    tmp = copy.deepcopy(data)
    tmp.pop(i)

    gcdans = reduce(fractions.gcd, tmp)

    ans = max(ans, gcdans)

print(ans)


### FIXED CODE ###

import math
import copy
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(int, input().split())
data = getInputListInt()

gcdNormal = np.zeros(n)
gcdReverse = np.zeros(n)

ans = 0

for i in range(1, n):
    if i==1:
        ans = fractions.gcd(data[i-1], data[i])
        gcdNormal[i] = ans
        gcdNormal[0] = data[0]
    else:
        gcdans = fractions.gcd(ans, data[i])
        ans = min(ans, gcdans)
        gcdNormal[i] = ans

ans = 0

for i in range(n-2, -1, -1):
    if i==n-2:
        ans = fractions.gcd(data[i], data[i+1])
        gcdReverse[i] = ans
        gcdReverse[i+1] = data[i+1]
    else:
        gcdans = fractions.gcd(ans, data[i])
        ans = min(ans, gcdans)
        gcdReverse[i] = ans

ans= 0
for i in range(n):
    if i ==0:
        ans = max(ans, gcdReverse[1])
    elif i == n-1:
        ans = max(ans, gcdNormal[n-2])
    else:
        ans = max(ans, fractions.gcd(gcdNormal[i-1], gcdReverse[i+1]))

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

from collections import Counter


from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


S = input()
div = []
s = 0
for i in range(1, len(S) + 1):
    s += int(S[-i]) * (10 ** (i - 1))
    # print(s)
    div.append(s % 2019)
div_cnt = Counter(div)
ans = div_cnt[0]
for l in div_cnt.values():
    if l >= 2:
        ans += combinations_count(l, 2)
print(ans)


### FIXED CODE ###

from collections import Counter


from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


S = input()
div = []
s = 0
kurai = 1
for i in range(len(S) - 1, -1, -1):
    # s += int(S[i]) * ((10 ** (len(S) - 1 - i)) % 2019)
    # s %= 2019
    if i == len(S) - 1:
        s += int(S[i]) * kurai
    else:
        s += int(S[i]) * kurai
    kurai *= 10
    kurai %= 2019
    s %= 2019
    div.append(s)
div_cnt = Counter(div)
ans = div_cnt[0]
for l in div_cnt.values():
    if l >= 2:
        ans += l * (l-1) // 2
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

def enum_prime(m):
    L = [True for _ in xrange(m + 1)]
    L[0] = L[1] = False

    for i in xrange(2, m + 1):
        if not L[i]:
            continue
        for j in xrange(i + i, m + 1, i):
            L[j] = False
        if m < i * i:
            break
    return L

P = enum_prime(50000)

for line in stdin:
    if line.startswith('0'):
        break
    n = int(line)
    cnt = 0
    if n % 2 == 0:
        for p, isprime in enumerate(P):
            if not isprime:
                continue
            if p + p > n:
                break
            if P[n - p]:
                cnt += 1
    elif P[n - 2]:
        cnt = 1
    print(cnt)

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

def enum_prime(m):
    L = [True for _ in xrange(m + 1)]
    L[0] = L[1] = False

    for i in xrange(2, m + 1):
        if L[i]:
            for j in xrange(i + i, m + 1, i):
                L[j] = False
            if m < i * i:
                break
    return L

FLAGS = enum_prime(50000)
PRIMES = [i for i, isprime in enumerate(FLAGS) if isprime]

for line in stdin:
    if line.startswith('0'):
        break
    n = int(line)
    n2 = n // 2
    cnt = 0
    if n % 2 == 0:
        for p in PRIMES:
            if p > n2:
                break
            if FLAGS[n - p]:
                cnt += 1
    elif FLAGS[n - 2]:
        cnt = 1
    print(cnt)
### BUGGY CODE ###

n = int(input())
ll = [[0]*i for i in range(n)]
for i in range(n):
  x, l =map(int, input().split())
  ll[i] = [x-l, x+l]
ll = sorted(ll)

l = ll[0]
ans = n

for i in range(n-1):
  if l[1] > ll[i+1][0]:
    ans -= 1
  else:
    l = ll[i+1]

print(ans)

### FIXED CODE ###

n = int(input())
ll = []
for i in range(n):
  x, l = map(int, input().split())
  ll.append([x-l, x+l])
ll = sorted(ll)

ans = n
r = ll.pop()[0]

while ll:
  while ll and ll[-1][1] > r:
    ans -= 1
    ll.pop()
  if ll:
    r = ll.pop()[0]

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

from itertools import combinations_with_replacement

n = int(input())

for i in range(1, n+1):
    ans = 0
    for v in combinations_with_replacement(range(1, 60), 3):        
        x, y, z = v
        if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
            if x == y == z:
                ans = 1
            else:
                ans = 3
    print(ans)

### FIXED CODE ###

n = int(input())
ans = [0] * (n+1)

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            s = x*x + y*y + z*z
            s += x*y + y*z + z*x
            if (s > n):
                continue
            else:
                ans[s] += 1

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

def main():
    n = int(stdinput())

    d = MyDict()

    for _ in range(n):
        cmd, value = stdinput().split()
        if cmd == 'insert':
            d.insert(value)
        elif cmd == 'find':
            if d.find(value):
                print('yes')
            else:
                print('no')

class MyDict():
    def __init__(self):
        self.stacks = {
            'A': [],
            'C': [],
            'G': [],
            'T': []
        }
    
    def insert(self, value):
        self.stacks[value[0]].append(value)
    
    def find(self, value):
        return value in self.stacks[value[0]]

def stdinput():
    from sys import stdin
    return stdin.readline().strip()

if __name__ == '__main__':
    main()
    # import cProfile
    # cProfile.run('main()')


### FIXED CODE ###

def main():
    n = int(stdinput())

    st = [None] * (4**12)

    for _ in range(n):
        cmd, value = stdinput().split()
        if cmd == 'insert':
            st[get_hash(value)] = 1
        elif cmd == 'find':
            if st[get_hash(value)] == 1:
                print('yes')
            else:
                print('no')

CODES = {'A' : 1, 'C' : 2, 'G' : 3, 'T' : 4}
def get_hash(s):
    base = 1
    h = 0
    for c in s:
        code = CODES[c]
        h += code * base
        base *= 4
    return h

def stdinput():
    from sys import stdin
    return stdin.readline().strip()

if __name__ == '__main__':
    main()
    # import cProfile
    # cProfile.run('main()')
### BUGGY CODE ###

S=input()
M=13
MOD=10**9+7
dp=[[0]*M for i in range(2)]
dp[1][0]=1
for i in range(len(S)):
  dp[0]=[0]*13
  s=S[i]
  if s=='?':
    for s in range(10):
      for j,d in enumerate(dp[1]):
        dp[0][(j+s)%M]+=d
        #dp[0][(j+s)%M]%=MOD
  else:
    s=int(s)
    for j,d in enumerate(dp[1]):
      dp[0][(j+s)%M]=d
  for j,d in enumerate(dp[0]):
    dp[1][(10*j)%M]=d
print(dp[0][5]%MOD)



### FIXED CODE ###

S=input()
import numpy as np
M=13
MOD=10**9+7
dp=np.zeros(M, dtype=np.int64)
dp[0]=1
idx = np.zeros(M, dtype=np.int8)
window = np.ones(10, dtype=np.int8)
for i in range(M):
  idx[i * 10 % M] = i
for s in S:
  if s=='?':
    tdp=dp[idx]
    ndp = np.concatenate([tdp[4:], tdp])
    dp = np.convolve(ndp, window, mode='valid') % MOD
  else:
    dp=np.roll(dp[idx],int(s))
print(dp[5]%MOD)
### BUGGY CODE ###

# coding: utf-8
import numpy as np
from itertools import combinations as combs

H,W,K = list(map(int, input().split()))
arr = []
for i in range(H):
  arr.append(list(map(int, list(input()))))
arr = np.array(arr)

def cut_sum(arr, x1, x2, y1, y2):
  return arr[x1:x2, y1:y2].sum()

row_idxes = list(range(1,H))
min_val = 10 ** 9

for n_rows in range(H):
  for row_set in combs(row_idxes, n_rows):
    count = len(row_set)
    row_lines = [0] + list(row_set)+ [H]
    col1, col2 = 0, 1
    while col2 <= W:
      row1 = 0
      for row2 in row_lines[1:]:
        val = cut_sum(arr, row1, row2, col1, col2)
        if val > K:
          if (col2 - col1) == 1:
            count = 10 ** 9
            break
          count +=1
          col1 = col2 - 1
          col2 -= 1 
          break
        row1 = row2
      if count == 10 **9:
        break
      col2 += 1
    
    if min_val > count:
      min_val = count
print(min_val)

### FIXED CODE ###

# coding: utf-8
from itertools import combinations as combs

H,W,K = list(map(int, input().split()))
arr = []
for i in range(H):
  arr.append(list(map(int, list(input()))))

def cut_sum(arr, x1, x2, y):
  ret = 0
  for i in range(x1, x2):
    ret += arr[i][y]
  return ret

row_idxes = list(range(1,H))
min_val = float('inf')

for n_rows in range(H):
  for row_set in combs(row_idxes, n_rows):
    count = len(row_set)
    row_lines = [0] + list(row_set)+ [H]
    col1, col2 = 0, 1
    sums = [0] * (len(row_lines) - 1)
    while col2 <= W:
      row1 = 0
      for box, row2 in enumerate(row_lines[1:]):
        sums[box] += cut_sum(arr, row1, row2, col2-1)
        if sums[box] > K:
          if (col2 - col1) == 1:
            count = float('inf')
            break
          count += 1
          col1 = col2 - 1
          col2 -= 1
          sums = [0] * (len(row_lines) - 1)
          break
        row1 = row2
      if count >= min_val:
        break
      col2 += 1
    
    if min_val > count:
      min_val = count
print(min_val)
### BUGGY CODE ###

s=list(map(int,input().split()))
ans=[]
a=int(s[1]/10000)
b=int(s[1]/5000)
c=int(s[1]/1000)
for i in range(0,a+1):
    for j in range(0,b+1):        
        for k in range(0,c+1):
            check=10000*i+5000*j+1000*k
            if(check==s[1]):
                if(i+j+k==s[0]):
                    ans.append(i)
                    ans.append(j)
                    ans.append(k)
                    break
                
if(ans==[]):
    print('-1 -1 -1')
else:
    print('{} {} {}'.format(ans[0],ans[1],ans[2]))    

### FIXED CODE ###

s=list(map(int,input().split()))
ans=[]
a=int(s[1]/10000)
b=int(s[1]/5000)
c=int(s[1]/1000)
for i in range(0,a+1):
    for j in range(0,b+1):
        if(s[0]-i-j>=0):        
            check=10000*i+5000*j+1000*(s[0]-i-j)
            if(check==s[1]):
                ans.append(i)
                ans.append(j)
                ans.append(s[0]-i-j)
                break
                
if(ans==[]):
    print('-1 -1 -1')
else:
    print('{} {} {}'.format(ans[0],ans[1],ans[2]))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)

#=====================================
class Tree():
  def __init__(self):
    self.root = None
    self.children = set()
    self.counter = 0

  def add_child(self, child):
    self.children.add(child)
  
  def reconstruct(self, root=None):
    if root in self.children:
      self.root = root
      self.children.remove(root)
    for child in self.children:
      child.reconstruct(self)
  
  def add_count(self, x):
    self.counter += x

  def add_root_count(self):
    if self.root:
      self.counter += self.root.counter
    for child in self.children:
      child.add_root_count()

#=====================================
def solve():
  n,q = [int(i) for i in input().split()]
  trees = [Tree() for i in range(n)]

  for _ in range(n-1):
    a,b = [int(i) for i in input().split()]
    trees[a-1].add_child(trees[b-1])
    trees[b-1].add_child(trees[a-1])

  trees[0].reconstruct()

  for _ in range(q):
    p,x = [int(i) for i in input().split()]
    trees[p-1].add_count(x)

  trees[0].add_root_count()
  
  print(*[trees[i].counter for i in range(n)])

#=====================================
if __name__ == '__main__':
  solve()

### FIXED CODE ###

N, Q = map(int, input().split())
graph = [[] for i in range(200010)]
ans = [0 for i in range(200010)]
import sys
#sys.setrecursionlimit(100000)
sys.setrecursionlimit(10**7)
#
readline = sys.stdin.readline


for _ in range(N - 1):
    #a, b = map(int, input().split())
    a, b = map(int, readline().split())
    a -= 1
    b -= 1

    graph[a].append(b)
    graph[b].append(a)

for _ in range(Q):
    #p, x = map(int, input().split())
    p, x = map(int, readline().split())
    p -= 1

    ans[p] += x

def dfs(node, frm=-1):
    for to in graph[node]:
        if to == frm:
            continue
        ans[to] += ans[node]
        dfs(to, node)
dfs(0)

print(*ans[:N])
### BUGGY CODE ###

N,M=map(int,input().split())
alist=list(map(int,input().split()))

alist.sort()
cblist = []
for i in range(M):
  B,C=map(int,input().split())
  cblist.append((C,B))
  
cblist.sort(reverse=True)
#print(alist)
#print(cblist)

for (C,B) in cblist:
  for i in range(B):
    if alist[i] < C:
      alist[i] = C
    else:
      break
  
  alist.sort()
  
#print(alist)
print(sum(alist))


### FIXED CODE ###

N,M=map(int,input().split())
alist=list(map(int,input().split()))

alist.sort()
cblist = []
for i in range(M):
  B,C=map(int,input().split())
  cblist.append((C,B))
  
cblist.sort(reverse=True)
#print(alist)
#print(cblist)

index = 0
for (C,B) in cblist:
  for i in range(index,index+B):
    if i == len(alist):
      break
    
    if alist[i] < C:
      alist[i] = C
    else:
      break
      
  index += B
  if index >= len(alist):
    break
  
#print(alist)
print(sum(alist))
### BUGGY CODE ###

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

for i in range(n):
    xy.append(list(map(int,input().split())))

import itertools

l=list(itertools.permutations(range(0,n)))
cnt=0
sum=0

while True:
    if len(l)==0:
        break
    temp=l.pop(0)
    for i in range(n-1):
        sum+=((xy[temp[i]][0]-xy[temp[i+1]][0])**2+(xy[temp[i]][1]-xy[temp[i+1]][1])**2)**(1/2)
    cnt+=1

print(sum/cnt)

### FIXED CODE ###

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

for i in range(n):
    xy.append(list(map(int,input().split())))

import itertools

l=list(itertools.permutations(range(0,n)))
cnt=0
sum=0

while True:
    if len(l)==0:
        break
    temp=l.pop(0)
    for i in range(n-1):
        sum+=((xy[temp[i]][0]-xy[temp[i+1]][0])**2+(xy[temp[i]][1]-xy[temp[i+1]][1])**2)**(1/2)
    cnt+=1

print(sum/cnt)
### BUGGY CODE ###

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

K=int(input())
ans=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            ans+=gcd(gcd(a,b),c)
print(ans)

### FIXED CODE ###

from math import gcd
K=int(input())
ans=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            ans+=gcd(gcd(a,b),c)
print(ans)
### BUGGY CODE ###

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

S = input()
cnt = 0

# O(N^2)は不可。
# 010がある時、01と10を取り除くパターンを作る？
s = S
while True:
    ls = len(s)
    s1 = s.replace("01", "")
    s2 = s.replace("10", "")
    ls1 = len(s1)
    ls2 = len(s2)
    if ls == ls1 and ls == ls2:
        break
    elif ls1 <= ls2:
        cnt += (ls - ls1)
        s = s1
    else:
        cnt += (ls - ls2)
        s = s2

print(cnt)

### FIXED CODE ###

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

S = input()

# 最終出力は1のみか0のみとなるはず
# つまり、0と1の個数をカウントし、その差分から答えが求められる

c0 = S.count("0")
c1 = S.count("1")

fin = abs(c0-c1)    # 最後に残る0か1の個数
res = len(S) - fin

print(res)
### BUGGY CODE ###

N = int(input())
al = list(map(int,input().split()))
sss=0
for i in range(N):
    sss+=al[i]*sum(al[i+1:N])
print(sss%1000000007)

### FIXED CODE ###

N = int(input())
al = list(map(int,input().split()))
sss=0
pss=0
for i in range(1,N):
    pss+=al[i-1]
    sss+=al[i]*pss
print(sss%1000000007)
### BUGGY CODE ###

N, M, Q = map(int, input().split())
Mi = [list(map(int, input().split())) for i in range(M)]
Qi = [list(map(int, input().split())) for i in range(Q)]
qi = [Qi[i].extend([0, i]) for i in range(Q)]
Mi.sort()
Qi.sort()

for mi in Mi:
    for i in range(Q):
        if mi[0] < Qi[i][0]:
            continue
        if mi[0] >= Qi[i][0] and mi[1] <= Qi[i][1]:
            Qi[i][2] += 1
Qi.sort(key=lambda x: x[3])
for a in Qi:
    print(a[2])

### FIXED CODE ###

N, M, Q = map(int, input().split())
LR = [[0] * (N+1) for _ in range(N+1)]
for m in range(M):
    l, r = map(int, input().split())
    LR[l][r] += 1

# 二次元累積和をとる
LR_sum = [[0] * (N+1) for _ in range(N+1)]
LR_sum[1][1] = LR[1][1]
## 初期化
for i in range(1, N+1):
    LR_sum[1][i] = LR_sum[1][i-1] + LR[1][i]
    LR_sum[i][1] = LR_sum[i-1][1] + LR[i][1]
## 累積和をとる
for i in range(2, N+1):
    for j in range(2, N+1):
        LR_sum[i][j] = LR_sum[i-1][j] + LR_sum[i][j-1] - LR_sum[i-1][j-1] + LR[i][j]

for q in range(Q):
    l, r = map(int, input().split())
    print(LR_sum[r][r] - LR_sum[r][l-1] - LR_sum[l-1][r] + LR_sum[l-1][l-1])
### BUGGY CODE ###

h,w=map(int,input().split())

s=[input() for i in range(h)]

# def ok(i,j,houkou, count):
#     if i==h or j==w:
#         return count
#     elif s[i][j]=='#':
#         return count
#     elif houkou=='yoko':
#         return ok(i,j+1,houkou,count+1)
#     else:
#         return ok(i+1,j,houkou,count+1)

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

count=0
for i in range(h):
    for j in range(w):
        if s[i][j]=='.':
            count+=1
        if s[i][j]=='#':
            for k in range(count):
                yoko[i][j-k-1]=count
            count=0
    if count>0:
        for k in range(count):
            yoko[i][j-k]=count
        count=0
# print(yoko)


for j in range(w):
    for i in range(h):
        if s[i][j]=='.':
            count+=1
        if s[i][j]=='#':
            for k in range(count):
                tate[i-k-1][j]=count
            count=0
    if count>0:
        for k in range(count):
            tate[i-k][j]=count
        count=0

# print(tate)

ans=0
for i in range(h):
    for j in range(w):
        if ans<yoko[i][j]+tate[i][j]-1:
            ans=yoko[i][j]+tate[i][j]-1
print(ans)

### FIXED CODE ###

h,w=map(int,input().split())

s=[input() for i in range(h)]

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

count=0
for i in range(h):
    for j in range(w):
        if s[i][j]=='.':
            count+=1
        if s[i][j]=='#' or j+1==w:
            for k in range(count):
                yoko[i][j-k-1]=count
            count=0

# print(yoko)


for j in range(w):
    for i in range(h):
        if s[i][j]=='.':
            count+=1
        if s[i][j]=='#' or i+1==h:
            for k in range(count):
                tate[i-k-1][j]=count
            count=0

# print(tate)

ans=0
for i in range(h):
    for j in range(w):
        if ans<yoko[i][j]+tate[i][j]-1:
            ans=yoko[i][j]+tate[i][j]-1
print(ans)
### BUGGY CODE ###

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

def exp(n):
    if n % 2 == 0:
        s = (n+1)*n/2
    else:
        s = (n+1)*(n-1)/2+(n+1)/2
    ans = s / n
    return ans

M = 0
for i in range(N-K+1):
    S = 0
    for j in range(K):
        S += exp(p[i+j])
    if M < S:
        M = S

print('{:.12f}'.format(M))

### FIXED CODE ###

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

def exp(n):
    if n % 2 == 0:
        s = (n+1)*n/2
    else:
        s = (n+1)*(n-1)/2+(n+1)/2
    ans = s / n
    return ans

q = []
for i in range(N):
    q.append(exp(p[i]))
#print(q)

S = sum([q[i] for i in range(K)])
M = S
#print(M)

for i in range(N-K):
    S = S - q[i] + q[K+i]
    #print(S)
    if S > M:
        M = S

print('{:.12f}'.format(M))
### BUGGY CODE ###

from sys import stdin
from itertools import permutations 
from time import sleep


def solve(nums):
    num_person, *caps = nums
    caps = caps + [0]
    #  (人数, 乗り物のキャパシティ) のタプルの配列
    cities = list(zip([num_person] + ([0] * (len(caps) - 1)), caps))
    time = 0

    # 最後の都市に全員が移動したら終了
    while cities[-1][0] < num_person:
        mov_nums = [min(*city) for city in cities[:-1]]
        for i, mov_num in enumerate(mov_nums):
            city = cities[i]
            next_city = cities[i + 1]
            cities[i] = (city[0] - mov_num, city[1])
            cities[i + 1] = (next_city[0] + mov_num, next_city[1])
        time = time + 1
    return time


def main():
    nums = [int(l) for l in stdin.readlines()]
    ans = solve(nums)
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

from sys import stdin
from math import ceil

#  def solve(nums):
    #  num_person, *caps = nums
    #  caps = caps + [0]
    #  #  (人数, 乗り物のキャパシティ) のタプルの配列
    #  cities = list(zip([num_person] + ([0] * (len(caps) - 1)), caps))
    #  time = 0

    #  # 最後の都市に全員が移動したら終了
    #  while cities[-1][0] < num_person:
        #  print('|'.join([str(n) for n, cap in cities[:-1]]))
        #  mov_nums = [min(*city) for city in cities[:-1]]
        #  for i, mov_num in enumerate(mov_nums):
            #  city = cities[i]
            #  next_city = cities[i + 1]
            #  cities[i] = (city[0] - mov_num, city[1])
            #  cities[i + 1] = (next_city[0] + mov_num, next_city[1])
        #  time = time + 1
    #  return time


def solve(nums):
    num_person, *caps = nums
    return 4 + ceil(num_person / min(*caps))


def main():
    nums = [int(l) for l in stdin.readlines()]
    ans = solve(nums)
    print(ans)

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

import itertools
#import math
#from collections import deque

n=int(input())
s=list(input())

dic=dict()
for i in itertools.product(range(2),repeat=n):
	t=s[:n][::-1]
	u=s[n:]
	t_=[[] for _ in range(2)]
	u_=[[] for _ in range(2)]
	for j in range(n):
		k=t.pop()
		l=u.pop()
		t_[i[j]].append(k)
		u_[i[j]].append(l)
	t0=tuple(t_[0])
	t1=tuple(t_[1])
	u0=tuple(u_[0])
	u1=tuple(u_[1])
	if (t0,t1) not in dic:
		dic[(t0,t1)]=[1,0]
	else:
		dic[(t0,t1)][0]+=1
	if (u0,u1) not in dic:
		dic[(u0,u1)]=[0,1]
	else:
		dic[(u0,u1)][1]+=1

ans=0
for i in dic.keys():
	ans+=dic[i][0]*dic[i][1]
print(ans)



### FIXED CODE ###

import itertools
#import math
#from collections import deque

n=int(input())
s=input()

t=s[:n][::-1]
u=s[n:]
dic=dict()
for i in itertools.product(range(2),repeat=n):
	t_=[""]*2
	u_=[""]*2
	for j in range(n):
		t_[i[j]]+=t[j]
		u_[i[j]]+=u[j]
	if (t_[0],t_[1]) not in dic:
		dic[(t_[0],t_[1])]=[1,0]
	else:
		dic[(t_[0],t_[1])][0]+=1
	if (u_[0],u_[1]) not in dic:
		dic[(u_[0],u_[1])]=[0,1]
	else:
		dic[(u_[0],u_[1])][1]+=1

ans=0
for i in dic.keys():
	ans+=dic[i][0]*dic[i][1]
print(ans)