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

N=int(input())
a = list(map(int, input().split()))
from fractions import gcd
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // gcd(ans, a[i])
import numpy as np
aa = np.array(a)
print(sum(ans//aa)%(10**9+7))

### FIXED CODE ###

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

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

for i in range(N):
    a = int(input())
    A.append(a)

for i in range(N):
    memo = A
    A = A[:i] + A[i+1:]
    print(max(A))
    A = memo


### FIXED CODE ###

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

for i in range(N):
    a = int(input())
    A.append(a)

x = sorted(A, reverse=True)

for i in range(N):
    if A[i] == x[0]:
        print(x[1])
    else:
        print(x[0])
### BUGGY CODE ###

Q=int(input())

n = 10**5
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)

from bisect import bisect_left,bisect_right
lr=[]
for i in range(Q):
    lr=list(map(int, input().split()))
    left=bisect_left(primes, lr[0])
    right=bisect_right(primes, lr[1])
    cnt=0
    for p in primes[left:right]:
        if p!=2 and (p+1)//2 in primes:
            cnt+=1
    print(cnt)

### FIXED CODE ###

Q=int(input())

n = 10**5
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)

from bisect import bisect_left,bisect_right
import numpy as np

ls=[]
rs=[]
for i in range(Q):
    l,r=map(int, input().split())
    ls.append(l)
    rs.append(r)
lmin=min(ls)
rmax=max(rs)
bool_prime=np.zeros(rmax+1,dtype=np.int64)
bool_2007=np.zeros(rmax+1,dtype=np.int64)

for p in primes:
    if p>rmax:
        break
    bool_prime[p]=1
    if p!=2 and bool_prime[(p+1)//2]==1:
        bool_2007[p]=1

cum2007=np.cumsum(bool_2007)
for i in range(Q):
    print(cum2007[rs[i]]-cum2007[ls[i]-1])
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
import collections
from math import gcd
from functools import reduce

from random import randint

def lcm(a, b):
    return abs(a*b) // gcd(a, b)

def find_gcd(list):
    x = reduce(gcd, list)
    return x
def find_lcm(list):
    x = reduce(lcm, list)
    return x

def solve(N: int, A: "List[int]"):



    # q2 = True
    # for a in A:
    #     for b in A:
    #         if a!=b and gcd(a, b) != 1:
    #             q2 = False
    #             break

    prod = 1
    for a in A:
        prod *= a
    q1 = reduce(gcd, A) == 1
    q2 = find_lcm(A) == prod

    if q1 and q2:
        print('pairwise coprime')
    elif q1:
        print('setwise coprime')
    else:
        print('not coprime')
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"

    solve(N, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import collections
from math import gcd
from functools import reduce

from random import randint

def lcm(a, b):
    return abs(a*b) // gcd(a, b)

def find_gcd(list):
    x = reduce(gcd, list)
    return x

def find_lcm(list):
    x = reduce(lambda a,b: lcm(a,b)% MOD, list)
    return x

D = [None for _ in range(10**6)]
MOD = 10**9 + 7
def solve(N: int, A: "List[int]"):

    q1 = reduce(gcd, A) == 1

    def SieveOfEratosthenes(n): 
        prime = [i for i in range(n + 1)] 
        p = 2
        while (p * p <= n): 
            if (prime[p] == p): 
                for i in range(p * 2, n + 1, p): 
                    prime[i] = p
            p += 1
        prime[0]= 0
        prime[1]= 1
        return prime

    D = SieveOfEratosthenes(10**6)
    s = set([])
    q2 = True
    for a in A:
        facs = set([])
        while True:            
            facs.add(D[a])
            a = a // D[a]
            if D[a] == a:
                facs.add(D[a])
                break

        for fac in facs:
            if fac in s:
                if fac != 1 and fac != 0:
                    q2 = False
            s.add(fac)


    if q1 and q2:
        print('pairwise coprime')
    elif q1:
        print('setwise coprime')
    else:
        print('not coprime')
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"

    solve(N, A)

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

line = input()

ori = len(line)

count = 0 

while line.count("ST") is not 0:
    line = line.replace("ST", "") 

print(len(line))

### FIXED CODE ###

line = input()

ori = len(line)

count = 0 

T = 0 
S = 0 

for i in line:
    if i is "S":
        S += 1
    else:
        if S is not 0:
            S -= 1
            count += 1

print(ori - count * 2)
### BUGGY CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
lk=len(bin(K))-2
C=[0]*lk
for j in range(N):
  a=A[j]
  for i in range(lk):
    if a%2==1:
      C[i]+=1
    a=(a-a%2)//2

X="0b"
for i in reversed(range(lk)):
  if C[i]>=N-C[i]:
    X+="0"
  else:
    X+="1"
    
if int(X,0)<=K:
  X=int(X,0)
  ans=0
  for i in range(N):
    ans+=X^A[i]
  print(ans)
else:
  ans=-1
  for i in range(2,lk+2):
    x=int(bin(K)[:i]+"0"+X[i+1:],0)
    if x<=K:
      a=0
      for i in range(N):
        a+=x^A[i]
      ans=max(ans,a)
  print(ans)


### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
lk=len(bin(K))-2
C=[0]*lk
for j in range(N):
  a=A[j]
  for i in range(lk):
    if a%2==1:
      C[i]+=1
    a=(a-a%2)//2

X="0b"
for i in reversed(range(lk)):
  if C[i]>=N-C[i]:
    X+="0"
  else:
    X+="1"
    
if int(X,0)<=K:
  X=int(X,0)
  ans=0
  for i in range(N):
    ans+=X^A[i]
  print(ans)
else:
  ans=-1
  for i in range(2,lk+2):
    x=int(bin(K)[:i]+"0"+X[i+1:],0)
    if x<=K:
      a=0
      for i in range(N):
        a+=x^A[i]
      ans=max(ans,a)
  print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
from heapq import heappush, heappop, heapify
from collections import Counter,defaultdict
dp=defaultdict(lambda: 0)
N,M=map(int, sys.stdin.readline().split())
A=map(int, sys.stdin.readline().split())
BC=defaultdict(lambda: 0)
for _ in range(M):
    b,c=map(int, sys.stdin.readline().split())
    BC[c]+=b

C=Counter(A)
A=C.items()
heapify(A)    #(カードの数字、カード枚数)

for c,b in BC.items():
    while A[0][0]<c and 0<b:
        value=A[0][0]
        cards=A[0][1]
        heappop(A)
        if cards<=b:    #取った枚数以上に手元の枚数を持っていれば、カードを全交換できる
            heappush(A,(c,cards))
        else:     #手元の方が少ない場合
            heappush(A,(c,b))   #新しいカードの値を挿入
            heappush(A,(value,cards-b))   #取ったカードも一部元に戻す
        b-=cards

ans=0
for a,cards in A:
    ans+=a*cards
print ans


### FIXED CODE ###

import sys

N,M=map(int, sys.stdin.readline().split())
A=map(int, sys.stdin.readline().split())
A.sort()

B=[ map(int, sys.stdin.readline().split()) for _ in range(M)] 
B.sort(key=lambda x: x[1], reverse=True)

i=0

for b,c in B:
	for i in range(i,N):
		if A[i]<c and 0<b:
			A[i]=c
			b-=1
		if b==0:
			break
	i+=1

print sum(A)
### BUGGY CODE ###

def main():
    """
    1<=|s|<=5,000
    1<=K<=5
    """
    s = input()
    K = int(input())

    part(s,K)

def part(s,K):
    n = len(s)
    ss = set()
    for i in range(n+1):
        for j in range(i, n):
            subs = s[i:j+1]
            ss.add(subs)

    ans = sorted(ss)[K-1]
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    """
    1<=|s|<=5,000
    1<=K<=5
    """
    s = input()
    K = int(input())

    part(s, K)


def f(s, K):
    """
    K=1, sorted(s)[0]
    K=2, s[min_idx:min_idx+2]
        aabbaac

        min:a, next: aa
        aab<aac
    1-5文字: すべて異なる文字列なら1文字でよい

    minから5種類存在するなら不要
        K個以上存在する
    a: min
    aaaaa: 5th(aa,aaa,aaaaがあれば)

    abced: 完了
    babcd: 途中にaがあるから未完
     abcde: 完了,ただしaaaaaとかあったらNG
    """
    pass


def part(s, K):
    #s = "abcde" * 1000
    n = len(s)
    ss = set()
    for i in range(n):
        # 最初なぜかn文字まで繰り返していたが、辞書順を考えれば不要
        for j in range(i, i+K):
            subs = s[i:j+1]
            # print(subs, i, j, sep="\t")
            ss.add(subs)

    ans = sorted(ss)[K-1]
    print(ans)


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

n,m = (int(x) for x in input().split())
l = [0]*m
r = [0]*m
hoge = [m]*n
for i in range(m):
    l[i],r[i] = (int(x) for x in input().split())
    
for i in range(m):
    for f in range(l[i]-1,r[i]):
        hoge[f] -= 1
count = 0
for j in hoge:
    if j == 0:
        count+= 1

print(count)


### FIXED CODE ###

n, m = (int(x) for x in input().split())
l = [0]*m
r = [0]*m
for i in range(m):
    l[i], r[i] = [int(x) for x in input().split()]
lmax = max(l)
rmin = min(r)
if rmin >= lmax:
    print(rmin-lmax+1)
else:
    print(0)
### BUGGY CODE ###

N = int(input())
emp = list(map(int,input().split()))
def rem_val(arr, value):
    while value in arr:
        try:
            arr.remove(value)
        except:
            pass
for i in range(N):
    print(emp.count(i+1))
    rem_val(emp,i+1)


### FIXED CODE ###

N = int(input())
emp = list(map(int,input().split()))
ans_l = [0]*(N+1)
for i in range(N-1):
    a = emp[i]
    ans_l[a] +=1
for i in range(1,N+1):
    print(ans_l[i])
### BUGGY CODE ###

def main():
    _ = int(input())
    x = 1
    for a in map(int, input().split()):
        x *= a
    if x > 10 ** 18:
        print(-1)
    else:
        print(x)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    _ = input()
    a = sorted(list(map(int, input().split())), reverse=True)
    if a[-1] == 0:
        print(0)
        return
    x = 1
    m = 10 ** 18
    for i in a:
        if i < 2:
            continue
        x *= i
        if x > m:
            print(-1)
            return
    print(-1 if x > 10 ** 18 else x)


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

#!/usr/bin/env python3
import sys


def solve(N: int, M: int, V: int, P: int, A: "List[int]"):
    P -= 1
    A = sorted(A, reverse=True)
    result = 0
    for n in range(N):
        if n < P:
            result += 1
        elif A[n] + M < A[P]:
            continue
        else:
            affords = M * V - M
            affords -= M * P
            if affords <= 0:
                result += 1
                continue
            break_flag = False
            for p in range(P, N):
                if p == n:
                    continue
                else:
                    affords -= min(A[n] + M - A[p], M)
                    if affords<=0:
                        result += 1
                        break
    print(result)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    V = int(next(tokens))  # type: int
    P = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, V, P, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, M: int, V: int, P: int, A: "List[int]"):
    P -= 1
    A = sorted(A, reverse=True)

    result = 0

    cumsum = [0 for i in range(N+1)]
    for n in range(N-1):
        cumsum[n+1] = A[n] + cumsum[n]

    for n in range(N):
        if n < P:
            result += 1
        elif A[n] + M < A[P]:
            continue
        else:
            affords = M * V - M - M * (P-1)
            if affords <= 0:
                result += 1
                continue
            
            sunmmation = A[n] * (n-P) + M * (n-P) - (cumsum[n] - cumsum[P])
            affords -= sunmmation
            affords -= (N-n) * M

            if affords <= 0:
                result += 1
                continue
    print(result)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    V = int(next(tokens))  # type: int
    P = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, V, P, A)

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

class UnionFind:
    def __init__(self, size):
        self.rank = [-1 for _ in range(size)]
        self.number = [1 for _ in range(size)]

    def find(self, x):
        while self.rank[x] >= 0:
            x = self.rank[x]
        return x

    def union(self, s1, s2):
        if s1 == s2:
            return
        if self.rank[s1] == self.rank[s2]:
            self.rank[s1] -= 1
            self.rank[s2] = s1
            self.number[s1] += self.number[s2]
        elif self.rank[s1] < self.rank[s2]:
            self.rank[s2] = s1
            self.number[s1] += self.number[s2]
        else:
            self.rank[s1] = s2
            self.number[s2] += self.number[s1]


n, K, L = map(int, input().split())
pq = [tuple(int(x) for x in input().split()) for _ in range(K)]
rs = [tuple(int(x) for x in input().split()) for _ in range(L)]

uk = UnionFind(n)
for p, q in pq:
    rp = uk.find(p - 1)
    rq = uk.find(q - 1)
    if rp != rq:
        uk.union(rp, rq)

ul = UnionFind(n)
for p, q in rs:
    rp = ul.find(p - 1)
    rq = ul.find(q - 1)
    if rp != rq:
        ul.union(rp, rq)

ans = ['' for _ in range(n)]
for i in range(n):
    temp = 0
    for j in range(n):
        if uk.find(i) == uk.find(j) and ul.find(i) == ul.find(j):
            temp += 1
    ans[i] = str(temp)

print(' '.join(ans))




### FIXED CODE ###

from collections import Counter

class UnionFind:
    def __init__(self, N):
        self.p = list(range(N))
        self.rank = [0] * N
        self.size = [1] * N

    def find_root(self, x):
        if self.p[x] != x:
            self.p[x] = self.find_root(self.p[x])

        return self.p[x]

    def same(self, x, y):
        return self.find_root(x) == self.find_root(y)

    def unite(self, x, y):
        u = self.find_root(x)
        v = self.find_root(y)

        if u == v: return

        if self.rank[u] < self.rank[v]:
            self.p[u] = v
            self.size[v] += self.size[u]
            self.size[u] = 0
        else:
            self.p[v] = u
            self.size[u] += self.size[v]
            self.size[v] = 0

            if self.rank[u] == self.rank[v]:
                self.rank[u] += 1

    def get_size(self, x):
        return self.size[self.find_root(x)]


n, K, L = map(int, input().split())
pq = [tuple(int(x)-1 for x in input().split()) for _ in range(K)]
rs = [tuple(int(x)-1 for x in input().split()) for _ in range(L)]

uk = UnionFind(n)
for p, q in pq:
    uk.unite(p, q)

ul = UnionFind(n)
for p, q in rs:
    ul.unite(p, q)

res = [uk.find_root(i) * 1000000 +  ul.find_root(i) for i in range(n)]
c = Counter(res)
ans = [0] * n

for i in range(n):
    ans[i] = c[res[i]]

print(*ans, sep=' ')
### BUGGY CODE ###

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

dp = [[0] * (n+1) for _ in range(n+1)]
ans = 0

for i in range(n):
    for j in range(i,n):
        if s[i] == s[j]:
            dp[i+1][j+1] = dp[i][j] + 1
            ans = max(ans, min(j-i, dp[i+1][j+1]))

print(ans)


### FIXED CODE ###

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

dp = [[0] * (n+1) for _ in range(n+1)]
ans = 0

for i in range(n):
    for j in range(i,n):
        if s[i] == s[j]:
            dp[i+1][j+1] = dp[i][j] + 1
            ans = max(ans, min(j-i, dp[i+1][j+1]))

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

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,m = mi()
tree = [[] for _ in range(n)]
for i in range(m):
    s,t = mi()
    tree[s-1].append(t-1)
import copy
dp = [0]*n
for i in reversed(range(n-1)):
    size = len(tree[i])
    for k in tree[i]:
        dp[i] += dp[k] 
    dp[i] /= size
    dp[i] += 1
ans = dp[0]
dp_tmp = copy.copy(dp)

def func(ss,tt):
    dp_tmp = copy.copy(dp)
    tmp = 0
    for l in tree[ss]:
        if l == tt:
            continue
        tmp += dp_tmp[l]
    dp_tmp[ss] = tmp/(len(tree[ss])-1) + 1
    
    for a in reversed(range(ss)):
        tmp = 0
        for b in tree[a]:
            tmp += dp_tmp[b]
        dp_tmp[a] = tmp/len(tree[a]) + 1
    
    return dp_tmp[0]

for i in reversed(range(n-1)):
    if len(tree[i]) == 1:
        continue
    for k in tree[i]:
        ans = min(ans,func(i,k))
print(ans)






### FIXED CODE ###

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,m = mi()
tree = [[] for _ in range(n)]
for i in range(m):
    s,t = mi()
    tree[s-1].append(t-1)
dp = [0]*n
for i in reversed(range(n-1)):
    size = len(tree[i])
    for k in tree[i]:
        dp[i] += dp[k] 
    dp[i] /= size
    dp[i] += 1
ans = dp[0]

def func(ss,tt):
    tmp = 0
    for l in tree[ss]:
        if l == tt:
            continue
        tmp += dp[l]
    tmp = tmp/(len(tree[ss])-1) + 1
    if tmp > dp[ss]:
        return dp[0]
    else:
        dp[ss] = tmp
    
    for a in reversed(range(ss)):
        tmp = 0
        for b in tree[a]:
            tmp += dp[b]
        dp[a] = tmp/len(tree[a]) + 1
    
    return dp[0]

for i in range(n-1):
    if len(tree[i]) == 1:
        continue
    for k in tree[i]:
        ans = min(ans,func(i,k))
print(ans)
### BUGGY CODE ###

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

ans = []
for i in range(n):
    tmp = 0
    for j in range(n):
        if i==j:
            continue
        tmp=A[j]^tmp
    ans.append(tmp)
print(' '.join(map(str,ans)))

### FIXED CODE ###

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

xor_sum = 0
for i in range(n):
    xor_sum = xor_sum^A[i]

ans = []
for i in range(n):
    ans.append(xor_sum^A[i])
print(' '.join(map(str,ans)))
### BUGGY CODE ###

a, b = map(int, input().split())
s = 1
for i in range(a, b+1):
  s *= i
print("Positive" if s > 0 else "Negative" if s < 0 else "Zero")

### FIXED CODE ###

a, b = map(int, input().split())
if a <= 0 <= b:
  print("Zero")
elif a > 0:
  print("Positive")
else:
  if (b - a + 1) % 2 == 0:
    print("Positive")
  else:
    print("Negative")
### BUGGY CODE ###

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

num = 0
for x in range(sk[0] + 1):
  for y in range(sk[0] + 1):
    for z in range(sk[0] + 1):
      if (x + y + z) == sk[1]:
        num += 1
        

print(num)


### FIXED CODE ###

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

num = 0
for x in range(sk[0] + 1):
	for y in range(sk[0] + 1):
		if x + y <= sk[1] and sk[1] - x - y <= sk[0]:
			num += 1
        

print(num)
### BUGGY CODE ###

# coding: utf-8
from collections import defaultdict
from itertools import combinations

def main():
    A = str(input())
    set_all = set()
    set_all.add(A)
    for i in range(2, len(A) + 1):
        for j in range(len(A) - i + 1):
            _i, _j = j, i + j - 1
            if _i == 0:
                a = A[_j::-1] + A[_j + 1:]
            else:
                a = A[:_i] + A[_j:_i - 1:-1] + A[_j + 1:]
            if a in set_all:
                continue
                # print(_i, _j)
                # print(a)
            else:
                set_all.add(a)
    print(len(set_all))



if __name__ == "__main__":
    main()


### FIXED CODE ###

# coding: utf-8
from collections import defaultdict
import math

def nCr(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n - r)


def main():
    A = str(input())
    d_ind = defaultdict(list)
    for ind, a in enumerate(A):
        d_ind[a].append(ind)
    ans = 1 + sum(range(len(A)))
    for ind in d_ind.values():
        if len(ind) == 1:
            continue
        ans -= nCr(len(ind), 2)
    print(ans)


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

import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
    n = int(input())

    maxa2 = n + 1
    maxa2 = max(6, maxa2)  # maxa2が6未満だとエラーになる
    p = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(maxa2)]
    p[0] = p[1] = False
    p[2] = p[3] = p[5] = True
    for is1 in range(3, maxa2, 2):
        for is2 in range(is1 ** 2, maxa2, is1):
            p[is2] = False
    prime_list = [i for i, b in enumerate(p) if b]

    nums = [i for i in range(n + 1)]
    prime_nums = {e: defaultdict(int) for e in range(n + 1)}
    for prime in prime_list:
        p = prime
        for i1 in range(n // prime):
            t1 = nums[p]
            jisu = 0
            while t1 > 1 and t1 % prime == 0:
                jisu += 1
                t1 = t1 // prime
            nums[p] = t1
            prime_nums[p][prime] = jisu
            p += prime
    r = 0
    for i, pre in enumerate(prime_nums.values()):
        t2 = i
        for v in pre.values():
            t2 *= (v + 1)
        r += t2
    print(r)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
read = sys.stdin.read
from math import sqrt, floor
def main():
    n = int(input())
    if n == 1:
        print(1)
        sys.exit()
    # nd:num of div
    nd = [2] * (n + 1)

    for i1 in range(2, floor(n / 2) + 1):
        for i2 in range(i1 * 2, n + 1, i1):
            nd[i2] += 1

    r = 1
    for j1 in range(2, n + 1):
        r += nd[j1] * j1
    print(r)

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

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

ans = []
for i in range(n):
  if i%2 ==0:
    ans.append(a[i])
  else:
    ans.insert(0,a[i])

print(str(ans).replace("[","").replace("]","").replace(",","") if n%2 ==0 else str(ans[::-1]).replace("[","").replace("]","").replace(",","") )

### FIXED CODE ###

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

ans=[0]*n
for i in range(n):
  if i%2 ==0:
    ans[n//2+i//2]=a[i]
  else:
    ans[n//2-i//2-1]=a[i]

print(str(ans).replace("[","").replace("]","").replace(",","") if n%2 ==0 else str(ans[::-1]).replace("[","").replace("]","").replace(",","") )