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

n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
lcm=1
d=dict()
for i in range(n):
  k=a[i]
  for j in range(1,int(a[i]**0.5)+1):
    cnt=0
    while k%(j+1)==0:
      k//=j+1
      cnt+=1
    if j+1 in d:
      if d[j+1]<cnt:
        lcm*=(j+1)**(cnt-d[j+1])
        d[j+1]=cnt
    else:
      lcm*=(j+1)**cnt
      d[j+1]=cnt
  if k in d:
    if d[k]<1:
      lcm*=k
      d[k]=1
  else:
    lcm*=k
    d[k]=1
ans=0
for i in range(n):
  ans+=(lcm//a[i])%mod
print(ans%mod)

### FIXED CODE ###

from fractions import gcd
P = 10**9 + 7
N = 1000001 #使う最大値+1以上にする、値に注意3*10^5とかにしとくと安心
inv = [0] + [1] # 1/x
for i in range(2,N):
  inv += [inv[P % i] * (P - int(P / i)) % P]
n=int(input())
a=list(map(int,input().split()))
lcm=a[0]
mod=10**9+7
for i in range(1,n):
  lcm=(lcm//gcd(lcm,a[i]))*a[i]
ans=0
lcm%=mod
for i in range(n):
  ans=(ans+lcm*inv[a[i]])%mod
print(ans%mod)
### BUGGY CODE ###

from functools import reduce
from operator import mul


def main():
    N, K = map(int, input().split())
    print(sum([reduce(mul, [0.5
                            for j in range(K)
                            if i << j < K], 1 / N)
               for i in range(1, N + 1)]))
    return


main()


### FIXED CODE ###

from functools import reduce
from operator import mul


def main():
    N, K = map(int, input().split())
    ans = []
    lst = []
    for i in range(1, N + 1):
        lst.clear()
        for j in range(K):
            if K <= i << j:
                break
            lst.append(0.5)
        ans.append(reduce(mul, lst, 1 / N))
    print(sum(ans))
    return


main()
### BUGGY CODE ###

N=int(input())
*A,=map(int,input().split())

A.sort()
ans=N
i=0
while i<N:
    if i<N-1 and A[i]==A[i+1]:
        ans-=1
        i+=1
        continue
    for a in A[:i]:
        if A[i]%a==0:
            ans-=1
            break
    i+=1

print(ans)

### FIXED CODE ###

N=int(input())
*A,=map(int,input().split())

A.sort()
count=[0]*(A[-1]+1)
i=0
while i<N:
    j=A[i]
    if 2<=count[j]:
        i+=1
        continue
    k=1
    while j*k<=A[-1]:
        count[j*k]+=1
        k+=1
    i+=1

print(sum(count[a]==1 for a in A))
### BUGGY CODE ###

_ = input()
l = list(map(int,input().split()))
ans = 1
for i in l:
    ans *= i
if ans > 10**18:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

_ = input()
l = list(map(int,input().split()))
flag = True
if 0 in l:
    print(0)
else:
    ans = 1
    for i in l:
        ans *= i
        if ans > 10**18:
            print(-1)
            flag = False
            break
    if(flag):
        print(ans)
### BUGGY CODE ###

N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = []
cnt = 0
for i in range(M):
  a, b = map(int, input().split())
  AB.append(sorted([a, b]))
  
for i in range(1, N+1):
  flag = True
  for ab in AB:
    if ab[0] == i:
      x = ab[1]
      if H[i - 1] <= H[x - 1]:
        flag = False
    elif ab[1] == i:
      x = ab[0]
      if H[i - 1] <= H[x - 1]:
        flag = False
  if flag:
    cnt += 1
      
print(cnt)

### FIXED CODE ###

N, M = map(int, input().split())
H = list(map(int, input().split()))
m = [0] * N
cnt = 0

for _ in range(M):
  a, b = map(int, input().split())
  m[a - 1] = max(m[a - 1], H[b - 1])
  m[b - 1] = max(m[b - 1], H[a - 1])

for i in range(N):
  if H[i] > m[i] or m[i] == 0:
    cnt += 1

print(cnt)
### BUGGY CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
for m in range(M):
    A[0] = A[0] // 2
    A.sort(reverse=True)
print(sum(A))

### FIXED CODE ###

def funcD():
    import heapq
    N, M = map(int, input().split())
    A = list(map(lambda x: -1 * int(x), input().split()))
    A.sort(reverse=True)
    heapq.heapify(A)
    for m in range(M):
        a = -(-heapq.heappop(A) // 2)
        heapq.heappush(A, a)
    print(-sum(A))


funcD()
### BUGGY CODE ###

n, m = map(int, input().split())
data = []
for i in range(n):
    a, b = map(int, input().split())
    data.append([a, b])
data.sort(key=lambda x: x[0])   #値段でソート
prices = []
for p in data:
    for i in range(p[1]):
        prices.append(p[0])
print(sum(prices[:m]))


### FIXED CODE ###

n, m = map(int, input().split())
data = []   #値段、個数
for i in range(n):
    a, b = map(int, input().split())
    data.append([a, b])
data.sort(key=lambda x: x[0])   #値段でソート
ans = 0
for p in data:
    ans += p[0] * min(m, p[1])
    m -= p[1]
    if m <= 0:
        break

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

def main():
    N,K=map(int,open(0).read().split())
    keta=1
    flag=0
    A=K
    while not (A<=N and A*K>N):
        A*=K
        keta= keta+1
    print(keta+1)
main()

### FIXED CODE ###

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
    
def main():
    N,K=map(int,input().split())
    print(len(Base_10_to_n(N,K)))
main()
### BUGGY CODE ###

from collections import deque
from copy import copy

n = int(input())
l = deque(list(map(int, input().split())))
ans = 0

for _ in range(len(l)-2):
    first = l.pop()
    m = copy(l)
    for _ in range(len(m)-1):
        second = m.pop()
        n = copy(m)
        for _ in range(len(n)):
            third = n.pop()
            if (first < second + third) & (second < first + third) & (third < first + second):
                ans += 1

print(ans)


### FIXED CODE ###

from bisect import bisect_right

n = int(input())
order = sorted(list(map(int, input().split())))
ans = 0

for i in reversed(range(2, n)):
    for j in reversed(range(1, i)):
        ans += j - bisect_right(order[0:j], order[i]-order[j])

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

N, P = map(int, input().split())
S = input()
if P == 2:
    counter = 0
    for i in range(len(S)):
        if S[i] in ['2', '4', '6', '8', '0']:
            counter += i + 1
    print(counter)
elif P == 5:
    counter = 0
    for i in range(len(S)):
        if S[i] in ['5', '0']:
            counter += i + 1
    print(counter)
else:
    list_a = [0] * P
    list_a[0] += 1
    counter = 0
    temp = 0
    for i in range(N):
        temp += 10**i * int(S[N-i-1])
        temp %= P
        counter += list_a[temp]
        list_a[temp] += 1
    print(counter)



### FIXED CODE ###

N, P = map(int, input().split())
S = input()
if P == 2:
    counter = 0
    for i in range(len(S)):
        if S[i] in ['2', '4', '6', '8', '0']:
            counter += i + 1
    print(counter)
elif P == 5:
    counter = 0
    for i in range(len(S)):
        if S[i] in ['5', '0']:
            counter += i + 1
    print(counter)
else:
    list_a = [0] * P
    list_a[0] += 1
    counter = 0
    temp = 0
    power = 1
    for i in range(N):
        power *= 10
        power %= P
        temp += power * int(S[N-i-1])
        temp %= P
        counter += list_a[temp]
        list_a[temp] += 1
    print(counter)
### BUGGY CODE ###

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

inf = 10 ** 4 + 1
dp = [inf] * N
dp[0] = 0

for i in range(1,N):
    H = h[i]
    dp[i] = min( dp[j] + abs(h[j] - H) for j in range(max(0, i-K),i))


print(dp[-1])

### FIXED CODE ###

n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
inf = 10 ** 4 + 1
dp = [inf] * n
dp[0] = 0
for i in range(1,n):
    H = h[i]
    dp[i] = min([dp[j] + abs(h[j] - H) for j in range(max(0, i - k), i)])
print(dp[-1])
### BUGGY CODE ###


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

expect_list = [((1+yokolist[i])/2) for i in range(n)]

#print(expect_list)

answer = 0
l = expect_list[0:k]
for j in range(n-k+1):
    p = sum(l)
    if p > answer:
       answer = p
    del l[0]
    if j != n-k:
        l.append(expect_list[k+j])

print(answer)

### FIXED CODE ###

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

expect_list = [((1+yokolist[i])/2) for i in range(n)]

#print(expect_list)

answer = 0
l = expect_list[0:k]
p = sum(l)
for j in range(n-k+1):
    if p > answer:
       answer = p
    if j != n-k:
        p = p - expect_list[j] + expect_list[k+j]

print(answer)
### BUGGY CODE ###

def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    res = 0
    maxI = 0
    maxV = 0
    for i in range(N-K+1):
        v = sum(P[i:i+K])
        if v > maxV:
            maxV = v
            maxI = i
    for p in P[maxI:maxI+K]:
        res += (p+1.0) / 2.0
    print(res)

main()

### FIXED CODE ###

def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    maxI = 0
    maxV = sum(P[:K])
    curV = maxV
    for i in range(1, N-K+1):
        curV = curV + P[i+K-1] - P[i-1]
        if curV > maxV:
            maxV = curV
            maxI = i

    res = (sum(P[maxI:maxI+K]) + K) / 2.0
    print(res)

main()
### BUGGY CODE ###

s = str(input())
d = s.replace("BC", "D")

count = 0
for i,c in enumerate(d):
    if c == "A":
        for j, h in enumerate(d[i+1:]):
            if h == "D":
                count += 1
            elif h == "A":
                continue
            else:
                break
print(count)

### FIXED CODE ###

s = str(input())
d = s.replace("BC", "D")

count = 0
count_a = 0
for i,c in enumerate(d):
    if c == "A":
        count_a += 1
    elif c == "D":
        count += count_a
    else:
        count_a = 0
print(count)
### BUGGY CODE ###

n=int(input())
l=[]
for i in range(n):
  l.append(int(input()))
m=max(l)
for i in range(n):
  if l[i] == m:
    a = l[i]
    l[i] = 0
    print(max(l))
    l[i] = a
  else:print(m)

### FIXED CODE ###

n=int(input())
l=[]
for i in range(n):
  l.append(int(input()))
m=max(l)
a=l.index(m)
for i in range(n):
  if i==a:
    l[i]=0
    print(max(l)) 
  else:print(m)
### BUGGY CODE ###

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

def hash(a):
    return a%100


def check(A):
    for i in range(len(A)):
        for j in range(i, len(A)):
            if(j+1 < len(A)):
                if(A[i] == A[j+1]):
                    # print("%d=%d"%(A[i], A[j]))
                    flag = True
                    return 'NO'

    return 'YES'

arr = [[] for i in range(100)]

for i in A:
    arr[hash(i)].append(i)

for i in arr:
    flag = False
    if(check(i) == "NO"):
        print("NO")
        flag = True
        break
if(not flag):
    print("YES")

### FIXED CODE ###

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

A.sort()
# print(A)
flag = False
for i in range(len(A)):
    if(i+1 < len(A)):
        if(A[i] == A[i+1]):
            print("NO")
            flag = True
            break
if(not flag):
    print("YES")
### BUGGY CODE ###

def main():
    import heapq
    hpop=heapq.heappop
    hpush=heapq.heappush
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    visit=[False]*n
    h = []
    h2 = []
    h2a=h2.append
    heapq.heapify(h)
    for i in range(n):
        hpush(h, (-b[i], i))
    cnt = 0
    while h:
        i, j = hpop(h)
        i=-i
        if visit[j]:
            h2a((i, j))
            visit[j-1]=True
            visit[(j+1)%n]=True
            continue
        temp = i-a[j]
        temp2=b[j-1]+b[(j+1)%n]
        sho=temp//temp2
        if sho==0:
            h2a((i, j))
            visit[j]=True
            visit[j-1]=True
            visit[(j+1)%n]=True
            continue
        cnt += sho
        b[j] -= temp2*sho
        hpush(h, (-b[j], j))
    h2.sort(key=lambda x: x[1])
    for i in range(n):
        if a[i] != h2[i][0]:
            print(-1)
            return 0
    print(cnt)


main()

### FIXED CODE ###

def main():
    from heapq import heappop as hpop
    from heapq import heappush as hpush
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    h = []
    for i in range(n):
        hpush(h, (-b[i], i))
    cnt = 0
    while h:
        i, j = hpop(h)
        i = -i
        jj = (j+1) % n
        temp = i-a[j]
        temp2 = b[j-1]+b[jj]
        sho = temp//temp2
        if sho == 0:
            if temp:
                print(-1)
                return 0
            continue
        cnt += sho
        b[j] -= temp2*sho
        hpush(h, (-b[j], j))
    print(cnt)
main()
### BUGGY CODE ###

n,k = map(int,input().split())
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
h_max = 0
h_min = 0
r = 0
ans = []
#print(h)
for i in range(r,n):
    if n - r < k: 
        break
    h_max = max(h[r:k+r])
    #print(h[r:k])
    h_min = min(h[r:k+r])
    ans.append(h_max - h_min)
    r += 1
print(min(ans))


### FIXED CODE ###

n,k = map(int,input().split())
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
h_max = 0
h_min = 0
r = 0
ans = []
#print(h)
for i in range(r,n-k+1):
    if n - r < k: 
        break
    h_max = h[r+k-1]
    #print(h[r:k])
    h_min = h[r]
    ans.append(h_max - h_min)
    r += 1
print(min(ans))
### BUGGY CODE ###

N, *A = map(int, open(0).read().split())

MOD = 1000000007

ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        ans += A[i] * A[j] % MOD
        ans %= MOD
print(ans)

### FIXED CODE ###

from itertools import accumulate

MOD = 10 ** 9 + 7
N, *A = map(int, open(0).read().split())

B = list(accumulate(A)) # cumsum

ans = 0
for i in range(N-1):
    ans += A[i] * (B[-1] - B[i]) % MOD
    ans %= MOD
print(ans)
### BUGGY CODE ###

# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))
S = list(str(input()))
S.reverse()
extra = 0
each_extras = [[0 for i in range(10)] for i in range(S.count("?"))]
cnt = 0
for i in range(len(S)):
    if S[i] != "?":
        extra += int(S[i]) * 10 ** i
    else:
        each_extras[cnt] = []
        for x in range(10):
            each_extras[cnt].append(x * 10 ** i % 13)
            # each_extras[cnt][x * 10 ** i % 13] = 1
        cnt += 1

# print(each_extras)

# print(extra)
dp = [[0 for i in range(13)] for j in range(cnt+1)]
dp[0][extra % 13] = 1
for i in range(cnt):
    # for j in range(13):
    for extras in each_extras[i]:
        for j in range(13):
            dp[i+1][(extras + j)%13] += dp[i][j]
    for j in range(13):
        dp[i+1][j] = dp[i+1][j] % mod

# print(dp)
print(dp[-1][5] % mod)


### FIXED CODE ###

# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))


"""
S.reverse()
extra = 0
each_extras = [[0 for i in range(10)] for i in range(S.count("?"))]
cnt = 0
for i in range(len(S)):
    if S[i] != "?":
        extra += int(S[i]) * 10 ** i
    else:
        each_extras[cnt] = []
        for x in range(10):
            each_extras[cnt].append(x * 10 ** i % 13)
            # each_extras[cnt][x * 10 ** i % 13] = 1
        cnt += 1

# print(each_extras)

# print(extra)
dp = [[0 for i in range(13)] for j in range(cnt+1)]
dp[0][extra % 13] = 1
for i in range(cnt):
    for extras in each_extras[i]:
        for j in range(13):
            dp[i+1][(extras + j)%13] += dp[i][j]
            dp[i+1][(extras + j)%13] %= mod
    for j in range(13):
        dp[i+1][j] = dp[i+1][j] % mod


# print(dp)
print(dp[-1][5] % mod)
"""


S = list(str(input()))

dp = [[0 for i in range(13)]for j in range(len(S)+1)]
dp[0][0] = 1
S.reverse()
mul = 1
for i in range(len(S)):
    if S[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i+1][(mul*j+k)%13] += dp[i][k]
                dp[i+1][(mul*j+k)%13] %= mod
    else:
        for k in range(13):
            dp[i+1][(int(S[i])*mul+k)%13] += dp[i][k]
            dp[i+1][(int(S[i])*mul+k)%13] %= mod
    mul *= 10
    mul %= 13

# print(dp)
print(dp[-1][5])
### BUGGY CODE ###

#n,x=map(int,input().split())
#a=[int(i) for i in input().split()]
import string
alp=string.ascii_lowercase
di={}
for i in range(26):
    di[alp[i]]=i
s=input()
a=[]
for i in s:
    a.append(i)
l=a.pop()
if a:
    a=a[::-1]
k=int(input())
ans=''
i=0
while a:
    t=a.pop()
    d=(26-di[t])%26
    if d<=k:
        k-=d
        ans+='a'
    else:
        ans+=t
    i+=1
kk=k%26
ans+=alp[(alp.index(l)+kk)%26]
print(ans)

### FIXED CODE ###

#n,x=map(int,input().split())
#a=[int(i) for i in input().split()]
import string
alp=string.ascii_lowercase
di={}
for i in range(26):
    di[alp[i]]=i
s=input()
a=[]
for i in s:
    a.append(i)
l=a.pop()
if a:
    a=a[::-1]
k=int(input())
ans=''
i=0
while a:
    t=a.pop()
    d=(26-di[t])%26
    if d<=k:
        k-=d
        ans+='a'
    else:
        ans+=t
    i+=1
kk=k%26
ans+=alp[(alp.index(l)+kk)%26]
print(ans)
### BUGGY CODE ###

import numpy as np

anum = 0

N = int(input())
strings = []

for i in range(N):
    strings.append(input())

for i in range(N):
    temp = [s for s in strings[i]]
    temp.sort()
    strings[i] = ''.join(temp)

for i in range(N-1):
    for j in range(i+1,N):
        if strings[i] == strings[j]:
            anum += 1

print(anum)

### FIXED CODE ###

N = int(input())
s = [''.join(sorted(input())) for i in range(N)]
dict = {}
ans = 0

for i in s:
    if i in dict:
        ans += dict[i]
        dict[i] += 1
    else:
        dict[i] = 1

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

N, M = map(int, input().split())
price = []
kagi = []
for i in range(M):
  price.append(int(input().split()[0]))
  key = 0
  kagikagi = list(map(int,input().split()))
  for k in kagikagi:
    key += 2 ** (k-1)
  kagi.append(key)

res = -1
for i in range(2**M):
  combi = 0
  tmp_res = 0
  keys = []
  for j in range(M):
    if((i >> j) & 1):
      combi = combi|kagi[j]
      tmp_res += price[j]
      keys.append(j)
  if combi == 2**N-1:
    if tmp_res < res or res == -1:
      res = tmp_res
      
print(res)

### FIXED CODE ###

N, M = map(int, input().split())
price = []
keys = []
dp = [float('inf') for i in range(1<<N)]
dp[0] = 0
for k in range(M):
    price.append(int(input().split()[0]))
    keys.append(list(map(int,input().split())))
for p,key in zip(price,keys):
    key_open = 0
    for k in key:
        key_open |= 1 << (k-1)
        for j in range(1 << N):
            dp[j|key_open] = min(dp[j|key_open], dp[j] + p)

if dp[(1<<N)-1] == float('inf'):
    dp[(1<<N)-1] = - 1
print(dp[(1 << N) - 1])
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
input = sys.stdin.readline

R, C, k = map(int, input().split())
field = [[0] * C for _ in range(R)]
for _ in range(k):
    r, c, v = map(int, input().split())
    r -= 1; c -= 1
    field[r][c] = v

# dp[taken 0 - 2][R][C]
dp = [[-1] * (C + 1) * (R + 1) for _ in range(4)]
dp[0][0] = 0
for j in range(C):
    for i in range(R):
        for k in range(4):
            ij = i * C + j
            ij1 = ij + 1
            i1j = ij + C
            item = field[i][j]
            # Use
            if item and k < 3:
                dp[k+1][ij1] = max(dp[k+1][ij1], dp[k][ij] + item) 
                dp[0][i1j] = max(dp[0][i1j], dp[k][ij] + item) 
            # No use down
            dp[0][i1j] = max(dp[0][i1j], dp[k][ij]) 
            # No use right
            dp[k][ij1] = max(dp[k][ij1], dp[k][ij]) 

ans = 0
for i in range(4):
    for j in range(R + 1):
        ans = max(ans, dp[i][j * C + C - 1])
print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
import sys
input = sys.stdin.readline

R, C, k = map(int, input().split())
field = [[0] * C for _ in range(R)]
for _ in range(k):
    r, c, v = map(int, input().split())
    r -= 1; c -= 1
    field[r][c] = v

# dp[taken 0 - 2][R][C]
dp = [[-1] * (C + 1) * (R + 1) for _ in range(4)]
dp0 = dp[0]; dp1 = dp[1]; dp2 = dp[2]; dp3 = dp[3]
dp[0][0] = 0
for j in range(C):
    for i in range(R):
        ij = i * C + j
        ij1 = ij + 1
        i1j = ij + C
        item = field[i][j]
        # Use
        if item:
            dp1[ij1] = max(dp1[ij1], dp0[ij] + item) 
            dp0[i1j] = max(dp0[i1j], dp0[ij] + item) 
        dp0[i1j] = max(dp0[i1j], dp0[ij]) 
        dp0[ij1] = max(dp0[ij1], dp0[ij]) 
        if item:
            dp2[ij1] = max(dp2[ij1], dp1[ij] + item) 
            dp0[i1j] = max(dp0[i1j], dp1[ij] + item) 
        dp0[i1j] = max(dp0[i1j], dp1[ij]) 
        dp1[ij1] = max(dp1[ij1], dp1[ij]) 
        if item:
            dp3[ij1] = max(dp3[ij1], dp2[ij] + item) 
            dp0[i1j] = max(dp0[i1j], dp2[ij] + item) 
        dp0[i1j] = max(dp0[i1j], dp2[ij]) 
        dp2[ij1] = max(dp2[ij1], dp2[ij]) 
        dp0[i1j] = max(dp0[i1j], dp3[ij]) 
        dp3[ij1] = max(dp3[ij1], dp3[ij]) 

ans = 0
for i in range(4):
    for j in range(R + 1):
        ans = max(ans, dp[i][j * C + C - 1])
print(ans)
### BUGGY CODE ###

import collections

N = int(input())
S = []
for _ in range(N):
    S.append(input())
c = collections.Counter(S)
ans = []
max = c.most_common()[0][1]
i = 0
current = c.most_common()[i]
while current[1] == max:
    ans.append(current[0])
    i += 1
    if len(c) <= i:
        break
    current = c.most_common()[i]

ans.sort()
for s in ans:
    print(s)


### FIXED CODE ###

import collections

N = int(input())
S = []
for _ in range(N):
    S.append(input())

c = collections.Counter(S)
max = c.most_common()[0][1]
ans = [i[0] for i in c.items() if i[1] == max]
ans.sort()

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

import fractions
 
n = int(input())
a = list(map(int, input().split()))
 
num = a[0]
for i in range(1, n):
	num = num // fractions.gcd(num, a[i])*a[i]
 
ans = 0
for i in range(n):
	ans += (num//a[i])
print(ans%(10**9+7))

### FIXED CODE ###

import fractions
 
n = int(input())
a = list(map(int, input().split()))
 
l = 1
for i in range(n):
	l = l // fractions.gcd(l, a[i])*a[i]
 
ans = 0
for i in range(n):
	ans += l//a[i]
print(ans%(10**9+7))
### BUGGY CODE ###

N , K = map(int,input().split())
x = list(map(int,input().split()))
ans = float("inf")
for i in range(N - K + 1):
    search_candles = x[i : i + K]
    if search_candles[-1] <= 0:
        tmp_min = abs(search_candles[0])
    elif 0 <= search_candles[0]:
        tmp_min = abs(search_candles[-1])
    else:
        PassTwice = min(abs(search_candles[-1]) ,abs(search_candles[0])) * 2
        PassOnce = max(abs(search_candles[-1]) ,abs(search_candles[0]))
        tmp_min = PassTwice + PassOnce
    if tmp_min < ans:
        ans = tmp_min
print(ans)

### FIXED CODE ###

N , K = map(int,input().split())
x = list(map(int,input().split()))
ans = float("inf")
for i in range(N - K + 1):
    #x = x[i : i + K]

    if x[i + K - 1] <= 0:
        tmp_min = abs(x[i])
    elif 0 <= x[i]:
        tmp_min = abs(x[i + K - 1])
    else:
        PassTwice = min(abs(x[i + K - 1]) ,abs(x[i])) * 2
        PassOnce = max(abs(x[i + K - 1]) ,abs(x[i]))
        tmp_min = PassTwice + PassOnce
    if tmp_min < ans:
        ans = tmp_min
print(ans)
### BUGGY CODE ###

N = int(input())
S = list(map(int, input().split()))
b = []
for i in range(N):
  if (i + N) % 2 == 0:
    b.append(S[0])
  else:
    b.insert(0, S[0])
  del S[0]
for i in range(N - 1):
  print(b[i], end = ' ')
print(b[N - 1])

### FIXED CODE ###

N = int(input())
S = list(map(int, input().split()))
b = [0 for i in range(N)]
if N % 2 == 0:
  for i in range(N):
    if i % 2 == 0:
      b[(N + i) // 2] = S[i]
    else:
      b[(N - i) // 2] = S[i]
else:
  b[N // 2] = S[0]
  for i in range(1, N):
    if i % 2 == 1:
      b[(N + i) // 2] = S[i]
    else:
      b[(N - i) // 2] = S[i]
for i in range(N - 1):
  print(b[i], end = ' ')
print(b[N - 1])