Harryxun/stf_run huggingface dataset:
if input() == 'SUN':
    print(7)
elif input() == 'MON':
    print(6)
elif input() == 'TUE':
    print(5)
elif input() == 'WED':
    print(4)
elif input() == 'THU':
    print(3)
elif input() == 'FRI':
    print(2)
else:
    print(1)

### FIXED CODE ###

print(['SAT','FRI','THU','WED','TUE','MON','SUN'].index(input()) + 1)
word=str(iinput)
print(woed[0]+str(len(word)-2)+word[-1])

### FIXED CODE ###

word=str(input())
print(word[0]+str(len(word)-2)+word[-1])
a,b=input().split()
c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
play_day=a-(b+c)
if play_day>=0:
    print(play_day)
else:
    print("-1")

### FIXED CODE ###

print(float(input())*2*3.14)
from sys import stdin

N, M = stdin.readline().rstrip().split()

#全ての組み合わせのうち、奇数になるもののみ除く（奇数 + 偶数）

NM = N*M
total = (NM*(NM-1))/2
odd = NM/2

print(total - odd)





### FIXED CODE ###

from sys import stdin
N, M = map(int, input().split()) 

print(
    (N*(N-1))//2 +
    (M*(M-1))//2
)
def check(y,x):
    if 0<=y<=n-1 and 0<=x<=n-1:
        return True
    return False
n,m=map(int,raw_input().split())
a=[raw_input() for _ in xrange(n)]
b=[raw_input() for _ in xrange(m)]
for i in xrange(m):
    for j in xrange(m):
        cnt=0
        for k in range(i,i+m):
            for l in xrange(j,j+m):
                if check(k,l):
                    if a[k][l]==b[k][l]:
                        cnt+=1
        if cnt==m*m:
            print("Yes")
            exit()
print("No")


### FIXED CODE ###

def check(y,x):
    if 0<=y<=n-1 and 0<=x<=n-1:
        return True
    return False

n,m=map(int,raw_input().split())
a=[raw_input() for _ in xrange(n)]
b=[raw_input() for _ in xrange(m)]
for i in xrange(n):
    for j in xrange(n):
        cnt=0
        for k in range(m):
            for l in xrange(m):
                if check(k+i,l+j):
                    if a[k+i][l+j]==b[k][l]:
                        cnt+=1
        if cnt==m*m:
            print("Yes")
            exit()
print("No")
n,k=map(int,input().split())
sum=0
while n>=1:
  n=n/k
  sum+=1
  
print (sum)


### FIXED CODE ###

n,r=map(int,input().split())

if n>=10:
  print(r)

else:
  print(r+(10-n)*100)
a1 = int(input())
a2 = int(input())
a3 = int(input())

x = a1 + a2 + a3

if x >= 22 :
  print("bust")
  
else :
  print("win")


### FIXED CODE ###

a1, a2, a3 = map(int,input().split())
 
x = a1 + a2 + a3
 
if x >= 22 :
  print("bust")
  
else :
  print("win")
import sys
sys.setrecursionlimit(100000)
n = int(input())
li = list(map(int,input().split()))
a = li[0]
del li[0]

def f(num1,num2,l):
  t = num1^num2
  if len(l) == 1 and t in l:
    return True
  else:
    if t in l:
      l.remove(t)
      return f(num2,t,l)
    else:
      return False

for i in li:
  if not a^i in li:
    continue
  else:
    if f(i,a,li[:]):
      print("Yes")
      exit()
    else:continue
print("No")

### FIXED CODE ###

n=int(input())
*a,=map(int,input().split())
s=list(set(a))
s.sort()
ans="No"
if len(s)==1:
  if 0 in s:
    ans="Yes"
elif len(s)==2:
  if a.count(0)*2==a.count(s[1]):
    ans="Yes"
elif len(s)==3 and a.count(s[0])==a.count(s[1])==a.count(s[2]) and s[0]^s[1]^s[2]==0:
  ans="Yes"
print(ans)
n,m = map(int,input().split())
lng = []
for _ in range(n-1):
    lng.append(int(input()))
i = 0
sm = 0
for _ in range(m):
    j = i+int(input())
    mv = sum(lng[i:j]) if j > i else sum(lng[j:i])
    sm += mv
    if sm >= 100000: sm -= 100000
    i = j
print(sm)

### FIXED CODE ###

n,m = map(int,input().split())
lng = [0]
for _ in range(n-1):
    lng.append(lng[-1] + int(input()))
i = 0
sm = 0
for _ in range(m):
    j = i+int(input())
    sm += abs(lng[i]-lng[j])
    sm %= 100000
    i = j
print(sm)
from collections import Counter

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

cntA = Counter(A)
cntB = Counter(B)

V = set(A) & set(B)
mx = max(min(cntA[v], cntB[v]) for v in V)

if mx > N // 2:
    print('No')
    exit()

print('No')


### FIXED CODE ###

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

AB = [(a, i, 0) for i, a in enumerate(A)] + [(b, i, 1) for i, b in enumerate(B)]
AB.sort()

X = AB[:N]
Y = AB[N:]

if any(x[0] == y[0] for x, y in zip(X, Y)):
    print('No')
    exit()

swapA = []
swapB = []
ans = [-1] * N

for (_, i, sx), (_, j, sy) in zip(X, Y):
    if sx == sy == 0:
        swapA.append((i, j))
    elif sx == sy == 1:
        swapB.append((i, j))
    else:
        if sx == 0:
            ans[i] = B[j]
        else:
            ans[j] = B[i]

for (i, j), (x, y) in zip(swapA, swapB):
    ans[i] = B[x]
    ans[j] = B[y]

    if A[i] == ans[i] or A[j] == ans[j]:
        ans[i], ans[j] = ans[j], ans[i]

print('Yes')
print(*ans)
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]

dp = [0] * (w + 1)
for wi, vi in wv:
    for sum_w in range(w, wi - 1, -1):
        v = dp[sum_w - wi] + vi
        if dp[sum_w] < v:
            dp[sum_w] = vi

print(max(dp[w]))


### FIXED CODE ###

def main():
    n, w = map(int, input().split())
    wv = [list(map(int, input().split())) for _ in range(n)]

    dp = [0] * (w + 1)
    for wi, vi in wv:
        for sum_w in range(w, wi - 1, -1):
            v = dp[sum_w - wi] + vi
            if dp[sum_w] < v:
                dp[sum_w] = v

    print(dp[w])


if __name__ == '__main__':
    main()
x = int(input())
a = 0
while a ** 5 - (a - 1) ** 5 < x:
    a += 1
    b = a
    while a ** 5 - b ** 5 < x:
        b -= 1
        if a ** 5 - b ** 5 == x:
            break
    else:
        continue
    break
print(a, b)


### FIXED CODE ###

x = int(input())
a = 0
if x == 0:
    print(0, 0)
else:
    while a ** 5 - (a - 1) ** 5 <= x:
        a += 1
        b = a
        while a ** 5 - b ** 5 < x:
            b -= 1
            if a ** 5 - b ** 5 == x:
                break
        else:
            continue
        break
    print(a, b)
n,T=map(int,input().split())
c=list(map(int,input().split('\n')))
k=1000
l=1
for i in range(n):
    if c[i][1] <= T:
        l=0
        if c[i][0] < k:
            k = c[i][0]
if l==1:
    print('TLE')
else:
    print(k)

### FIXED CODE ###

N,T=map(int,input().split())
k=1000
l=1
for i in range(N):
    c,t=map(int,input().split())
    if t <= T:
        l=0
        if c < k:
            k = c
if l==1:
    print('TLE')
else:
    print(k)
n = int(input())
d = list(map(int, input().split()))
MOD = 998244353

a = [0] * n
for i in range(n):
    a[d[i]] += 1

ans = 1
for i in range(n):
    if i == 0:
        if a[i] != 1:
            ans *= 0
    else:
        if a[i] > 0:
            if a[i-1] == 0:
                ans *= 0
                print(aa)
            else:
                ans *= pow(a[i-1], a[i], MOD)
                ans %= MOD
print(ans % MOD)

### FIXED CODE ###

n = int(input())
d = list(map(int, input().split()))
MOD = 998244353
if d[0] != 0:
    print(0)
    exit()
    
a = [0] * n
for i in range(n):
    a[d[i]] += 1

ans = 1
for i in range(n):
    if i == 0:
        if a[i] != 1:
            ans *= 0
    else:
                for _ in range(a[i]):
                    ans *= a[i-1]
                    ans %= MOD
print(ans % MOD)
l=list(map(int, input().split())
n=l[0]
a, b = l[1], l[2]

if a*n>=b:
    print(b)
else:
    print(a*n)

### FIXED CODE ###

l = list(map(int, input().split()))
n=l[0]
a=l[1]
b = l[2]

if a*n >= b:
    print(b)
else:
    print(a*n)
mport numpy as np

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

a = []
array = np.array([])
for i in range(N):
    a = list(map(int,input().split()))
    array = np.concatenate((array,a[0]*np.ones(a[1])))
print (array)
array = np.sort(array)

print (int(array[K-1]))

### FIXED CODE ###

import numpy as np

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

a = []
for i in range(N):
    a.append(list(map(int,input().split())))
a = sorted(a,key = lambda i:i[0])
sum = 0
b = 0
#print (a)
for i in range(N):
    sum += a[i][1]
    b = a[i][0]
    if sum >= K:
        break

print (b)
N = int(input())
A = sorted(list(map(int, input().split())))
memo = {}
ans = 0

for a in A:
    if not a in memo:
        flag = True
        for div in memo:
            if a % div == 0:
                flag = False
                break
        if flag:
            ans += 1
            memo[a] = 1
    else:
        if memo[a] == 1:
            ans -= 1
            memo[a] += 1
        else:
            continue
print(ans)


### FIXED CODE ###

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

for i in range(1, 6):
    if x[i-1] == 0:
        print(i)
        break
N = int(input())
b, c, d = 1, 1, 2
while True:
    x = N//4 + b
    y = c*N*x
    tmp = c * (4*x - N) - 1
    if y % tmp == 0:
        z = y // tmp
        break
    else:
        b += 1
print(*[x,y,z], sep=' ')

### FIXED CODE ###

def tenka17_c():
    N = int(input())
    ans = None
    for x in range(1, 3501):
        for y in range(1, 3501):
            a = N * x * y
            b = 4*x*y - N*y - N*x
            if b < 1: continue
            if a % b == 0:
                ans = (x, y, a//b)
                break
        if ans: break
    print(*ans, sep=' ')

tenka17_c()
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
input_line = input().split()

N = int(input_line[0])
M = int(input_line[1])
counter = 0 
if N != 0:
    counter += combinations_count(N,2) 
if M != 0:
    counter += combinations_count(M,2)
        
print(counter)


### FIXED CODE ###

import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
input_line = input().split()

N = int(input_line[0])
M = int(input_line[1])
counter = 0 
if N > 1:
    counter += combinations_count(N,2) 
if M > 1:
    counter += combinations_count(M,2)
        
print(counter)
n=int(input())
s=str(input())
q=int(input())
 
for i in range(q):
 x,y=map(str, input().split())
 s.replace(x,y)
 ans=0 
 s_list=list(s.split())
 for j in range(q+1):
  ans+=int(s_list[j])
  print(ans)

### FIXED CODE ###

n=int(input())
a_list=list(map(int,input().split()))
cnt = [0] * int(1e5 + 10)
sum=0
for i in a_list:
 cnt[i] +=1
 sum+=i
  
q=int(input())
ans=0
 
for j in range(q):
 x,y=map(int,input().split())
 sum+=(y-x)*cnt[x]
 cnt[y]+=cnt[x]
 cnt[x]=0
 print(sum)
import sys
import math
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()

def invr():
    return(map(int,input().split()))

def solve(s,k):
    len1 = len(s)
    if len1 > k:
        corte = ''
        for i in range(k):
            corte += s[i]
        corte += '...'
        return corte
      
	return s

def main():
    k = inp()
    print(solve(input(),k))


main()




### FIXED CODE ###

import sys
import math
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

def solve(a,b,c,d):
    angle = abs(0.5 * (60 * c + d) - 6 * d)
    distance = math.sqrt(pow(a,2) + pow(b,2) - (2*a*b*math.cos(math.radians(angle))))
    return distance

def main():
    a,b,c,d = invr()
    print(solve(a,b,c,d))

main()
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    wa_flag = [0]*N
    num_penalty = 0
    for i in range(M):
        pi = p[i]
        si = S[i]
        if wa_flag[pi-1] == 0 and si == "WA":
            num_penalty += 1
        if si == "AC":
            wa_flag = -1
    num_ac = wa_flag.count(-1)
    print(num_ac, num_penalty)
# Generated by 1.1.6 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
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    wa_flag = [0] * N
    num_penalty = 0
    for i in range(M):
        if S[i] == "WA":
            if wa_flag[p[i]-1] != -1:
                wa_flag[p[i]-1] += 1
        else:
            if wa_flag[p[i]-1] != -1:
                num_penalty += wa_flag[p[i]-1]
                wa_flag[p[i]-1] = -1
    num_ac = wa_flag.count(-1)
    print(num_ac, num_penalty)
# Generated by 1.1.6 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():
    N, M = map(int, input().split())
    p = [None] * M
    S = [None] * M
    for i in range(M):
        pi, si = input().split()
        p[i] = int(pi)
        S[i] = str(si)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()
import sys

N, Q = map(int, sys.stdin.readline().split())
s = input()

Query = [input().split() for i in range(Q)]

left, right = 0, N - 1

for t, d in reversed(Query):
    if d == "L":
        if t == s[left]:
            left += 1
        if right < N - 1 and t == s[right + 1]:
            right = min(right + 1, N - 1)
    else:
        if left > 0 and t == s[left - 1]:
            left = max(left - 1, 0)
        if t == s[right]:
            right -= 1
print(max(right - left + 1, 0))


### FIXED CODE ###

# N, Q = map(int, input().split())
import sys

input = sys.stdin.readline

N, Q = tuple(map(int, input().split()))
s = input()

Query = [input().split() for i in range(Q)]

left, right = 0, N - 1

for t, d in reversed(Query):
    if d == "L":
        if t == s[left]:
            left += 1
        if right < N - 1 and t == s[right + 1]:
            right = min(right + 1, N - 1)
    else:
        if left > 0 and t == s[left - 1]:
            left = max(left - 1, 0)
        if t == s[right]:
            right -= 1
print(max(right - left + 1, 0))
S = input()
T = input()
ans = 0
for i in range(S):
  if S[i+1] == T[i+1]:
    ans += 1
print(ans)

### FIXED CODE ###

S = input()
T = input()
ans = 0
for i in range(len(S)):
  if S[i] == T[i]:
    continue
  ans += 1

print(ans)
N = int(input())
l = map(int,input().split())
l = sorted(l)
l_dict = dict()
max_l  = max(l)
min_l = min(l)
t_list = [one for one in l if one+min_l < max_l]
for i,one in enumerate(t_list):
    l_dict[one] = i
    
    
big_dict = dict()
for one in t_list:
    big_dict[one] = bisect.bisect_left(l,2*one)

counter = 0

for a,b in combinations(t_list,2):
    tmp = a + b
    counter += bisect.bisect_left(l[l_dict[b]+1:big_dict[b]],tmp)
    
print(counter)

### FIXED CODE ###

A,B = map(int,input().split())
ans = A - B*2
if ans < 0 :
    print(0)
else:
    print(ans)
s = input()
cnt = 0
    for i in range(n):
        if i == n-2 or i== n-1 :
            continue
        if s[i]== "A" and s[i+1] == "B" and s[i+2] == "C" :
            cnt+=1
    print(cnt)

### FIXED CODE ###

n = int(input())
s = input()
cnt = 0
for i in range(n):
    if i == n-2 or i== n-1 :
        continue
    if s[i]== "A" and s[i+1] == "B" and s[i+2] == "C" :
        cnt+=1
print(cnt)
N, K = int(input())
H = list(map(int, input().split()))
P = [0] + [-1] * (len(H)-1)

def minv(i, v):
  if i < len(H):
    cost = v()
    if P[i] < 0:
      P[i] = cost
    else:
      P[i] = min(P[i], cost)

for i in range(len(H)-1):
  for k in range(1, K+1):
    minv(i + k, lambda : P[i] + abs(H[i] - H[i+k]))

print(P[-1])


### FIXED CODE ###

N, K = map(int, input().split())
H = list(map(int, input().split()))
P = [0] + [-1] * (len(H)-1)

def minv(i, v):
  if i < len(H):
    cost = v()
    if P[i] < 0:
      P[i] = cost
    else:
      P[i] = min(P[i], cost)

for i in range(len(H)-1):
  for k in range(1, K+1):
    minv(i + k, lambda : P[i] + abs(H[i] - H[i+k]))

print(P[-1])
a,b=map(int, input().split())
print(a//b, a%b, "{0:.5f}"/format(a/b))

### FIXED CODE ###

a,b=map(int, input().split())
print(a//b, a%b, "{0:.5f}".format(a/b))
kuri_now = False
cost = [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]
kuri = [0, 0, 0, 0, 0, 0.5, 1, 1, 1, 1, 1]
result = 0
for digit in reversed(input()):
    digit = int(digit)
    if kuri_now == 0:
        result += cost[digit]
        kuri_now = kuri[digit]
    elif kuri_now == 1:
        result += cost[digit + 1]
        kuri_now = kuri[digit + 1]
    else:
        if cost[digit] <= cost[digit + 1]:
            result += cost[digit]
            kuri_now = kuri[digit]
        else:
            result += cost[digit + 1]
            kuri_now = kuri[digit + 1]
if kuri_now == 1:
    result += 1
print(result)
kuri_now = False
cost = [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]
kuri = [0, 0, 0, 0, 0, 0.5, 1, 1, 1, 1, 1]
result = 0
for digit in input():
    digit = int(digit)
    if kuri_now == 0:
        result += cost[digit]
        kuri_now = kuri[digit]
    elif kuri_now == 1:
        result += cost[digit + 1]
        kuri_now = kuri[digit + 1]
    else:
        if cost[digit] <= cost[digit + 1]:
            result += cost[digit]
            kuri_now = kuri[digit]
        else:
            result += cost[digit + 1]
            kuri_now = kuri[digit + 1]
if kuri_now == 1:
    result += 1
print(result)

### FIXED CODE ###

kuri_now = False
cost = [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]
kuri = [0, 0, 0, 0, 0, 0.5, 1, 1, 1, 1, 1]
result = 0
for digit in input():
    digit = int(digit)
    if kuri_now == 0:
        result += cost[digit]
        kuri_now = kuri[digit]
    elif kuri_now == 1:
        result += cost[digit + 1]
        kuri_now = kuri[digit + 1]
    else:
        if cost[digit] <= cost[digit + 1]:
            result += cost[digit]
            kuri_now = kuri[digit]
        else:
            result += cost[digit + 1]
            kuri_now = kuri[digit + 1]
if kuri_now == 1:
    result += 1
print(result)
import numpy as np
import bisect
N,M=map(int,input().split())
A=np.array(list(map(int,input().split())))
JinA=[]
for i in range(M):
    b,c=map(int,input().split())
    JinA.append((c,b))

JinA.sort(reverse=True)

A.sort()
len_b=0
new_list=[]
for c,b in JinA:
    add_b=min(b,N-len_b)
    new_list+=[c]*add_b
    
now=np.array(new_list)    
Ans=np.maximum(A,now)
print(Ans.sum())

### FIXED CODE ###

from operator import itemgetter

N, M = list(map(int, input().split()))
A = [[1, a] for a in list(map(int, input().split()))]
BC = [list(map(int, input().split())) for i in range(M)]

q = sorted(A+BC, key=itemgetter(1), reverse=True)

ans = 0
i = 0

while N:
    n = min(q[i][0], N)
    ans += q[i][1] * n
    N -= n
    i += 1
print(ans)
N = int(input())
shiritori = [str(input())]

shiritori.append(w)

ans = "Yes"

for i in shiritori:
    if shiritori.count(i) != 1:
        ans = "No"
        break
    
for k in range(N-1):
    first = shiritori[k]
    second = shiritori[k+1]
    if first[-1] != second[0]:
        ans = "No"
        break


    
print(ans)

### FIXED CODE ###

N = int(input())
shiritori = list()

for a in range(N):
	shiritori.append(input())

ans = "Yes"

for i in shiritori:
    if shiritori.count(i) != 1:
        ans = "No"
        break
    
for k in range(N-1):
    first = shiritori[k]
    second = shiritori[k+1]
    if first[-1] != second[0]:
        ans = "No"
        break


    
print(ans)
#https://docs.pyq.jp/python/math_opt/graph.html
from networkx import Graph,predecessor
import matplotlib.pyplot as plt
import networkx as nx

G = Graph() #無効グラフ生成
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(m)]
G.add_edges_from(ab) #辺リスト生成
preds = predecessor(G,source=1)  #sourceはstart node
print("Yes")
for i in range(2,n+1):
    print(preds[i][0])

#描画
#nx.draw_networkx(G)
#plt.show()

### FIXED CODE ###

from networkx import Graph,predecessor

G = Graph() #無効グラフ生成
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(m)]
G.add_edges_from(ab) #辺リスト生成
preds = predecessor(G,source=1)  #sourceはstart node
print("Yes")
for i in range(2,n+1):
    print(preds[i][0])

#描画
#import matplotlib.pyplot as plt
#import networkx as nx
#nx.draw_networkx(G)
#plt.show()
import numpy as np

N = int(input())
A = np.zeros((N,2))

for i in range(N):
	A[i, 0], A[i, 1] = [int(j) for j in input().split()]

A = A[np.argsort(A[:,1]), :]

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

ans = ['Yes', 'No']
print(ans[np.sum((A[:,1]-A[:,0])<0)])


### FIXED CODE ###

import numpy as np

N = int(input())
A = np.zeros((N,2))

for i in range(N):
	A[i, 0], A[i, 1] = [int(j) for j in input().split()]

A = A[np.argsort(A[:,1]), :]

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

ans = ['Yes', 'No']
t = np.sum((A[:,1]-A[:,0])<0)

print(ans[t>0])
N,M=input().split()

Cor = N-M
if Cor == 0:
    print("yes")
else:
    print("no")

### FIXED CODE ###

N, M = input().split()

Cor = int(N)-int(M)
if Cor == 0:
    print("Yes")
else:
    print("No")
# 077a

def atc_077a(input_value: str) -> str:
    C1 = input_value[0]
    C2 = input_value[1]

    if C1[0] == C2[2] and C1[1] == C2[1]:
        return "YES"
    else:
        return "NO"

C1 = input()
C2 = input()
print(atc_077a(C1,C2))


### FIXED CODE ###

# 077a

def atc_077a(input_value: str) -> str:
    C1 = input_value[0]
    C2 = input_value[1]

    if C1[0] == C2[2] and C1[1] == C2[1] and C1[2] == C2[0]:
        return "YES"
    else:
        return "NO"


C1 = input()
C2 = input()
print(atc_077a([C1, C2]))
result = a*b
if result%2 == 0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

x,y=map(int,input().split())
result = x*y
if result%2 == 0:
  print("Even")
else:
  print("Odd")
n, m = map(int, input().split())
count = [0] * n
for i in range(m):
    a = list(map(int, input().split()))
    for j in range(j):
        if j + 1 in a:
            count[j] += 1
for i in range(i):
    print(count[i])

### FIXED CODE ###

n, m = map(int, input().split())
count = [0] * n
for i in range(m):
    a = list(map(int, input().split()))
    for j in range(n):
        if j + 1 in a:
            count[j] += 1
for i in range(n):
    print(count[i])
s = str(input())
t = str(input())
lst = []
i= 0
for ss in range(len(s)-len(t)+1):
  flg = 1
  i= 0
  for tt in range(len(t)):
    now = ss + tt
    print(now)
    if s[now] == t[tt] or s[now] == '?':
      pass
    else:
      flg = 0
  if flg:
    print(ss, ss+tt+1)
    print(s[ss:ss+tt+1])
    ns = list(s)
    ns[ss:now+1] = list(t)
    lst.append(("").join(ns))
if lst:
  lst = [_.replace('?','a') for _ in lst]
  sort(lst)
  print(lst[0])

else:
  print('UNRESTORABLE')
print(lst)

### FIXED CODE ###

s = str(input())
t = str(input())
lst = []
i= 0
for ss in range(len(s)-len(t)+1):
  flg = 1
  i= 0
  for tt in range(len(t)):
    now = ss + tt
    if s[now] == t[tt] or s[now] == '?':
      pass
    else:
      flg = 0
  if flg:
    ns = list(s)
    ns[ss:now+1] = list(t)
    lst.append(("").join(ns))
if lst:
  lst = [_.replace('?','a') for _ in lst]
  lst.sort()
  print(lst[0])

else:
  print('UNRESTORABLE')
n=int(input())
A=list(map(int,input().split()))
mod=10**9+7

B=[[] for i in range(n)]
for i in range(n):
    B[i]= [int(i) for i in bin(A[i])[2:]]
    B[i] = [0]*(60-len(B[i]))+B[i]

TB=[[0]*n for i in range(60)]
for i in range(60):
    for j in range(n):
        TB[i][j] = B[j][i]
        
# import numpy as np
#print(TB)
ans=0
for i in range(60):
    now=TB[i]
    q=now.count(1)
    ans+= ((pow(2,59-i,mod)* (q*(q-1))%mod)%mod *pow(2,-1,mod))%mod
    ans%=mod
ans*=2
ans%=mod


last=0
for i in A:
    last+=i%mod
    last%=mod
last*=(n-1)
last%=mod
print((last-ans)%mod)
    
     


### FIXED CODE ###

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

B=[[] for i in range(n)]
for i in range(n):
    B[i]= [((A[i]>>(59-j))) & 1 for j in range(60)]
    B[i] = [0]*(60-len(B[i]))+B[i]

TB=[[0]*n for i in range(60)]
for i in range(60):
    TB[i] = [B[j][i] for j in range(n)]
        
# import numpy as np
#print(TB)
ans=0
for i in range(60):
    now=TB[i]
    q=sum(now)
    
    ans+= ((pow(2,59-i,mod)* (q*(n-q)))%mod)%mod
    ans%=mod


print((ans)%mod)