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

import numpy as np

if __name__ == '__main__':
	N = int(input())
	dam = np.array(list(map(int, input().split())))

	index_ = np.array([1 if i % 2 == 0 else -1 for i in range(N)])
	ans = np.array([])
	for i in range(N):
		ans = np.append(ans, np.dot(dam, index_))
		index_ = np.roll(index_, 1)
	ans = [str(int(i)) for i in ans]

	print(' '.join(ans))


### FIXED CODE ###

import numpy as np

if __name__ == '__main__':
	N = int(input())
	dam = np.array(list(map(int, input().split())))
	
	index_ = np.array([1 if i % 2 == 0 else -1 for i in range(N)])
	ans = [int(np.dot(dam, index_))]
	for i in range(N-1):
		ans.append(2 * (dam[i] - ans[i]//2))
	ans = [str(i) for i in ans]
	print(' '.join(ans))
### BUGGY CODE ###

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

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

a.sort(reverse=True)

if n > 1:
    f = True
else:
    f = False

for i in range(m):
    a[a.index(max(a))] //= 2

print(sum(a))


### FIXED CODE ###

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

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

a.sort(reverse=True)

a.append(0)
b = 0

if n > 1:
    for i in range(m):
        a[b] //= 2

        if a[b] < a[0] or a[b] < a[b + 1]:
            if a[0] > a[b + 1]:
                b = 0
                a.sort(reverse=True)
            else:
                b += 1

else:
    for i in range(m):
        a[0] //= 2





print(sum(a))
### BUGGY CODE ###

n = int(input())

g = [[0 for _ in range(n)] for _ in range(n)]
for i in range(n - 1):
    u, v, w = map(int, input().split())
    g[u - 1][v - 1] = w
    g[v - 1][u - 1] = w

color = [-1] * n
dist = [0] * n

def dfs(v):
    for next_v in range(n):
        if color[next_v] == -1 and g[v][next_v] != 0:
            dist[next_v] = dist[v] + g[v][next_v]
            color[next_v] = dist[next_v] % 2
            dfs(next_v)

# 0を始点として各点までの距離を求める
dfs(0)

for c in color:
    print(c)

### FIXED CODE ###

n = int(input())

g = [[] for _ in range(n)]
for i in range(n - 1):
    u, v, w = map(int, input().split())
    g[u - 1].append((v - 1, w))
    g[v - 1].append((u - 1, w))

color = [-1] * n
dist = [0] * n

import queue
def dfs(v):
    color[v] = dist[v] % 2
    q = queue.LifoQueue()
    q.put(v)

    while not q.empty():
        vv = q.get()
        for next_v in g[vv]:
            if color[next_v[0]] == -1 and next_v[1] != 0:
                dist[next_v[0]] = dist[vv] + next_v[1]
                color[next_v[0]] = dist[next_v[0]] % 2
                q.put(next_v[0])

# 0を始点として各点までの距離を求める
dfs(0)

for c in color:
    print(c)
### BUGGY CODE ###

from math import gcd
z=range(int(input()))
y=0
for a in z:
  for b in z:
    for c in z:
      y+=gcd(gcd(a+1,b+1),c+1)
print(y)


### FIXED CODE ###

from math import gcd
z=range(1,1+int(input()))
y=0
for a in z:
  for b in z:
    for c in z:
      y+=gcd(gcd(a,b),c)
print(y)
### BUGGY CODE ###

N,Q = map(int,input().split())
S = input()
check = "AC"
for i in range(Q):
    l,r = map(int,input().split())
    T = S[l-1:r]
    cnt = 0
    for i in range(len(T)-1):
        if(check == T[i:i+2]):
            cnt += 1
    print(cnt)

### FIXED CODE ###

N,Q = map(int,input().split())
S = input()
T = [0]*(N+1)
for i in range(N):
    T[i+1] = T[i] + (1 if S[i : i + 2] == "AC" else 0)
for i in range(Q):
    l,r = map(int,input().split())
    print(T[r-1] - T[l-1])
### BUGGY CODE ###

N,M = map(int,input().split())
flag = 0
lis  = [list(map(int,input().split())) for _ in range(M)]
ans_pra_lis = []
ans_beh_lis = [0] * M
lis_sort = sorted(lis)
for _ in lis:
    s = str(0)*(6-len(str(_[0]))) + str(_[0])
    ans_pra_lis.append(s)
i = 1
for _ in range(len(lis_sort)):
    if flag != lis_sort[_][0]:
        flag = lis_sort[_][0]
        i = 1
    ans_beh_lis[lis.index(lis_sort[_])] = str(0)*(6-len(str(i))) + str(i)
    i += 1
for x,y in zip(ans_pra_lis,ans_beh_lis):
    print(x,end = '')
    print(y)

### FIXED CODE ###

N,M = map(int,input().split())
lis  = [list(map(int,input().split())) for _ in range(M)]
ans_lis = [0] * M
lis_sort = sorted(lis,key =lambda x:(x[0],x[1]))
flag = lis_sort[0][0]
i = 1
for x in lis_sort:
    if x[0] != flag:
        flag = x[0]
        i=1
    x[1] = '0'*(6-len(str(i)))+str(i)
    i+=1
for x in lis:
    print('0'*(6-len(str(x[0]))),str(x[0]),x[1],sep='')
### BUGGY CODE ###

import sys
sys.setrecursionlimit(pow(10, 6))
input = sys.stdin.readline

def dfs(i, d):
  visited[i] = True
  ans[i] = d + pp[i]
  for j in edges[i]:
    if not visited[j]:
      dfs(j, d + pp[i])

n, q = map(int, input().split())
ans = [0 for _ in range(n)]
visited = [False for _ in range(n)]
edges = [[] for _ in range(n)]
for _ in range(n-1):
  a, b = map(int, input().split())
  edges[a-1].append(b-1)
  edges[b-1].append(a-1)
pp = [0 for _ in range(n)]
for _ in range(q):
  p, x = map(int, input().split())
  pp[p-1] += x
dfs(0, 0)
print(*ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(pow(10, 6))
input = sys.stdin.readline

def dfs(i, d):
  visited[i] = True
  ans[i] = d + pp[i]
  for j in edges[i]:
    if not visited[j]:
      dfs(j, d + pp[i])

n, q = map(int, input().split())
ans = [0 for _ in range(n)]
visited = [False for _ in range(n)]
edges = [[] for _ in range(n)]
for _ in range(n-1):
  a, b = map(int, input().split())
  edges[a-1].append(b-1)
  edges[b-1].append(a-1)
pp = [0 for _ in range(n)]
for _ in range(q):
  p, x = map(int, input().split())
  pp[p-1] += x
dfs(0, 0)
print(*ans)
### BUGGY CODE ###

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def dfs(x,d):
        d[x] = 0
        for y in v[x]:
            if d[y]:
                size[x] += dfs(y,d)
        return size[x]

    n = I()
    v = [[] for i in range(n)]
    size = [1]*n
    for i in range(n-1):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
        v[b].append(a)
    d = [1]*n
    dfs(0,d)
    inv = pow(2,mod-2,mod)
    ans = (1-pow(inv,n,mod)-n*inv)%mod
    p = [pow(inv,i,mod) for i in range(n)]
    for i in range(1,n):
        a = size[0]-size[i]
        b = n-a
        ans += (1-p[a])*(1-p[b])%mod
        ans %= mod
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    v = [[] for i in range(n)]
    for i in range(n-1):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
        v[b].append(a)
    q = deque([0])
    d = [0]*n
    d[0] = 1
    pre = [None]*n
    while q:
        x = q.popleft()
        nd = d[x]+1
        for y in v[x]:
            if not d[y]:
                d[y] = nd
                pre[y] = x
                q.append(y)
    V = list(range(1,n))
    V.sort(key = lambda x:-d[x])
    size = [1]*n
    for i in V:
        size[pre[i]] += size[i]
    inv = pow(2,mod-2,mod)
    ans = (1-pow(inv,n,mod)-n*inv)%mod
    p = [pow(inv,i,mod) for i in range(n)]
    for i in range(1,n):
        a = size[i]
        b = n-a
        ans += (p[a]-1)*(p[b]-1)%mod
        ans %= mod
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()
### BUGGY CODE ###

def sovle(x, y):
    while(x>=y):
        x=x-y
    if(x>y-x):
        return y-x
    else:return x



if __name__ == '__main__':
    nums = list(map(int, input().split(" ")))
    print(sovle(nums[0], nums[1]))

### FIXED CODE ###

def sovle(x, y):
    while(x>=y):
        x=x-x//y*y
    if(x>y-x):
        return y-x
    else:return x



if __name__ == '__main__':
    nums = list(map(int, input().split(" ")))
    print(sovle(nums[0], nums[1]))
### BUGGY CODE ###

A,B = map(int, input().split())
ans = A

for n in range(A+1,B+1):
    ans = ans ^ n
    
print(ans)

### FIXED CODE ###

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

def F0(n):
    if n%4 == 1:
        return 1
    if n%4 == 2:
        return n + 1
    if n%4 == 3:
        return 0
    if n%4 == 0:
        return n
    if n == 0:
        return 0


print(F0(A-1)^F0(B))
### BUGGY CODE ###

import math
n=int(input())

a=int(math.sqrt(n))

while True:
    if n%a==0:break
    else: a+=1

b=int(n/a)

a_dig = len(str(a))
b_dig = len(str(b))

ans=max(a_dig,b_dig)

print(ans)

### FIXED CODE ###

import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
ans = len(str(n//nn))
print(ans)
### BUGGY CODE ###

n = int(input())
a = [int(s) for s in input().split()]

count = 0

for j in range(1,n):
    for i in range(j):
        if a.count(a[i]) >= 2:
            count += 1
            break

if count >= 1:
    print('NO')
else:
    print('YES')

### FIXED CODE ###

def has_duplicates(seq):
    return len(seq) != len(set(seq))

n = int(input())
a = [int(s) for s in input().split()]

if has_duplicates(a) == False:
    print('YES')
else:
    print('NO')
### BUGGY CODE ###

import sys
N = int(input())
alist = list(map(int,input().split()))
flg = True
if N == 1:
    if alist[0] == 0:
        print(1)
    else:
        print(0)
    sys.exit()
inf = 10 ** 9 + 7
if N % 2 == 0:
    for i in range(N)[1::2]:
        if alist.count(i) != 2:
            flg = False
else:
    for i in range(N)[2::2]:
        if alist.count(i) != 2:
            flg = False
if flg:
    print((2 ** (N // 2)) %  inf)
else:
    print(0)

### FIXED CODE ###

import sys
N = int(input())
alist = list(map(int,input().split()))
flg = True
if N == 1:
    if alist[0] == 0:
        print(1)
    else:
        print(0)
    sys.exit()
inf = 10 ** 9 + 7
alist.sort()
if N % 2 == 0:
    for i in range(N)[1::2]:
        if alist[i-1] != i or alist[i] != i:
            flg = False
            break
else:
    if alist[0] != 0:
        flg = False
    for i in range(N)[2::2]:
        if alist[i-1] != i or alist[i] != i:
            flg = False
            break
if flg:
    print((2 ** (N // 2)) %  inf)
else:
    print(0)
### BUGGY CODE ###

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

for x in A:
    cnt = 0
    tmp = [x-1, x, x+1]
    for y in A:
        if y in tmp:
            cnt += 1
    ans.append(cnt)
#print(ans)
print(max(ans))

### FIXED CODE ###

import collections
N = int(input())
A = list(map(int, input().split()))
num = []
for i in range(N):
    num.append(A[i])
    num.append(A[i] + 1)
    num.append(A[i] - 1)
#print(num)
num_count = collections.Counter(num)
#print(num_count.values())
print(max(num_count.values()))
### BUGGY CODE ###

N, Q = map(int, input().split())
s = input()
for i in range(Q):
    l, r = map(int, input().split())
    _s = s[l - 1:r]
    num_ac = 0
    ex_a = False
    for c in _s:
        if ex_a and c == "C":
            num_ac += 1
        if c == "A":
            ex_a = True
        else:
            ex_a = False
    print(num_ac)

### FIXED CODE ###

N, Q = map(int, input().split())
s = input()
ac_cum_list = []
ac_cum = 0
ex_a = False
for c in s:
    if ex_a and c == "C":
        ac_cum += 1
    if c == "A":
        ex_a = True
    else:
        ex_a = False
    ac_cum_list.append(ac_cum)

for i in range(Q):
    l, r = map(int, input().split())
    print(ac_cum_list[r - 1] - ac_cum_list[l - 1])
### BUGGY CODE ###

from heapq import heappush, heappop
T = int(input())
A = []
for i in range(T):
    N, D = map(int, input().split())
    ans = D
    h = []
    heappush(h,D)
    for _ in range(N - 1):
        k = heappop(h)
        z = bin(k)[2:].zfill(7)
        u = map(lambda x: '0' if x == '1' else '1', z)
        t = int(''.join(u),2)
        heappush(h,t)
        ans += (127 + t - k)
    A.append(ans)
for i in range(len(A)):
    print(A[i])


### FIXED CODE ###

from heapq import heappush, heappop
T = int(input())
A = []
for i in range(T):
    N, D = map(int, input().split())
    ans = D
    h = []
    heappush(h,D)
    for _ in range(N - 1):
        k = heappop(h)
        t = 127 ^ k
        heappush(h,t)
        ans += (127 + t - k)
    A.append(ans)
for i in range(len(A)):
    print(A[i])
### BUGGY CODE ###

import sys  
input = sys.stdin.readline
import numpy as np

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

A = list(map(int, input().split()))
A.sort()
card = []
for i in range(M):
    b, c = list(map(int, input().split()))
    x = [c]*b
    card.extend(x)

card.sort()
card.reverse()

num = -1
for i in range(N):
    if i == len(card) :
        num = i
        break
    if card[i] < A[i]:
        num = i
        break
    


if num == -1:
    print(sum(card[:N]))
else:
    print(sum(card[:num]) + sum(A[num:]))

### FIXED CODE ###

import sys  
input = sys.stdin.readline
 
N, M = list(map(int, input().split()))
 
A = list(map(int, input().split()))



BC = []
for i in range(M):
    b, c = list(map(int, input().split()))
    BC.append([b, c])

BC=sorted(BC, reverse=True, key=lambda x:x[1])

cnt = 0
com = []
for b, c in BC:
    cnt += b
    if cnt > N:
        add = N-cnt+b
        com.extend([c]*add)
        break
    else:
        x = [c]*b 
        com.extend(x)
A.sort()   
num = -1
for k in range(N):
    if k == len(com):
        num = k
        break
    if A[k] > com[k]:
        num = k
        break

if num == -1:
    print(sum(com))
else:
    print(sum(com[:num])+sum(A[num:]))
### BUGGY CODE ###

import itertools
import numpy as np
n,ma,mb=map(int,input().split())
A,B,C=[],[],[]
for i in range(n):
  a,b,c=map(int,input().split())
  A.append(a)
  B.append(b)
  C.append(c)
ans=float("inf")
for key in itertools.product(range(2),repeat=n):
  aa=sum(list(map(np.prod,zip(A,key))))
  bb=sum(list(map(np.prod,zip(B,key))))
  cc=sum(list(map(np.prod,zip(C,key))))
  if aa*mb==bb*ma and aa!=0:
    ans=min(ans,cc)
print(-1 if ans==float("inf") else ans)

### FIXED CODE ###

n,ma,mb=map(int,input().split())
A=[]
for i in range(n):
  a,b,c=map(int,input().split())
  A.append([a,b,c])
DP=[[[float("inf")]*(10*n+1) for _ in range(10*n+1)] for _ in range(n+1)]
DP[0][0][0]=0
for i in range(n):
  a,b,c=A[i][0],A[i][1],A[i][2]
  for j in range(10*(i+1)+1):
    for k in range(10*(i+1)+1):
      if j>=a and k>=b:
        DP[i+1][j][k]=min(DP[i][j-a][k-b]+c,DP[i][j][k])
      else:
        DP[i+1][j][k]=DP[i][j][k]
ans=float("inf")
for i in range(10*n+1):
  for j in range(10*n+1):
    if i*mb==j*ma and i*j!=0:
      ans=min(ans,DP[n][i][j])
print(ans if ans!=float("inf") else -1)
### BUGGY CODE ###

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

sum = 1

for i in range(a,b+1):
    
    sum = sum*i

if sum < 0:
    print("Negative")
elif sum ==0:
    print("Zero")
else:
    print("Positive")

### FIXED CODE ###

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

if a > 0:
    print("Positive")
elif a<=0 and b >=0:
    print("Zero")
else:
    if (b-a+1)%2==0:
        print("Positive")
    else:
        print("Negative")
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
flag = True
for i in range(n-1):
    for j in range(i+1, n):
        if a[i] == a[j]:
            flag = False
            break
    else:
        continue
    break

if flag:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

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

if len(a) < n:
    print("NO")
if len(a) == n:
    print("YES")
### BUGGY CODE ###

h,w=map(int,input().split())
inf=10**3
d=((-1,0),(1,0),(0,-1),(0,1))
S=[["#"]*(w+2)]
S.extend([["#"]+[s for s in input()]+["#"] for _ in range(h)])
S.append(["#"]*(w+2))
import collections
def dist(a,b):
  D=[[inf]*(w+2) for _ in range(h+2)]
  D[a][b]=0
  Visit=collections.deque()
  Visit.append(100*a+b)
  while Visit:
    v=Visit.pop()
    va,vb=v//100,v%100
    for dx,dy in d:
      if S[va+dx][vb+dy]=="." and D[va+dx][vb+dy]>D[va][vb]+1:
        Visit.append((va+dx)*100+(vb+dy))
        D[va+dx][vb+dy]=D[va][vb]+1
  ret=0
  for i in range(h):
    for j in range(w):
      if D[i+1][j+1]<inf:
        ret=max(ret,D[i+1][j+1])
  return ret
ans=0
for i in range(h):
  for j in range(w):
    if S[i+1][j+1]==".":
      ans=max(dist(i+1,j+1),ans)
print(ans)





### FIXED CODE ###

h,w=map(int,input().split())
inf=float("inf")
d=((-1,0),(1,0),(0,-1),(0,1))
S=[["#"]*(w+2)]
S.extend([["#"]+[s for s in input()]+["#"] for _ in range(h)])
S.append(["#"]*(w+2))

def dist(a,b):
  if S[a][b]=="#":
    return 0
  else:
    D=[[inf]*(w+2) for _ in range(h+2)]
    D[a][b]=0
    Visit=[100*a+b]
    while Visit:
      v=Visit.pop()
      va,vb=v//100,v%100
      for dx,dy in d:
        if S[va+dx][vb+dy]=="#":
          continue
        elif D[va+dx][vb+dy]>D[va][vb]+1:
          Visit.append((va+dx)*100+(vb+dy))
          D[va+dx][vb+dy]=D[va][vb]+1
    ret=0
    for i in range(h):
      for j in range(w):
        if D[i+1][j+1]<inf:
          ret=max(ret,D[i+1][j+1])
    return ret
ans=0
for i in range(h):
  for j in range(w):
    ans=max(dist(i+1,j+1),ans)
print(ans)
### BUGGY CODE ###

n = int(input())
dic = {}

for i in range(n):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
keys = sorted([x[0] for x in dic.items() if x[1] == max(dic.values())])
print('\n'.join(keys))

### FIXED CODE ###

n = int(input())
dic = {}

for i in range(n):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1

dic = sorted(dic.items())
dic = sorted(dic, key=lambda x: -x[1])
dic.append(('_', 0))
for i in range(n):
    if dic[i][1] == dic[i + 1][1]:
        print(dic[i][0])
    else:
        print(dic[i][0])
        break
### BUGGY CODE ###

s = list(map(int, list(input())))
n = len(s)

countdic = {}
mod = 2019

num = 0
for i in range(1,n+1):
    num += s[n-i]*(10**(i-1))
    num %= mod
    if num in countdic:
        countdic[num] += 1
    if num not in countdic:
        countdic[num] = 1

ans = 0
for key in countdic:
    ans += countdic[key]*(countdic[key]-1)//2

if 0 in countdic:
    ans += countdic[0]

print(ans)

### FIXED CODE ###

s = list(map(int, list(input())))
n = len(s)

countdic = {}
mod = 2019

num = 0
d = 1
for i in range(1,n+1):
    num += s[n-i]*d
    num %= mod
    if num in countdic:
        countdic[num] += 1
    if num not in countdic:
        countdic[num] = 1
    d = (10*d)%mod

ans = 0
for key in countdic:
    ans += countdic[key]*(countdic[key]-1)//2

if 0 in countdic:
    ans += countdic[0]

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

n = int(input())
a = [int(i) for i in input().split()]

ans = 1
for i in a:
    ans *= i
if ans > 10**18:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 10**18:
            print(-1)
            break
    else:
        print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
aN = LIST()

# メモ[左端位置][右端位置] = この局面からの結果
memo = [[None] * (N+1) for i in range(N+1)]

def dfs(turn, l, r):
    # 既に見た局面ならメモの内容を返す
    if memo[l][r] is not None:
        return memo[l][r]
    # 全部取り切ったので終了
    if l > r:
        return 0
    # 先手番
    if turn == 0:
        mx = -INF
        mx = max(mx, dfs(1, l+1, r) + aN[l])
        mx = max(mx, dfs(1, l, r-1) + aN[r])
        # ここより深い所を探し終わったので結果をメモする
        memo[l][r] = mx
        return mx
    # 後手番
    else:
        mn = INF
        mn = min(mn, dfs(0, l+1, r) - aN[l])
        mn = min(mn, dfs(0, l, r-1) - aN[r])
        memo[l][r] = mn
        return mn

print(dfs(0, 0, N-1))


### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

# dp[i][j] := 左からi個、右からj個取った状態での最大(最小)得点
dp = list2d(N+1, N+1, 0)
# 初期化：どちらの手番で使う場所かに合わせて-INFかINFにする
for i in range(N):
    turn = i & 1
    for j in range(i+1):
        k = i - j
        if turn == 0:
            dp[j][k] = -INF
        else:
            dp[j][k] = INF
# 最初の遷移の開始地点(ゲーム終了の状態)は0に
for i in range(N+1):
    dp[i][N-i] = 0
# 終了から順番に戻って見ていく
for i in range(N-1, -1, -1):
    turn = i & 1
    for j in range(i+1):
        k = i - j
        l = j
        r = N - 1 - k
        if turn == 0:
            # 先手番の遷移
            dp[j][k] = max(dp[j][k], dp[j+1][k] + A[l])
            dp[j][k] = max(dp[j][k], dp[j][k+1] + A[r])
        else:
            # 後手番の遷移
            dp[j][k] = min(dp[j][k], dp[j+1][k] - A[l])
            dp[j][k] = min(dp[j][k], dp[j][k+1] - A[r])
ans = dp[0][0]
print(ans)
### BUGGY CODE ###

x,y = map(int,input().split())
MOD = 10**9+7

def inv_mod(a, p=MOD):
    def inv_mod_sub(a, p):
        if a == 1:
            return 1, 0
        else:
            d, r = p//a, p%a
            x, y = inv_mod_sub(r, a)
            return y-d*x, x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n, k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD

if (2*y-x) % 3 != 0 or (2*x-y) % 3 != 0:
  print(0)
else:
  k,l = (2*y-x)//3,(2*x-y)//3
  f_mod=[1]*(10**6)
  f_mod_inverse=[1]*(10**6)
  for i in range(1,10**6):
    f_mod[i]=f_mod[i-1]*i%MOD
    f_mod_inverse[i]=f_mod_inverse[i-1]*inv_mod(i)%MOD
  print(comb_mod(k+l,l))

### FIXED CODE ###

x,y = map(int,input().split())
MOD = 10**9+7

def inv_mod(a, p=MOD):
    def inv_mod_sub(a, p):
        if a == 1:
            return 1, 0
        else:
            d, r = p//a, p%a
            x, y = inv_mod_sub(r, a)
            return y-d*x, x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n, k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD

if (2*y-x) % 3 != 0 or (2*x-y) % 3 != 0:
  print(0)
else:
  k,l = (2*y-x)//3,(2*x-y)//3
  f_mod=[1]*(10**6)
  f_mod_inverse=[1]*(10**6)
  for i in range(1,10**6):
    f_mod[i]=f_mod[i-1]*i%MOD
    f_mod_inverse[i]=f_mod_inverse[i-1]*inv_mod(i)%MOD
  print(comb_mod(k+l,l))
### BUGGY CODE ###

n=int(input())
l=[0]*(n+1)
for i in range(1,n+1):
 
    for j in range(i,n+1,i):
 
        l[j]+=1
c=0
for i in range(1,n+1):
    c+=i*l[i]
 
print(c)

### FIXED CODE ###

n=int(input())
#n=10000000
ksum=0
for k in range(1,n+1):
    m=n//k
    ksum+=k*m*(m+1)//2
    
print(ksum)