Harryxun/stf_run huggingface dataset:
import collections
N, K = map(int, input().split())
A = list(map(int, input().split()))
if K in A:
    print("POSSIBLE")
    exit(0)
else:
    diff = collections.defaultdict(int)
    A.sort()
    idx = N - 1
    if K > A[-1]:
        print("IMPOSSIBLE")
        exit(0)
    else:
        for i in range(N-1):
            if A[i] > K and idx == N - 1:
                idx = i
            diff[A[i+1] - A[i]] += 1

        diff_list = list(diff.keys())
        if 1 in diff_list:
            print("POSSIBLE")
            exit(0)
        else:
            diff_list.sort()
            for i in range(idx, N):
                for j in range(len(diff_list)):
                    if (K - A[i]) % diff_list[j] == 0:
                        print("POSSIBLE")
                        exit(0)
            print("IMPOSSIBLE")
            exit(0)


### FIXED CODE ###

import collections
N, K = map(int, input().split())
A = list(map(int, input().split()))
if K in A:
    print("POSSIBLE")
    exit(0)
else:
    diff = collections.defaultdict(int)
    A.sort()
    idx = N - 1
    if K > A[-1]:
        print("IMPOSSIBLE")
        exit(0)
    else:
        for i in range(N-1):
            if A[i] > K and idx == N - 1:
                idx = i
            if A[i+1] - A[i] != 0:
                diff[A[i+1] - A[i]] += 1

        diff_list = list(diff.keys())
        if 1 in diff_list:
            print("POSSIBLE")
            exit(0)
        else:
            diff_list.sort()
            for i in range(idx, N):
                for j in range(len(diff_list)):
                    if (K - A[i]) % diff_list[j] == 0:
                        print("POSSIBLE")
                        exit(0)
            print("IMPOSSIBLE")
            exit(0)
#best
import fractions
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
    ans = fractions.gcd(ans, a[i])
    if ans==1:
        break
print(ans)

### FIXED CODE ###

#C - Monsters Battle Royale(ABC118)
N=int(input())
A=list(map(int, input().split()))
B=min(A)
i=0
n=1
while i<N:
    a=A[i]%B
    i+=1
    if 0<a<B:
        B=a
        i=0
    elif 0<a:
        i-=1
        A[i]=a
    elif B==1:
        break
print(B)
import copy

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

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

    n, m = map(int, input().split())
    # これだと72がREになる
    A = set([int(x) for x in input().split()])
    # これだと74も78もREになる
    # A = [int(x) for x in input().split()]
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    # Aの要素が複数ならlcmを計算する
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    # 元のAの値とlcmの半分の値を割り切れるものがあったら0
    #for i in A_:
    for i in A:
        if (a_lcm / 2) % i == 0:
        # if (a_lcm / i) % 2 == 0: 
            print(0)
            exit()
        # else:
        #     continue
    # mがlcmの半分よりも小さかったら0
    # if (a_lcm / 2) > m:
    if a_lcm > m * 2:
        print(0)
    else:
        ans = 1 
        print(ans)
        # # あとは定数倍の数調べて終わり
        # ans = int((m - (a_lcm / 2))) // a_lcm + 1
        # ans = int((m - (a_lcm / 2)) // a_lcm) + 1
        # print(ans)
    
        # a_lcm = a_lcm // 2
        # q = m // a_lcm
        # if q % 2 == 0:
        #     ans = q // 2
        # else:
        #     ans = q // 2 + 1
        # print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
# from math import gcd


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

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # mがlcmの半分よりも小さかったら0
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()
import numpy as np

N, D = list(map(int, input().split()))
X = []
for i in range(D):
    x_i = [int(i) for i in input().split()]
    X.append(i)
X = np.array(X)

ans = 0
for i in range(D):
    for j in range(i + 1, D):
        if np.is_integer(np.sqrt(np.sum(X[i] - X[j]) ** 2)):
            ans += 1
print(ans)


### FIXED CODE ###

import numpy as np

def main():
    N, D = list(map(int, input().split()))
    X = []
    for i in range(N):
	    line = [int(a) for a in input().split()]
	    X.append(line)
    X_np = np.array(X)

    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            if(is_dist_int(X_np, D, i, j)):
                ans += 1
    print(ans)

def is_dist_int(X_np, D, i, j):
    dif = np.sum(np.square(np.abs(X_np[i] - X_np[j])))
    dis = np.sqrt(dif)
    return dis.is_integer()

main()
y
XY = list(map(int, input().split()))

if 2 * XY[0] - XY[1] / 2 == 0 and -XY[0] + XY[1] / 2 == 0:
  print('NO')

if 2 * XY[0] - XY[1] / 2 >= 0 and -XY[0] + XY[1] / 2 >= 0:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

XY = list(map(int, input().split()))
 
c = 2 * XY[0] - XY[1] / 2
t = - XY[0] + XY[1] / 2
 
if not (XY[1] / 2).is_integer():
  print('No')
elif c == 0 and t == 0:
  print('No')
elif c >= 0 and t >= 0:
  print('Yes')
else:
  print('No')
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
  if a[i] <= a[i+1]:
    b=i+2
  else:
    print(b)
    exit()

### FIXED CODE ###

a,b=map(int, input().split())
print(max(2*a-1,2*b-1,a+b))
T, X = map(input().split(''))

print(T/X)

### FIXED CODE ###

T, X = [int(i) for i in input().split()]

print(T/X)
N = int(input())

def buy(cost):
    if cost == N:
        print(1)
        exit()
    if cost < N:
        for i in range(100, 106):
            buy(cost+i)
buy(0)

if buy(0) is None:
    print(0)

### FIXED CODE ###

x=int(input())
y=x//100
z=x%100
if z<=y*5:
    print(1)
else:
    print(0)
#coding:utf-8
import numpy as np
n,k = map(int,input().split())
ls = list(map(int,input().split()))

# n, k = 5, 3
# ls = [-30,-10,10,20,50]
#
# n,k = 3,2
# ls=[10,20,30]

# n,k = 1,1
# ls = [0]

# n,k=8,5
# ls=[-9,-7,-4,-3,1,2,3,4]

def set_max(ls):
    if len(ls)>0:
        return set([max(ls)])
    else:
        return set()
def set_min(ls):
    if len(ls)>0
        return set([min(ls)])
    else:
        return set()


plus = list(filter(lambda n:n>=0, ls))
minus = list(filter(lambda n:n<=0, ls))

neighbor = set_max(minus) | set_min(plus)

#print (neighbor)
answer = []
for i in range(n-k+1):
    if len(set(ls[i:i+k])&neighbor)>0:
        #print (ls[i:i+k])
        #print (np.sign(ls[i]*ls[i+k-1]))
        temp = [abs(ls[i]),abs(ls[i+k-1])]
        if np.sign(ls[i]*ls[i+k-1])<0:

            answer.append(2*min(temp)+max(temp))
        else:
            answer.append(max(temp))
print (min(answer))

# first = -1
# for i,point in enumerate(ls):
#     if point >= 0:
#         first = i
#         break
# size=k+1
# ans = []
# for i in range(size):
#     if first-size+i+1>=0 and first+i-1< len(ls):
#         temp = [0,ls[first-size+i+1],ls[first+i-1]]
#         temp = [abs(min(temp)),abs(max(temp))]
#         ans.append((2*min(temp)+max(temp)))
# print (min(ans))


### FIXED CODE ###

#coding:utf-8
import numpy as np
n,k = map(int,input().split())
ls = list(map(int,input().split()))

# n, k = 5, 3
# ls = [-30,-10,10,20,50]
#
# n,k = 3,2
# ls=[10,20,30]

# n,k = 1,1
# ls = [0]

# n,k=8,5
# ls=[-9,-7,-4,-3,1,2,3,4]
if not (0 in ls):
    ls.append(0)
    k+=1
#print (ls)

ls = np.array(ls)
ls.sort()
#print (ls)

idx = np.where(ls==0)[0][0]
#print (idx,k)
#print (idx+k)
start = max(0,idx-k)
goal = min(idx+k,len(ls)-1)

#print (start,goal)
answer = []
for i in range(goal-(k-1)+1):
    #print (i,i+k-1)
    mi = min(abs(ls[i]),abs(ls[i+k-1]))
    ma = max(abs(ls[i]),abs(ls[i+k-1]))
    #print (mi,ma)
    answer.append(2*mi+ma)
print (min(answer))
# def set_max(ls):
#     if len(ls)>0:
#         return set([max(ls)])
#     else:
#         return set()
# def set_min(ls):
#     if len(ls)>0:
#         return set([min(ls)])
#     else:
#         return set()
#
#
# plus = list(filter(lambda n:n>=0, ls))
# minus = list(filter(lambda n:n<=0, ls))
#
# neighbor = set_max(minus) | set_min(plus)
#
# #print (neighbor)
# answer = []
# cnt = 0
# for i in range(n-k+1):
#     if len(set(ls[i:i+k])&neighbor)>0:
#
#         #print (ls[i:i+k])
#         #print (np.sign(ls[i]*ls[i+k-1]))
#         temp = [abs(ls[i]),abs(ls[i+k-1])]
#         if np.sign(ls[i]*ls[i+k-1])<0:
#
#             answer.append(2*min(temp)+max(temp))
#         else:
#             answer.append(max(temp))
#         cnt += 1
#         if cnt == k + 1:
#             break
# print (min(answer))

# first = -1
# for i,point in enumerate(ls):
#     if point >= 0:
#         first = i
#         break
# size=k+1
# ans = []
# for i in range(size):
#     if first-size+i+1>=0 and first+i-1< len(ls):
#         temp = [0,ls[first-size+i+1],ls[first+i-1]]
#         temp = [abs(min(temp)),abs(max(temp))]
#         ans.append((2*min(temp)+max(temp)))
# print (min(ans))
import sys
import math

if sys.version_info[0] >= 3:
    raw_input = input
N = int(raw_input())
for i in range(N):
    x1, y1, x2, y2, x3, y3 = [float(e) for e in raw_input().split()]
    a1 = 2*x2 - 2*x1
    b1 = 2*y2 - 2*y1
    c1 = x1**2 - x2**2 + y1**2 - y2**2
    a2 = 2 * x3 - 2 * y1
    b2 = 2 * y3 - 2 * y1
    c2 = x1**2 - x3**2 + y1**2 - y3**2
    x = (b1*c2-b2*c1)/(a1*b2-a2*b1)
    y = (c1*a2-c2*a1)/(a1*b2-a2*b1)
    print("%.3f %.3f %.3f" %(x, y, math.hypot(x1-x, y1-y)))

### FIXED CODE ###

#!/usr/bin/env python
#-*- coding:utf-8 -*-
 
import sys
import math
 
n = int(input())
 
for data in sys.stdin:
    x1, y1, x2, y2, x3, y3 = map(float, data.split())
    a1 = x2 - x1
    b1 = y2 - y1
    a2 = x3 - x1
    b2 = y3 - y1
    px = (b2 * (a1 * a1 + b1 * b1) - b1 * (a2 * a2 + b2 * b2)) / (2 * (a1 * b2 - a2 * b1))
    py = (a1 * (a2 * a2 + b2 * b2) - a2 * (a1 * a1 + b1 * b1)) / (2 * (a1 * b2 - a2 * b1))
    r = math.sqrt(px * px + py * py)
    px += x1
    py += y1
    print("{0:.3f} {1:.3f} {2:.3f}".format(px, py, r))
import math
import os
import random
import re
import sys
def dpkfindpath(a,k):
	dpath=[int(0) for _ in range(len(a))]
	for i in range(k):
		dpath[i]=abs(a[i]-a[0])
	
	for i in range(k,len(a)):
		li=[abs(a[i]-a[ik])+dpath[ik] for ik in range(i-1,i-k-1,-1) ]
		dpath[i]=min(li)
		
	return dpath[len(a)-1]
		
n,k=input().split()
n=int(n)
k=int(k)
a=input().split()
for i in range(n):
  a[i]=int(a[i])
if n>=k:
	print (dpkfindpath(a,k))


### FIXED CODE ###

import math
import os
import random
import re
import sys
def dpfindpath(a):
	dpath=[int(0) for _ in range(len(a))]
	dpath[0]=0
	dpath[1]=abs(a[1]-a[0])
	for i in range(2,len(a)):
		dpath[i]=min(abs(a[i]-a[i-1])+dpath[i-1],abs(a[i]-a[i-2])+dpath[i-2])
	return dpath[len(a)-1]
n=int(input())
a=input().split()
for i in range(n):
  a[i]=int(a[i])
print (dpfindpath(a))
Input1 = [str(input()) for i in range(1)]
    N,K = list(map(int,Input1[0].split()))
    ANS = []
    if N == K:
        ANS.append(1)
        print(1)
        for i in range(K-1):
            ANS.append(0)
            print(0)
    else:
        M = max(K,N-K)
        Mem = [[1 for j in range(i+1)] for i in range(M)]
        for j in range(M):
            I = len(Mem[j])
            for i in range(I):
                if j>0 and i!=0 and i!= I-1:
                    Mem[j][i] = int((Mem[j-1][i-1]+Mem[j-1][i])%(10**9+7))

        i = 0
        ANS.append(N-K+1)
        print(N-K+1)
        for i in range(1,K):
            if N-K-1 >= i+1:
                ans = Mem[K-1][i]*(Mem[N-K-1][i-1]+2*Mem[N-K-1][i]+Mem[N-K-1][i+1])
                ans = int(ans % (10**9+7))
                ANS.append(ans)
                print(ans)                
            elif N-K-1 >= i:
                ans = Mem[K-1][i]*(Mem[N-K-1][i-1]+2*Mem[N-K-1][i])
                ans = int(ans % (10**9+7))
                ANS.append(ans)
                print(ans)
            elif N-K-1 == i-1:
                ans = Mem[K-1][i]*Mem[N-K-1][i-1]
                ans = int(ans % (10**9+7))
                ANS.append(ans)
                print(ans)
            else:
                ANS.append(0)
                print(0)


### FIXED CODE ###

def Myne(N,K):
    Input1 = [str(input()) for i in range(1)]
    N,K = list(map(int,Input1[0].split()))
    ANS = []
    if N == K:
        ANS.append(1)
        print(1)
        for i in range(K-1):
            ANS.append(0)
            print(0)
    else:
        M = max(K,N-K)
        Mem = [[1 for j in range(i+1)] for i in range(M)]
        for j in range(M):
            I = len(Mem[j])
            for i in range(I):
                if j>0 and i!=0 and i!= I-1:
                    Mem[j][i] = int((Mem[j-1][i-1]+Mem[j-1][i])%(10**9+7))

        i = 0
        ANS.append(N-K+1)
        print(N-K+1)
        for i in range(1,K):
            if N-K-1 >= i+1:
                ans = Mem[K-1][i]*(Mem[N-K-1][i-1]+2*Mem[N-K-1][i]+Mem[N-K-1][i+1])
                ans = int(ans % (10**9+7))
                ANS.append(ans)
                print(ans)                
            elif N-K-1 >= i:
                ans = Mem[K-1][i]*(Mem[N-K-1][i-1]+2*Mem[N-K-1][i])
                ans = int(ans % (10**9+7))
                ANS.append(ans)
                print(ans)
            elif N-K-1 == i-1:
                ans = Mem[K-1][i]*Mem[N-K-1][i-1]
                ans = int(ans % (10**9+7))
                ANS.append(ans)
                print(ans)
            else:
                ANS.append(0)
                print(0)
    return ANS

if __name__ == '__main__':
    Myne(1,1)
S,T = map(int,input().split())
print(T + S)

### FIXED CODE ###

def main():
    S,T = input().split()
    print("{}{}".format(T,S))
main()
import numpy as np
x = int(input())
tmp_list=[]
c=0
tmp_2=0
while(1):
    tmp_1=c**5
    if (tmp_1 - tmp_2)<x:
        tmp_list+=[tmp_1]
    else:
        break
    tmp_2=tmp_1
    c+=1

def せいがわ(target:list,x) -> list:
    for i in np.flipud(target):
        for j in target:
            tmp=i+j
            if tmp==x:
                return [int(i**(1/5)),int(j**(1/5))*-1]
            if tmp>x:
                break
    return 0

def ふがわ(target:list,x) -> list:
    for i in np.flipud(target):
        for j in target:
            tmp=i-j
            if tmp==x:
                return [int(i**(1/5)),int(j**(1/5))]
            if tmp<x:
                break
    return 0
  
ans=ふがわ(tmp_list,x)
if ans==0:
    ans=せいがわ(tmp_list,x)
print(ans[0],ans[1])

### FIXED CODE ###

import numpy as np
x = int(input())
tmp_list=[]
c=0
tmp_2=0
while(1):
    tmp_1=c**5
    if (tmp_1 - tmp_2)<=x:
        tmp_list+=[tmp_1]
    else:
        break
    tmp_2=tmp_1
    c+=1
 
def せいがわ(target:list,x) -> list:
    for i in np.flipud(target):
        for j in target:
            tmp=i+j
            if tmp==x:
                return [int(i**(1/5)),int(j**(1/5))*-1]
            if tmp>x:
                break
    return 0
 
def ふがわ(target:list,x) -> list:
    for i in np.flipud(target):
        for j in target:
            tmp=i-j
            if tmp==x:
                return [int(i**(1/5)),int(j**(1/5))]
            if tmp<x:
                break
    return 0
  
ans=ふがわ(tmp_list,x)
if ans==0:
    ans=せいがわ(tmp_list,x)
print(ans[0],ans[1])
n,q = map( int, input().split() )
s = input()
lr = []
for i in range(q):
    lr.append(list( map( int, input().split() ) ) )

exist = [0]*n
for i in range(1,n):
    if s[i-1:i+1] == 'AC':
        exist[i+1] = 1

for i in range(q):
    if lr[i][1] - lr[i][0] < 2:
        print(0)
    else:
        print(sum(exist[lr[i][0]-1:lr[i][1]]))

### FIXED CODE ###

n,q = map( int, input().split() )
s = input()
lr = []
for i in range(q):
    lr.append(list( map( int, input().split() ) ) )

exist = [0]*n
for i in range(1,n):
    if s[i-1:i+1] == 'AC':
        exist[i] = exist[i-1]+1
    else:
        exist[i] = exist[i-1]

for i in range(q):
    print(exist[lr[i][1]-1]-exist[lr[i][0]-1])
N = int(input())
H = [i for i in map(int, input().split())]

cnt = 0
for i in range(i):
    if H[i] == max(H):
        cnt += 1
print(cnt)

### FIXED CODE ###

N = int(input())
H = [i for i in map(int, input().split())]
cnt = 0
for i in range(N):
    if max(H[0:i+1]) == H[i]:
        cnt += 1
print(cnt)
n,a,b=(int(input().split()))
c=0
for i in range(n+1):
  d=0
  for j in str(i):
    d+=int(j)
  if a<=d<=b:
    c+=1
print(c)

### FIXED CODE ###

n,a,b=(int(x) for x in input().split())
c=0
for i in range(n+1):
  d=0
  for j in str(i):
    d+=int(j)
  if a<=d<=b:
    c+=i
print(c)
n = int(raw_input())
ans = 0
for i in range(1 , n + 1):
    ans += i * (n - i + 1)
#print n , ans
for i in xrange(n - 1):
    x , y = [int(i) for i in raw_input().split(' ')]
    if x > y:
        t = x
        x = y
        y = t
    ans -= x * ( n - y + 1 )
print ans

### FIXED CODE ###

n = int(raw_input())
ans = 0
for i in range(1 , n + 1):
    ans += i * (n - i + 1)
#print n , ans
for i in xrange(n - 1):
    x , y = [int(i) for i in raw_input().split(' ')]
    if x > y:
        t = x
        x = y
        y = t
    ans -= x * ( n - y + 1 )
print ans
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  if a[a[i]]==i:
    ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
a=[0]+list(map(int,input().split()))
ans=0
for i in range(1,n+1):
  if a[a[i]]==i:
    ans+=1
print(ans//2)
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

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

h-a
prev_com1 = 0
ans = 0
for i in range(h-a):
  com1 = cmb(i+b,b)
  com2 = cmb(h-b+h, h)
  ans += (com1 - prev_com1)*com2
print(ans)

### FIXED CODE ###

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

mod = 10**9+7 #出力の制限
N = h+w
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 cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

ans = 0
for j in range(b,w):
  ans += cmb(h-a-1+j, j, mod) * cmb(a-1+w-j-1, a-1, mod)
print(ans%mod)
a = input()

if a =< 3200:
    print(s)
else:
    print(red)
   

### FIXED CODE ###

a = int(input())
s=  input()

if a >= 3200:
    print(s)
else:
    print("red")
int N
float sum = 0
N = input() 
for i in N
	s = input()
	sum = (float)1/s
print(sum)

### FIXED CODE ###

sum = 0.00
s = 0 
N = int(input()) 
numlist = list(input().split())
for i in range(N):
	s = int(numlist[i])
	sum = sum+(1/s)
print(1/sum)
n,w=[int(i) for i in input().split()]
wi=[]
val=[]
for i in range(n):
    k=[int(i) for i in input().split()]
    wi.append(k[0])
    val.append(k[1])
dp=[[-1]*10**9]*105
def solve(pos,we):
    if we>w:
        return float("-inf")
    if pos>=n:
        return 0
    if dp[pos][we]!=-1:
        return dp[pos][we]
    ans=max(solve(pos+1,we+wi[pos])+val[pos],solve(pos+1,we))
    dp[pos][we]=ans
    return ans
print(solve(0,0))

### FIXED CODE ###

n=int(input())
arr=[int(i) for i in input().split()]
dp=[0]*(n)
dp[0]=0
dp[1]=abs(arr[1]-arr[0])

for i in range(2,n):
    dp[i]=min(abs(arr[i]-arr[i-1])+dp[i-1],abs(arr[i]-arr[i-2])+dp[i-2])
print(dp[-1])
import sys
input = sys.stdin.readline

def main():
  n = int(input())
  a = [[] for row in range(200000)]
  C = [int(input()) for i in range(n)]
  b = 0
  d = [0]
  mod = 10 ** 9 + 7
  mini_ans = 0
  for i,c in enumerate(C):
    if b != c:
      for j in a[c]:
        mini_ans += (d[j] + 1) % mod
      a[c].append(i)
    d.append(mini_ans % mod)
    b = c
  print(d[-1]+1)

if __name__ == '__main__':
    main()

### FIXED CODE ###

mod = 10 ** 9 + 7
n = int(input())
s = input()
a = [0]*26
ans = 1
for i in s:
  a[ord(i)-ord("a")] += 1
for i in a:
  ans = (ans * (i+1)) % mod
print(ans-1)
s = input().split()

n = s[0]
k = s[1]

if n ==1 :
    print(0)
else:
    print(n-k)

### FIXED CODE ###

s = input().split()

n = int(s[0])
k = int(s[1])

if k==1 :
    print(0)
else:
    print(n-k)
k,x=map(int,input().split())

if 500*k=>x:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

k,x=map(int,input().split())

if 500*k>=x:
  print("Yes")
else:
  print("No")
a,b,c = map(int, raw_input().split())
t = 0
for n in range(a,b+1)
 if c%n == 0:
 	t += 1
print t

### FIXED CODE ###

a,b,c = map(int, raw_input().split())
t = 0
for n in range(a,b+1):
 if c%n == 0:
 	t += 1
print str(t)
n = int(input())
l = [int(i) for _ in input().split()]
if max(l) < sum(l) - max(l):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
if max(l) < sum(l) - max(l):
  print("Yes")
else:
  print("No")
A = []
B = set()
ans = [[0,0,0],[0,0,0],[0,0,0]]
for i in range(3):
    A.append(list(map(int, input().split())))
N = int(input())
for i in range(N):
    B.add(int(input()))

for i in range(3):
    for j in range(3):
        if A[i][j] in B:
            ans[i][j] = 1

#ゴミコードだなぁ……

if ans[0][0] + ans[0][1] + ans[0][2] == 3:
    print('Yes')
elif ans[0][0] + ans[1][0] + ans[2][0] == 3:
    print('Yes')
elif ans[0][0] + ans[1][1] + ans[2][2] == 3:
    print('Yes')
elif ans[1][0] + ans[1][1] + ans[1][2] == 3:
    print('Yes')
elif ans[2][0] + ans[2][1] + ans[2][2] == 3:
    print('Yes')
elif ans[0][1] + ans[1][1] + ans[2][1] == 3:
    print('Yes')
elif ans[0][2] + ans[1][2] + ans[1][3] == 3:
    print('Yes')
elif ans[0][2] + ans[1][1] + ans[2][0] == 3:
    print('Yes')
else:
    print('NO')

### FIXED CODE ###

A = []
B = set()
ans = [[0,0,0],[0,0,0],[0,0,0]]
for i in range(3):
    A.append(list(map(int, input().split())))
N = int(input())
for i in range(N):
    B.add(int(input()))

for i in range(3):
    for j in range(3):
        if A[i][j] in B:
            ans[i][j] = 1

#ゴミコードだなぁ……

if ans[0][0] + ans[0][1] + ans[0][2] == 3:
    print('Yes')
elif ans[0][0] + ans[1][0] + ans[2][0] == 3:
    print('Yes')
elif ans[0][0] + ans[1][1] + ans[2][2] == 3:
    print('Yes')
elif ans[1][0] + ans[1][1] + ans[1][2] == 3:
    print('Yes')
elif ans[2][0] + ans[2][1] + ans[2][2] == 3:
    print('Yes')
elif ans[0][1] + ans[1][1] + ans[2][1] == 3:
    print('Yes')
elif ans[0][2] + ans[1][2] + ans[2][2] == 3:
    print('Yes')
elif ans[0][2] + ans[1][1] + ans[2][0] == 3:
    print('Yes')
else:
    print('No')
from math import gcd
A, B, C, D = map(int, input().split())

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

lcmv = lcm(C, D)
bc = B // C
bd = B // D
bl = B // lcmv
ac = (A-1) // C
ad = (A-1) // D
al = (A-1) // lcmv
print(B - A + 1 - ((bc + bd - bl) - (ac + ad - al)))

### FIXED CODE ###

from fractions import gcd
A, B, C, D = map(int, input().split())

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

lcmv = lcm(C, D)
bc = B // C
bd = B // D
bl = B // lcmv
ac = (A-1) // C
ad = (A-1) // D
al = (A-1) // lcmv
print(B - A + 1 - ((bc + bd - bl) - (ac + ad - al)))
import math
# import sys
# read = sys.stdin.buffer.read
# readline = sys.stdin.buffer.readline
# readlines = sys.stdin.buffer.readlines

# def myinput():
#     return map(int,input().split())

n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0

m = math.floor(math.log(max(a),2))+1

if max(a)==0:
  print(0)
  exit()

for j in range(m):
    one = 0
    zero = 0
    for i in range(n):
        b = str(bin(a[i]))[2:]
        c = b.zfill(m)
        s = int(c[m-j-1])
        if s==0:
            zero += 1
        else:
            one += 1
    ans_bit = zero * one
    ans += (ans_bit)*(2**j) 
    ans %= mod
print(ans%mod)

### FIXED CODE ###

import math
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def myinput():
    return map(int,readline().split())

n = int(readline())
a = list(myinput())
mod = 10**9 + 7
ans = 0

for j in range(60):
    k = 2**j
    one = 0
    zero = 0
    for i in range(n):
        if (a[i]&k):
            one += 1
        else:
            zero += 1
    ans_bit = zero * one
    ans += (ans_bit)*(2**j) 
    ans %= mod   

print(ans%mod)