Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(100000)

N = int(input())
T = [int(input()) for i in range(N)]

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

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

ans = T[0]
for i in range(1, len(T)):
    ans = lcm(ans, T[i])

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

N = int(input())
T = [int(input()) for i in range(N)]

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

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

ans = T[0]
for i in range(1, N):
    ans = lcm(ans, T[i])

print(ans)
def resolve():
    A,B,C = map(int,input().split())
    count = 0
    if A == C and A == B:
        if A % 2 == 1:
            print(0)
        else:
            print(-1)
    else:
        while (A % 2 == 0 and B % 2 == 0 and C % 2 == 0):
            tmpA = (B + C) / 2 
            tmpB = (A + C) / 2 
            tmpC = (A + B) / 2
            A = tmpA
            B = tmpB
            C = tmpC
            count = count + 1
        print(count)
resolve():

### FIXED CODE ###

def resolve():
    A,B,C = map(int,input().split())
    count = 0
    if A == C and A == B:
        if A % 2 == 1:
            print(0)
        else:
            print(-1)
    else:
        while (A % 2 == 0 and B % 2 == 0 and C % 2 == 0):
            tmpA = (B + C) / 2 
            tmpB = (A + C) / 2 
            tmpC = (A + B) / 2
            A = tmpA
            B = tmpB
            C = tmpC
            count = count + 1
        print(count)
resolve()
import sys
sys.setrecursionlimit(3000)

def test(a,s,i):
    if i==len(a) or a[i]>s : return []
    if a[i]==s:return [[i]]
    else: return [[i]+x for x in test(a,s-a[i],i+1)]+test(a,s,i+1)
        

n,s=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a)
l=test(a,s,0)
out=0
for s in l:
    out+=2**(len(a)-len(s))
print(out%998244353)

### FIXED CODE ###

n,s=map(int,input().split()) 
a=list(map(int,input().split()))
d=[[0]*(s+1) for _ in range(n+1)]
d[0][0]=1
for j in range(0,s+1):
    for i in range(1,n+1):
        d[i][j]=2*d[i-1][j]
        if a[i-1]<=j:
            d[i][j]+=d[i-1][j-a[i-1]]
        d[i][j]=d[i][j]%998244353
print(d[n][s])
a_list=[1,2,3]
p,q= input().split()
a_list.remove(int(p))
a_list.remove(int(q))
print(a_list[0])

### FIXED CODE ###

a_list=[1,2,3]
p= input()
q=input()
a_list.remove(int(p))
a_list.remove(int(q))
print(a_list[0])
[N, M] = list(map(int, input().split()))
[s, e] = [ [], [] ]
for _ in range(M):
  input_line = list(map(int, input().split()))
  s.append(input_line[0])
  e.append(input_line[1])
bucket = {}

for i in range(M):
  if s[i] in bucket and e[i] in bucket:
    bucket[s[i]].append(s[i])
    bucket[e[i]].append(e[i])
  elif s[i] in bucket:
    bucket[s[i]].append(s[i])
    bucket[e[i]] = [e[i]]
  elif e[i] in bucket:
    bucket[s[i]] = [s[i]]
    bucket[e[i]].append(e[i])
  else:
    bucket[s[i]] = [s[i]]
    bucket[e[i]] = [e[i]]

for i in range(1, N+1):
  print(len(bucket[i]))

### FIXED CODE ###

[N, M] = list(map(int, input().split()))
[s, e] = [ [], [] ]
for _ in range(M):
  input_line = list(map(int, input().split()))
  s.append(input_line[0])
  e.append(input_line[1])
bucket = {}
for i in range(1, N+1):
  bucket[i] = []

for i in range(M):
  if s[i] in bucket and e[i] in bucket:
    bucket[s[i]].append(s[i])
    bucket[e[i]].append(e[i])
  elif s[i] in bucket:
    bucket[s[i]].append(s[i])
    bucket[e[i]] = [e[i]]
  elif e[i] in bucket:
    bucket[s[i]] = [s[i]]
    bucket[e[i]].append(e[i])
  else:
    bucket[s[i]] = [s[i]]
    bucket[e[i]] = [e[i]]

for i in range(1, N+1):
  print(len(bucket[i]))
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=10**9+7

r1,c1,r2,c2=map(int,input().split())

# MOD combination
def cmb(n, r, mod=10**9+7):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

N = 10**6*2
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def g(r,c):
    tmp=cmb(r+1+c+1,r+1)-1
    return tmp%mod

ans=0
ans+=g(r2,c2)
ans-=g(r2,c1-1)
ans-=g(r1-1,c2)
ans+=g(r1-1,c1-1)
ans%=mod
print(ans)

### FIXED CODE ###

import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=10**9+7

r1,c1,r2,c2=map(int,input().split())

# MOD combination
def cmb(n, r, mod=10**9+7):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

N = 10**6*2+10
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def g(r,c):
    tmp=0
    for i in range(1,r+2):
        tmp+=cmb(i+c,i)
        tmp%=mod
    return tmp

ans=0
ans+=g(r2,c2)
ans-=g(r2,c1-1)
ans-=g(r1-1,c2)
ans+=g(r1-1,c1-1)
ans%=mod
print(ans)
X, N = map(int, input().split(' '))
if N == 0:
    print(X)
else:
    P_ls = list(map(int, input().split(' ')))
    P_ls.sort(reverse=True)
    diff = -1
    for i in range(100, -1, -1):
        if i not in P_ls:
            if diff == -1:
                diff = abs(X - i)
            else:
                diff = min(diff, abs(X - i))
                if diff == abs(X-i):
                    rst = i
    print(rst)

### FIXED CODE ###

x, n = map(int, input().split(' '))
min_num = 100

ls = [0] * 201
for i in range(0, 201):
    ls[i] = i

ls_in = [0] * n
if n > 0:
    ls_in = list(map(int, input().split(' ')))
    for i in ls_in:
        ls.remove(i)
    ls.reverse()
    for i in ls:
        min_num = min(abs(x-i), min_num)
        if abs(x-i) == min_num:
            ans = i 
    print(ans)
else:
    print(x)
import math
from functools import reduce

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
N=int(input())
A = [int(j) for j in input().split()]

print(lcm(*A)-1)

### FIXED CODE ###

#ABC 103
N=int(input())
A = [int(j) for j in input().split()]
print(sum(A)-len(A))
# coding: utf-8
# Your code here!
N=int(input())

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

if N==2:
  print(max(0,A[0],A[1]))

dp=[[-10**18 for i in range(N)] for j in range(3)]
dp[0][0]=A[0]
dp[1][1]=A[1]
dp[2][2]=A[2]

for n in range(3):
    for index in range(N):
        if dp[n][index]!=-1:
            if n!=2 and index+3<N:
                dp[n+1][index+3]=max(dp[n+1][index+3],dp[n][index]+A[index+3])
            if n==0 and index+4<N:
                dp[n+2][index+4]=max(dp[n+2][index+4],dp[n][index]+A[index+4])
            if index+2<N:
                dp[n][index+2]=max(dp[n][index+2],dp[n][index]+A[index+2])

a=(dp[0][-1])
b=(dp[1][-1])
c=(dp[2][-1])

print(max(a,b,c))


        


### FIXED CODE ###

# coding: utf-8
# Your code here!
N=int(input())

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

if N==2:
    print(max(0,A[0],A[1]))
    exit()
if N==3:
    print(max(0,A[0],A[1],A[2]))
    exit()

dp=[[-10**18 for i in range(N)] for j in range(3)]
dp[0][0]=A[0]
dp[1][1]=A[1]
dp[2][2]=A[2]

for n in range(3):
    for index in range(N):
        if dp[n][index]!=-1:
            if n!=2 and index+3<N:
                dp[n+1][index+3]=max(dp[n+1][index+3],dp[n][index]+A[index+3])
            if n==0 and index+4<N:
                dp[n+2][index+4]=max(dp[n+2][index+4],dp[n][index]+A[index+4])
            if index+2<N:
                dp[n][index+2]=max(dp[n][index+2],dp[n][index]+A[index+2])

a=(dp[0][-1])
b=(dp[1][-1])
c=(dp[2][-1])

print(max(a,b,c))
import copy
n, k = input().split()
m = list(map(int, input().split()))
ans = 0
kazu =[]
kai = []
kitai2 = 0
for x in range(int(n)):
    kazu = []
    for l in range(int(k) - (int(k)-1)):
        if x+l < len(m):
           kazu.append(m[x+l])
    if ans < sum(kazu):
        ans = sum(kazu)
        kai = copy.deepcopy(kazu)

for j in range(int(k)):
    kitai = 0
    for g in range(kai[j]):
        kitai += g+1
    kitai2 += kitai / kai[j]
print(kitai2)

### FIXED CODE ###

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

m = [(e + 1) / 2 for e in p]

t = sum(m[0:K])
result = t
for i in range(N - K):
    t -= m[i]
    t += m[i + K]
    if t > result:
        result = t
print(result)
input_iter = iter(input_str.split("\n"))
def input() : return next(input_iter)
n,m,l=map(int,input().split())
abc=[list(map(int,input().split())) for _ in [0]*m]
q=int(input())
st=[list(map(int,input().split())) for _ in [0]*q]
inf=10**12
dist=[[inf]*n for _ in [0]*n]
for i in range(n):
    dist[i][i]=0
for a,b,c in abc:
    dist[a-1][b-1]=c
    dist[b-1][a-1]=c
for k in range(n):
    for i in range(n):
        for j in range(n):
            dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j])
inf=10**3
dist2=[[inf]*n for _ in [0]*n]
for i in range(n):
    for j in range(n):
        if dist[i][j]<=l:
            dist2[i][j]=1
for k in range(n):
    for i in range(n):
        for j in range(n):
            dist2[i][j]=min(dist2[i][j],dist2[i][k]+dist2[k][j])
for i in range(n):
    for j in range(n):
        if dist2[i][j]==inf:
            dist2[i][j]=-1
        else:
            dist2[i][j]-=1
for s,t in st:
    print(dist2[s-1][t-1])

### FIXED CODE ###

n,m,l=map(int,input().split())
abc=[list(map(int,input().split())) for _ in [0]*m]
q=int(input())
st=[list(map(int,input().split())) for _ in [0]*q]
inf=10**12
dist=[[inf]*n for _ in [0]*n]
for i in range(n):
    dist[i][i]=0
for a,b,c in abc:
    dist[a-1][b-1]=c
    dist[b-1][a-1]=c
for k in range(n):
    for i in range(n):
        for j in range(n):
            dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j])
inf=10**3
dist2=[[inf]*n for _ in [0]*n]
for i in range(n):
    for j in range(n):
        if dist[i][j]<=l:
            dist2[i][j]=1
for k in range(n):
    for i in range(n):
        for j in range(n):
            dist2[i][j]=min(dist2[i][j],dist2[i][k]+dist2[k][j])
for i in range(n):
    for j in range(n):
        if dist2[i][j]==inf:
            dist2[i][j]=-1
        else:
            dist2[i][j]-=1
for s,t in st:
    print(dist2[s-1][t-1])
n = int(input())
a = list(map(int, input().split()))
q = int(input())
dic = [0 for _ in range(10 ** 5)]
count = 0
for i in a:
    dic[i] += 1
    count += i

for i in range(q):
    b, c = map(int,input().split())
    count -= b * dic[b]
    dic[c] += dic[b]
    count += c * dic[b]
    dic[b] = 0
    print(count)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
q = int(input())
dic = [0 for _ in range(10 ** 5 + 1)]
count = 0
for i in a:
    dic[i] += 1
    count += i

for i in range(q):
    b, c = map(int,input().split())
    count -= b * dic[b]
    dic[c] += dic[b]
    count += c * dic[b]
    dic[b] = 0
    print(count)
N, K = map(int, input().split())
P = 10**9+7
def calc(n):
    X = [1]
    a, b = n, 1
    for i in range(n):
        X.append(X[-1]*a*pow(b, P-2, P)%P)
        a, b = a-1, b+1
    return [0]+X+[0,0]
B = calc(K-1)
R = calc(N-K-1)
for i in range(1, K+1):
    print(B[i] * (R[i-1]+2*R[i]+R[i+1]) % P)

### FIXED CODE ###

N, K = map(int, input().split())
P = 10**9+7
def calc(n):
    X = [1]
    a, b = n, 1
    for i in range(n):
        X.append(X[-1]*a*pow(b, P-2, P)%P)
        a, b = a-1, b+1
    return [0]+X+[0]*3000
B = calc(K-1)
R = calc(N-K-1)
if N==K:
    print(1)
    for i in range(K-1):
        print(0)
else:
    for i in range(1, K+1):
        print(B[i] * (R[i-1]+2*R[i]+R[i+1]) % P)
a,b = int(input().split())

sum = a+b
if(sum>=10):
  print("error")
 else:
  print(sum)

### FIXED CODE ###

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

sum = a + b
if sum >= 10:
    print("error")
else:
    print(sum)
n = int(input())
s = list(input())
a = {}
b = {}
c = []
for i in range(n//2):
  a = set([:i+1])
  b = set([i+1:])
  c.append(len((a^b)))
  a.clear()
  b.clear()
print(max(c))
  

### FIXED CODE ###

n = int(input())
s = list(input())
a = {}
b = {}
c = []
for i in range(n):
  a = set(s[:i+1])
  b = set(s[i+1:])
  c.append(len((a&b)))
  a.clear()
  b.clear()
print(max(c))
a,b,c=input(map(int,split()))
if a==b==c:
  print('No')
elif a!=b and b!=c and c!=a:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

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

if a==b and b==c and c==a:
  print('No')
elif a!=b and b!=c and c!=a:
  print('No')
else:
  print('Yes')
N = int(input())
S = input()
L = [0] * N
for i in range(N):
    if S[i] == "#":
        # white
        L[i] = 1
    else:
        L[i] = 0
# L = np.array(L, dtype=np.int8)
L2 = np.zeros(N, dtype=np.int16)
# ans = np.abs((L - L2)).sum()
# for i in range(N):
#     L2[N-1-i] = 1
#     ans_tmp = np.abs((L - L2)).sum()
#     ans = min(ans, ans_tmp)
# print(ans)
all_whitedist = np.abs((L - L2)).sum()
dist = np.zeros(N, dtype=np.int16)
dist[0:] = all_whitedist
dist[0] = all_whitedist
for i in range(N):
    if L[N-1-i] == 1:
        dist[i:] -= 1
    else:
        dist[:i] -= 1
indx = np.where(dist == dist.min())[0][0]
L3 = np.zeros(N, dtype=np.int16)
L3[indx:] = 1
ans_tmp = np.abs((L - L3)).sum()
print(min(all_whitedist, ans_tmp))

### FIXED CODE ###

N = int(input())
S = input()
L = [0] * N
for i in range(N):
    if S[i] == "#":
        L[i] = 1
    else:
        L[i] = 0

leftblack = 0
rightwhite = len([x for x in L if x == 0])
ans = leftblack + rightwhite

for i in range(N):
    if S[i] == "#":
        leftblack += 1
    else:
        rightwhite -=1
    ans = min(ans, leftblack + rightwhite)
print(ans)
a, b, c =  [ int(v) for v in input().split() ]

if (a-b) == (b-c):
  print("YES")
else:
  print("NO)

### FIXED CODE ###

a, b, c =  [ int(v) for v in input().split() ]

if (a-b) == (b-c):
  print("YES")
else:
  print("NO")
A = int(input('A = '))
B = int(input('B = '))
C = int(input('C = '))
K = int(input('Selected number = '))
#----------以上入力----------
if A+B >= K:
    print(A)
else:
    print(A-(K-A-B))

### FIXED CODE ###

#ABC167
A,B,C,K=map(int,input().split())
#----------以上入力----------
if A > K:
    print(K)
elif  A+B >= K:
    print(A)
else:
    print(A-(K-A-B))
n,x,t=map(int,input().split())

if n%x==0:
  print(t*(n//x))
  
esle:
  print(t*(n//x+1))

### FIXED CODE ###

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

if n%x==0:
  print(t*(n//x))
  
else:
  print(t*(n//x+1))
print((int(input())-1)*(int(input())-1))

### FIXED CODE ###

m,n=map(int,input().split())
print((m-1)*(n-1))
from fractions import gcd
from functools import reduce, lru_cache

MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

@lru_cache
def lcm(x, y):
    return int(x*y)//int(gcd(x, y))

B = [1 for i in range(N)]
global_lcm = reduce(lcm, A)
ans = 0
for i in range(N):
    B[i] = int(global_lcm//A[i])
    ans += B[i] % MOD
    ans %= MOD

print(ans)

### FIXED CODE ###

from fractions import gcd
from functools import reduce, lru_cache

MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

def lcm(x, y):
    return int(x*y)//int(gcd(x, y))

B = [1 for i in range(N)]
global_lcm = reduce(lcm, A) % MOD
ans = 0
for i in range(N):
    ans += (global_lcm*pow(A[i], MOD-2, MOD)) % MOD
    ans %= MOD

print(ans)
n = int(input())
s = [int(input()) for i in range(n)]

tango = []
count = 0
for i in s:
  if i not in tango:
    count += 1
    tango.append(i)
print(count)

### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]

print(len(list(set(s))))
# 75

from fractions import Fraction

MOD = 10**9+7
N = int(input())
g_l = [[] for i in range(N)]
check_l = [-1] * N
num_l = [0] * N
for i in range(N-1):
    ai, bi = map(int, input().split())
    g_l[ai-1].append(bi-1)
    g_l[bi-1].append(ai-1)


def dfs(n):
    d = 1
    if check_l[n] > 0:
        return num_l[n]
    check_l[n] = 1
    for next_n in g_l[n]:
        d += dfs(next_n)
    num_l[n] = d
    return d


def modpow(a, n):
    # calc : (a**n)%MOD
    ret = 1
    while n > 0:
        if n & 1:
            ret = (ret * a) % MOD
        a = (a * a) % MOD
        n >>= 1
    return ret


def modinv(a):
    # calc : (a**(-1)) %MOD
    return modpow(a, MOD-2)


dfs(0)

ans = 0
for i in range(1, N):
    ans += (1 - (1/2)**num_l[i]) * (1 - (1/2)**(N-num_l[i]))
ans += 1 - (1/2)**N  # 辺の期待値→頂点の期待値に変換(空集合以外は+1される)
ans -= N/2  # 黒点の期待値を引く

tmp = Fraction(ans)
x = tmp.denominator
y = tmp.numerator

z = (modinv(x) * y) % MOD

print(z)


### FIXED CODE ###

# 75

import sys
sys.setrecursionlimit(10**8)

MOD = 10**9+7
N = int(input())
g_l = [[] for i in range(N)]
check_l = [-1] * N
num_l = [0] * N
for i in range(N-1):
    ai, bi = map(int, input().split())
    g_l[ai-1].append(bi-1)
    g_l[bi-1].append(ai-1)


def dfs(n):
    d = 1
    if check_l[n] > 0:
        return num_l[n]
    check_l[n] = 1
    for next_n in g_l[n]:
        d += dfs(next_n)
    num_l[n] = d
    return d


def modinv(a):
    # calc : (a**(-1)) %MOD
    return pow(a, MOD-2, MOD)


def solve():
    dfs(0)
    pow_l = [None]*(N+1)
    pow_l[0] = 1
    for i in range(1, N+1):
        pow_l[i] = (pow_l[i-1] * 2) % MOD

    ans = 0
    # for i in range(1, N):
    #     ans += (1 - (1/2)**num_l[i]) * (1 - (1/2)**(N-num_l[i]))
    # ans += 1 - (1/2)**N  # 辺の期待値→頂点の期待値に変換(空集合以外は+1される)
    # ans -= N/2  # 黒点の期待値を引く
    for i in range(1, N):
        ans = (ans + (pow_l[num_l[i]]-1) *
               (pow_l[N-num_l[i]]-1) % MOD) % MOD
    ans = (ans + (pow_l[N] - 1) - (N * pow_l[N-1]) % MOD) % MOD
    y = ans
    x = pow(2, N, MOD)

    z = (y * modinv(x)) % MOD

    print(z)


solve()
n,a,b,c,d=map(int,input().split())
a-=1;b-=1;c-=1;d-=1 
from collections import deque 

queueA=deque([a])
queueB=deque([b])
S=input()
JinA=JinB=[0]*n 
if c<b or c<d:
    for i in range(a,d):
        if S[i]=="#" and S[i+1]=="#":
            print("No")
            exit() 
    else:
        print("Yes")
        exit()
    
else:
    for j in range(a,max(c,d)):
        if S[i]=="#" and S[i+1]=="#":
            print("No")
            exit() 
    for i in range(n-2):
        if S[i]==S[i+1]==S[i+2]==".":
            print("Yes")
            exit()
    else:
        print('No')


### FIXED CODE ###

int1 = lambda x: int(x) - 1
N, A, B, C, D = map(int1, input().split())
S = input()

if "##" not in S[A:B+1] and "##" not in S[C:D+1]:
    if C > D and "..." not in S[B-1:D+2]:
        print("No")
    else:
        print("Yes")
else:
    print("No")
n = int(input())
s = input()
k = int(input())

t = s.replace(s[k],"*")
    
print(t)

### FIXED CODE ###

n = int(input())
s = input()
t = [i for i in s]
k = int(input())
moji = " "
for j in range(len(t)):
  if t[j] != t[k-1]:
    t[j]="*"

for k in t:
  moji+=k
print(moji)
a=int(input().split())
ans=a//2
if a%2 == 1:
  ans=ans+1
print(ans)


### FIXED CODE ###

a=int(input())
ans=a//2
if a%2 == 1:
  ans=ans+1
print(ans)
n = int(input())
counter = 0
s = "TEMP"
list = []

while n > 0:
  s = input()
  list.append(s)
  counter = 0
  for item in list:
    if item == s
      counter = counter - 1
    counter = counter + 1
  n = n - 1

print(counter)

### FIXED CODE ###

n = int(input())
counter = 0
s = "TEMP"
list = []
temp = ''

while n > 0:
  s = input()
  list.append(s)
  n = n - 1

list.sort()
for item in list:
  if item == temp:
    counter = counter - 1
  counter = counter + 1
  temp = item

print(counter)
import math
MOD = 10**9+7

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

MAX = 10**6
C = [0 for _ in range(MAX+1)]
A.sort()
for a in A:
  C[a] += 1
MAX = A[-1]

ans = 1
P = [1 for _ in range(MAX+1)] #素数かどうか
P[0] = 0
P[1] = 0
lim = math.sqrt(MAX) + 1
S = [0 for _ in range(MAX+1)] #最小公倍数の素因数分解したもの
for i in range(2,int(lim+2)):
  #素数でないなら以下の手順を行わない
  if P[i] == 0:
    continue
  #エラトステネスの篩
  k = i*2
  while k <= MAX:
    P[k] = 0
    k += i
  ind = 0
  k = 1
  while k <= MAX:
    k *= i
    ind += 1
  k = k // i 
  ind -= 1
  #最大のべきを調べる
  while k > 1:
    l = k
    flag = False
    while l <= MAX:
      if C[l] > 0:
        flag = True
        break
      l += k
    if flag:
      break
    k = k // i
    ind -= 1
  S[i] = ind
  ans *= pow(i,ind,MOD)
  ans %= MOD
    
#モジュラ逆数
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m
      
B = [0 for _ in range(MAX+1)]
ans_2 = 0
for a in A:
  if B[a] > 0:
    ans_2 += B[a]
  else:
    B[a] = modinv(a, MOD)
    ans_2 += B[a]    
  ans_2 %= MOD 

#print(ans, ans_2, P, S, B)
print((ans * ans_2) % MOD)
  

    

### FIXED CODE ###

import math
MOD = 10**9+7

N = int(input())
A = list(map(int,input().split()))
A.sort()
MAX = max(A[-1],2)

C = [0 for _ in range(MAX+1)]

for a in A:
  C[a] += 1

ans = 1
P = [1 for _ in range(MAX+1)] #素数かどうか
P[0] = 0
P[1] = 0
S = [0 for _ in range(MAX+1)] #最小公倍数の素因数分解したもの
for i in range(MAX+1):
  #素数でないなら以下の手順を行わない
  if P[i] == 0:
    continue
  #エラトステネスの篩
  k = i*2
  while k <= MAX:
    P[k] = 0
    k += i
  ind = 0
  k = 1
  while k <= MAX:
    k *= i
    ind += 1
  k = k // i 
  ind -= 1
  #最大のべきを調べる
  while k > 1:
    l = k
    flag = False
    while l <= MAX:
      if C[l] > 0:
        flag = True
        break
      l += k
    if flag:
      break
    k = k // i
    ind -= 1
  S[i] = ind
  ans *= pow(i,ind,MOD)
  ans %= MOD
  
#モジュラ逆数
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    #if g != 1:
        #raise Exception('modular inverse does not exist')
    #else:
    return x % m
      
B = [0 for _ in range(MAX+1)]
ans_2 = 0
for a in A:
  if B[a] > 0:
    ans_2 += B[a]
  else:
    B[a] = modinv(a, MOD)
    ans_2 += B[a]    
  ans_2 %= MOD 

#print(ans, ans_2, P, S, B)
print((ans * ans_2) % MOD)
import sys
sys.setrecursionlimit(101010)

N = int(input())
won = [[] for i in range(N)]
for i in range(1,N):
    a = int(input()) - 1
    won[a].append(i)

def height(v):
    if not won[v]: return 0
    hs = [height(op) for op in won[v]]
    ret = 0
    for i,h in enumerate(sorted(hs)):
        ret = max(ret, h + len(hs) - i)
    return ret

print(height(0))

### FIXED CODE ###

import sys
sys.setrecursionlimit(202020)

N = int(input())
won = [[] for i in range(N)]
for i in range(1,N):
    a = int(input()) - 1
    won[a].append(i)

def height(v):
    if not won[v]: return 0
    hs = [height(op) for op in won[v]]
    ret = 0
    for i,h in enumerate(sorted(hs)):
        ret = max(ret, h + len(hs) - i)
    return ret

print(height(0))
x = int(input())

num = x // 100



dp = ["?"] * x
dp[0] = "Yes"

for i in range(1,x+1):
    if i <= 99:
        dp[i] = "No"
    elif i in (100,101,102,103,104,105):
        dp[i] = "Yes"
    else:
        if "Yes" in(dp[i-100],dp[i-101],dp[i-102],dp[i-103],dp[i-104],dp[i-105]):
            dp[i] = "Yes"
        else:
            dp[i] = "No"

            
print(dp[x])

### FIXED CODE ###

x = int(input())

num = x // 100



dp = ["?"] * (x+1)
dp[0] = "1"

for i in range(1,x+1):
    if i <= 99:
        dp[i] = "0"
    elif i in (100,101,102,103,104,105):
        dp[i] = "1"
    else:
        if "1" in(dp[i-100],dp[i-101],dp[i-102],dp[i-103],dp[i-104],dp[i-105]):
            dp[i] = "1"
        else:
            dp[i] = "0"

            
print(dp[x])
import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)
ba = np.array([list(format(i,'b').zfill(60)) for i in a])
print(ba)
mod = 10**9+7


#2^iをmodで割った余りを出しておく
twos = [1]
for i in range(1,60):
    twos.append((twos[i-1]*2)%mod)

#各baのbitごとに0の個数を求める
c0 = np.sum(ba, axis=1)


#答えは各bitごとの(0の数)*(1の数)より求まる
ans = 0
for i in range(60):
    ans += (((c0[59-i]*(n-c0[59-i]))%mod)*twos[i])%mod

ans %= mod
print(int(ans))


### FIXED CODE ###

import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)
mod = 10**9+7

twos = 1
ans = 0
for i in range(0,60):
    cou1 = np.count_nonzero((a >> i) & 1)
    ans += (cou1*(n-cou1)*twos)%mod
    twos = (twos*2)%mod

ans %= mod
print(ans)