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

import numpy as np
import math
n,m = map(int,input().split())
a = [0]*n
a = input().split()

for i in range(n):
	a[i] = int(a[i])

for i in range(m):#チケットの数
	a[np.argmax(a)] /= 2

for i in range(len(a)):
	a[i] = math.floor(a[i])

print(sum(a))



### FIXED CODE ###

import heapq
n,m = map(int,input().split())
a = [int(i) * (-1) for i in input().split()]

heapq.heapify(a)

for _ in range(m):
	a_min = heapq.heappop(a)
	heapq.heappush(a,(-(-a_min//2)))

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

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

N, Q = map(int, input().split())
children = [[i] for i in range(N)]  # 各頂点の持つ部分木の頂点の集合
edges = [list(map(int, input().split())) for _ in range(N-1)]
counts = np.zeros(N, dtype=np.int32)
for a, b in edges[::-1]:
    children[a-1] += children[b-1]

for _ in range(Q):
    p, x = map(int, input().split())
    counts[children[p-1]] += x

print(' '.join(list(map(str, counts))))

### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline

def main():
    N, Q = map(int, input().split())
    # edges = [None]*N
    edges = [[] for _ in range(N)]
    # edges[0] = 0
    # edges[0].append = 0
    for _ in range(N-1):
        a, b = map(int, input().split())
        edges[b-1].append(a-1)
        edges[a-1].append(b-1)

    counts = [0]*N
    for _ in range(Q):
        p, x = map(int, input().split())
        counts[p-1] += x

    parent_nodes = deque()
    parent_nodes.append(0)
    visited_nodes = set()
    while parent_nodes:
        parent = parent_nodes.popleft()
        if parent in visited_nodes:
            continue
        visited_nodes.add(parent)
        for child in edges[parent]:
            if child in visited_nodes:
                continue
            counts[child] += counts[parent]
            parent_nodes.append(child)

    print(' '.join(list(map(str, counts))))

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

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
ls = [n, 0, 0, 0, 0, 0]
while ls[-1] != n:
    ans += 1
    lscp = ls[:]
    ls[0] = lscp[0] - min(a,lscp[0])
    ls[1] = lscp[1] - min(b, lscp[1]) + min(a, lscp[0])
    ls[2] = lscp[2] - min(c, lscp[2]) + min(b, lscp[1])
    ls[3] = lscp[3] - min(d, lscp[3]) + min(c, lscp[2])
    ls[4] = lscp[4] - min(e, lscp[4]) + min(d, lscp[3])
    ls[5] = lscp[5] + min(e, lscp[4])
print(ans)

### FIXED CODE ###

import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
x = min(a, b, c, d, e)
X = math.ceil(n / x)
print(5 + X - 1)
### BUGGY CODE ###

if __name__ == "__main__":
  h,w = list(map(int,input().split()))
  a = [["*"*w] for i in range(h)]
  reached = [[10000 for i in range(w)] for j in range(h)]
  for i in range(h): a[i] = input()
  
  queue = []
  for i in range(h):
    for j in range(w):
      if a[i][j] == "#":
        queue.append([i,j])
        reached[i][j] = 0
  
  res = 0
  while len(queue) > 0:
    k = queue[0][0]
    l = queue[0][1]
    p = reached[k][l] + 1
    if 0 <= k+1 < h and 0 <= l < w:
      if p < reached[k+1][l]:
        reached[k+1][l] = p
        res = max(p, res)
        queue.append([k+1, l])
    if 0 <= k < h and 0 <= l+1 < w:
      if p < reached[k][l+1]:
        reached[k][l+1] = p
        res = max(p, res)
        queue.append([k, l+1])
    if 0 <= k-1 < h and 0 <= l < w:
      if p < reached[k-1][l]:
        reached[k-1][l] = p
        res = max(p, res)
        queue.append([k-1, l])
    if 0 <= k < h and 0 <= l-1 < w:
      if p < reached[k][l-1]:
        reached[k][l-1] = p
        res = max(p, res)
        queue.append([k, l-1])
    queue.pop(0)
  print(res)

### FIXED CODE ###

def main():
  h,w = map(int,input().split())

  q = []
  reached = [[True]*(w+2)]
  for i in range(1, h+1):
    reached.append([True] + [s == '#' for s in list(input())] + [True])
    for j in range(1,w+1):
      if reached[i][j]: q.append((i,j))
  reached.append([True]*(w+2))

  res = 0
  for i in range(100000000):
    qq = []
    for k,l in q:
      if not reached[k+1][l]:
        qq.append((k+1, l))
        reached[k+1][l] = True
      if not reached[k][l+1]:
        qq.append((k, l+1))
        reached[k][l+1] = True
      if not reached[k-1][l]:
        qq.append((k-1, l))
        reached[k-1][l] = True
      if not reached[k][l-1]:
        qq.append((k, l-1))
        reached[k][l-1] = True
    if len(qq) == 0:
      break
    else:
      pass

    q = qq
    res += 1

  print(res)
  return 0

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

M = int(input())
D, C = [0] * M, [0] * M
total = 0
count = 0
for i in range(M):
	D[i], C[i] = map(int, input().split())
	count += D[i] * C[i]
	while count > 9:
		total += 1
		count -= 9
print(sum(C)-1+total)

### FIXED CODE ###

M = int(input())
D, C = [0] * M, [0] * M
total = 0
for i in range(M):
	D[i], C[i] = map(int, input().split())
	total += D[i] * C[i]
print(sum(C)-1+(int((total-1)/9)))
### BUGGY CODE ###

from sys import stdin

def main():
    point = 0
    r,g,b,n = [int(x) for x in stdin.readline().rstrip().split()]
    for i in range(n//r+1):
        for j in range(n//g+1):
            if n-r*i-g*j >= 0:
                if (n-r*i-g*j)%b == 0:
                    point += 1
    print(point)

main()

### FIXED CODE ###

from sys import stdin
import math

point = 0

r,g,b,n = [int(x) for x in stdin.readline().rstrip().split()]
for i in range(n//r+1):
    for j in range(n//g+1):
        if n-r*i-g*j >= 0:
            if (n-r*i-g*j)%b == 0:
                point += 1

print(point)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import math
def main():
    N,M = map(int,input().split())
    A = list(map(int,input().split()))
    for _ in range(M):
        MAX = max(A)
        tmpi = A.index(MAX)
        A[tmpi] = math.floor(A[tmpi]-(MAX/2))
    print(sum(A))
if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*- coding: utf-8 -*-
import heapq as hq
def main():
    N,M = map(int,input().split())
    A=[-int(j) for j in input().split()]
    hq.heapify(A)
    for _ in range(M):
        tmp = hq.heappop(A)
        hq.heappush(A,(-((-tmp)//2)))
    print(-sum(A))
if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

def dp():
    n=int(input())
    l=list(map(int,input().split()))
    lcm=1
    for i in l:
        lcm=(lcm*i)//gcd(lcm,i)
    ans=0
    mod=1000000007
    for i in l:
        ans=(ans+(lcm//i))%mod
    print(ans)

if __name__ == "__main__":
    dp()

### FIXED CODE ###

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

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

def dp():
    n=int(input())
    l=list(map(int,input().split()))
    lcm=l[0]
    for i in range(n):
        lcm=Lcm(lcm,l[i])
    ans=0
    mod=1000000007
    for i in range(n):
        ans+=lcm//l[i]
    print(ans%mod)

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

import sys
sys.setrecursionlimit(10**7)

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

adjacent_list = [[] for i in range(n+1)]
for i in range(n - 1):
    a, b = map(int, input().split())
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
tree_value = [0]*(n+1)
for i in range(q):
    p, x = map(int, input().split())
    tree_value[p] += x
searched = set()
def dfs(node, count):
    searched.add(node)
    tree_value[node] += count
    for i in adjacent_list[node]:
        if i not in searched:
            dfs(i, tree_value[node])
dfs(1,0)
for i in range(1,n+1):
    print("{} ".format(tree_value[i]), end = "")


### FIXED CODE ###

import sys
from queue import *
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

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

adjacent_list = [[] for i in range(n+1)]
for i in range(n - 1):
    a, b = map(int, input().split())
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
tree_value = [0]*(n+1)
for i in range(q):
    p, x = map(int, input().split())
    tree_value[p] += x
searched = set()
"""
def dfs(node, count):
    searched.add(node)
    tree_value[node] += count
    for i in adjacent_list[node]:
        if i not in searched:
            dfs(i, tree_value[node])
"""
used = [0 for i in range(n+1)]
que = Queue()
que.put(1)
while que.qsize() != 0:
    m = que.get()
    used[m] = 1
    for i in adjacent_list[m]:
        if not used[i]:
            tree_value[i] += tree_value[m]
            que.put(i)
for i in range(1,n+1):
    print("{} ".format(tree_value[i]), end = "")
### BUGGY CODE ###

from collections import deque

H, W = list(map(int, input().split()))
S = []
for i in range(H):
  S.append(input())

def bfs(x,y):
  d = deque()
  d.append([x,y,0])
  visited = [[False for i in range(W)] for j in range(H)]

  maxd = -1
  while len(d) > 0:
    x,y,w = d.popleft()
    visited[x][y] = True
    next_point = []
    for dx,dy in [[1,0], [-1,0], [0,-1], [0,1]]:
      if 0 <= x + dx and x + dx < H and 0 <= y + dy and y + dy < W and S[x+dx][y+dy] == ".":
        next_point.append([x + dx, y + dy])
    for p, q in next_point:
      if visited[p][q]:
        continue
      d.append([p,q,w+1])
      maxd = max(maxd, w+1)

  return maxd

ans = -1
for X in range(H):
  for Y in range(W):
    if S[X][Y] == "#":
      continue
    ans = max(bfs(X,Y), ans)
    
print(ans)

### FIXED CODE ###

from collections import deque

H, W = list(map(int, input().split()))
S = []
for i in range(H):
  S.append(input())

def bfs(x,y):
  d = deque()
  d.append([x,y,0])
  visited = [[False for i in range(W)] for j in range(H)]
  will_search = [[False for i in range(W)] for j in range(H)]
  maxd = -1
  while len(d) > 0:
    x,y,w = d.popleft()
    visited[x][y] = True
    next_point = []
    for dx,dy in [[1,0], [-1,0], [0,-1], [0,1]]:
      if 0 <= x + dx and x + dx < H and 0 <= y + dy and y + dy < W and S[x+dx][y+dy] == ".":
        next_point.append([x + dx, y + dy])
    for p, q in next_point:
      if visited[p][q]:
        continue
      if will_search[p][q]:
        continue
      d.append([p,q,w+1])
      will_search[p][q] = True
      maxd = max(maxd, w+1)

  return maxd

ans = -1
for X in range(H):
  for Y in range(W):
    if S[X][Y] == "#":
      continue
    ans = max(bfs(X,Y), ans)
    
print(ans)
### BUGGY CODE ###

import copy
n = int(input())
a = list(map(int,input().split()))
cnt = []
a_plus1 = copy.copy(a)
a_minus1 = copy.copy(a)
for x in range(n):
    a_plus1[x] += 1
for y in range(n):
    a_minus1[y] -= 1
a_total = a + a_plus1 + a_minus1
a_el = list(set(a))
for i in range(len(a_el)):
    cnt.append(a_total.count(a_el[i]))
print(max(cnt))

### FIXED CODE ###

import copy
from collections import Counter
n = int(input())
a = list(map(int,input().split()))

a_plus1 = copy.copy(a)
a_minus1 = copy.copy(a)
for x in range(n):
    a_plus1[x] += 1
for y in range(n):
    a_minus1[y] -= 1
a_total = a + a_plus1 + a_minus1
cnt = Counter(a_total)
a_max = list(cnt.values())
print(max(a_max))
### BUGGY CODE ###

# given an array of Heights, jump from 1 to N with at most K sized jump to N
# each jump incurs abs(H[j] - H[i]) cost
# minimize cost of jumps from 1 to N
#
import collections

def frog(H, k):
    K = collections.deque([0] * (k + 1))
    n = len(H)
    for i in range(n):
        cost = 0
        if i > 0:
            maxjump = min(i, k)
            cost = float("inf")
            for j in range(1, maxjump + 1):
                cost = min(cost, abs(H[i] - H[i - j]) + K[len(K) - j])
        K.append(cost)
        K.popleft()
    return cost

assert frog([40, 10, 20, 70, 80, 10, 20, 70, 80, 60], 4) == 40
assert frog([10, 10], 100) == 0
assert frog([10, 20, 10], 1) == 20

import sys
s = sys.stdin.read()
l1, l2 = s.splitlines()

N, k = map(int, l1.split())
H = [int(x) for x in l2.split()]
ans = frog(H, k)
print(ans)


### FIXED CODE ###

# given an array of Heights, jump from 1 to N with at most K sized jump to N
# each jump incurs abs(H[j] - H[i]) cost
# minimize cost of jumps from 1 to N
#
def frog(H, k):
    if k > len(H):
        k = len(H)
    n = len(H)
    K = [0] * n
    inf = float("inf")
    for i in range(n):
        cost = 0
        if i > 0:
            maxjump = i if i < k else k # min(i, k)
            cost = inf
            hi = H[i]
            # jump source going backwards from i-1 (smallest 1 sized jump) to i - maxjumps
            for j in range(i - 1, i - maxjump - 1, -1):
                jcost = abs(hi - H[j]) + K[j]
                if jcost < cost:
                    cost = jcost
        K[i] = cost
    return cost

assert frog([40, 10, 20, 70, 80, 10, 20, 70, 80, 60], 4) == 40
assert frog([10, 10], 100) == 0
assert frog([10, 20, 10], 1) == 20

if __name__ == "__main__":
    import sys
    s = sys.stdin.read()
    N, k, *H = map(int, s.split())
    ans = frog(H, k)
    print(ans)
### BUGGY CODE ###

n=int(input())
string_list=["".join(sorted(list(input()))) for i in range(n)]
string_set=set(string_list)
cnt=0
for s in string_set:
  n=string_list.count(s)
  cnt+=int(n*(n-1)/2)
print(cnt)

### FIXED CODE ###

from collections import Counter
n=int(input())
string_list=["".join(sorted(list(input()))) for i in range(n)]
counter=Counter(string_list)
cnt=0
for k, v in counter.items():
  cnt+=int(v*(v-1)/2)
print(cnt)
### BUGGY CODE ###

#!/usr/bin/env python3

from scipy.special import comb

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


a.sort()

value = comb(a[1], a[0], exact=True)
ans = [a[1], a[0]]
index = 0
for i in range(2, n):
    value_tmp = comb(a[i], a[index], exact=True)
    while 1:
        tmp = comb(a[i], a[index+1], exact=True)
        if value_tmp > tmp:
            break
        else:
            value_tmp = tmp
            index += 1
    if value_tmp > value:
        ans = [a[i], a[index]]
        value = value_tmp
print(*ans)


### FIXED CODE ###

#!/usr/bin/env python3

import bisect

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

a.sort()

if n == 2:
    print(a[1], a[0])
    exit()
# value = comb(a[1], a[0], exact=True)
# ans = [a[1], a[0]]
# index = 0
# for i in range(2, n):
#     value_tmp = comb(a[i], a[index], exact=True)
#     x = a[i]
#     y = a[index]
#     diff = abs((x-2*y)//2)
#     while 1:
#         y_new = a[index+1]
#         diff_new = abs((x-2*y_new)//2)
#         if diff_new > diff:
#             break
#         else:
#             index += 1
#     if value_tmp > value:
#         ans = [a[i], a[index]]
#         # value = value_tmp
# print(*ans)

x = a[-1]
index = bisect.bisect_left(a[:n-1], x/2)

ans = []
ans.append([abs(x/2-a[index-1]), a[index-1]])
ans.append([abs(x/2-a[index]), a[index]])
ans.append([abs(x/2-a[index+1]), a[index+1]])

ans.sort()

print(x, ans[0][1])
### BUGGY CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)

reverse = 0
pre = ''
after = ''
S = input()
Q = int(input())
for i in range(Q):
    q = input()
    if q[0] == '1':
        reverse = 1 - reverse
    else:
        T, F, C = q.split()
        if (F == '1') ^ (reverse == 1):
            pre = C + pre
        else:
            after += C
S = pre + S + after
if reverse:
    S = S[::-1]
print(S)


### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)

reverse = 0
pre = []
after = []
S = input()
Q = int(input())
for i in range(Q):
    q = input()
    if q[0] == '1':
        reverse = 1 - reverse
    else:
        T, F, C = q.split()
        if (F == '1') ^ (reverse == 1):
            pre.append(C)
        else:
            after.append(C)
if reverse:
    after.reverse()
    ans = ''.join(after) + S[::-1] + ''.join(pre)
else:
    pre.reverse()
    ans = ''.join(pre) + S + ''.join(after)
print(ans)
### BUGGY CODE ###

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

A.sort()

MOD = 10 ** 9 + 7

max_X = 0
min_X = 0

combinations = 1

count = K - 1

for i in range(N - K + 1):
    max_X += combinations * A[count + i]
    min_X += combinations * A[N - count - 1 - i]
    max_X %= MOD
    min_X %= MOD
    combinations = combinations * ( K - 1 + i + 1 ) // (K - 1 + i - K + 1 + 1)

ans = max_X - min_X

while ans < 0:
    ans += MOD

print(ans % MOD)

### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 9)

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

A.sort()

MOD = 10 ** 9 + 7


# aの-1乗をmで割ったときの商を求める
def mod_inv(a, m=10 ** 9 + 7):
    b = m
    u = 1
    v = 0
    while b > 0:
        t = a // b
        a -= t * b
        c = a
        a = b
        b = c

        u -= t * v
        c = u
        u = v
        v = c
    u %= m
    return u


max_X = 0
min_X = 0

combinations = 1

count = K - 1

for i in range(N - K + 1):
    max_X += combinations * A[count + i]
    min_X += combinations * A[N - count - 1 - i]
    max_X %= MOD
    min_X %= MOD
    combinations = (combinations * (K + i) * mod_inv(i + 1)) % MOD

ans = max_X - min_X

while ans < 0:
    ans += MOD

print(ans % MOD)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
B - Frog 2
https://atcoder.jp/contests/dp/tasks/dp_b

"""
import sys
from sys import stdin


def solve(ashiba, N, K):
    dp = [float('inf')] * N
    dp[0] = 0
    for i in range(1, len(ashiba)):
        for j in range(max(0, i-K), i):
            dp[i] = min(dp[i], dp[j]+abs(ashiba[j]-ashiba[i]))
    return dp[-1]


def main(args):
    N, K = map(int, input().split())
    ashiba = [int(i) for i in input().split()]
    ans = solve(ashiba, N, K)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
B - Frog 2
https://atcoder.jp/contests/dp/tasks/dp_b

"""
import sys
from sys import stdin


def solve(ashiba, N, K):
    dp = [float('inf')] * N
    dp[0] = 0
    for i in range(1, len(ashiba)):
        paths = [dp[j]+abs(ashiba[j]-ashiba[i]) for j in range(max(0, i-K), i)]
        dp[i] = min(paths)
    return dp[-1]


def main(args):
    N, K = map(int, input().split())
    ashiba = [int(i) for i in input().split()]
    ans = solve(ashiba, N, K)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
### BUGGY CODE ###

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

from collections import deque 
def main():
    N = int(readline())
    to = [[] for _ in range(N)]
    wight = [[-1 for _ in range(N)] for _ in range(N)]
    for _ in range(N-1):
        u, v, w = map(int, readline().split())
        u-=1
        v-=1
        to[u].append(v)
        to[v].append(u)
        wight[u][v] = w
        wight[v][u] = w

    dq = deque()
    dq.append(0)
    dist = [-1 for _ in range(N)]
    dist[0] = 0
    while len(dq)>0:
        v = dq.popleft()
        for nx in to[v]:
            if dist[nx] != -1:
                continue
            dist[nx] = (dist[v]+wight[v][nx])%2
            dq.append(nx)

    for i in dist:
        print(i)
if __name__ == '__main__':
    main()


### FIXED CODE ###

#python3
from collections import deque
def main():
    n = int(input()) 
    #隣接リスト表現でグラフを管理する
    #v-uのcostはto[v]においてuが格納されている位置と同じcost[v]リスト位置に保存するような対応関係をとる
    to = [[] for _ in range(n)]
    cost = [[] for _ in range(n)]
    for _ in range(n-1):
        v, u, w  = map(int, input().split())
        v -= 1
        u -= 1
        to[v].append(u)
        cost[v].append(w)
        to[u].append(v)
        cost[u].append(w)

    
    #根からの距離を偶奇をBFSで求める    
    dist = [-1 for _ in range(n)]
    dist[0] = 0
    q = deque()
    q.append(0)
    while len(q) != 0:
        #訪問予定の頂点を取り出す
        val = q.popleft()
        #頂点vに連結している頂点を探索すして訪問予定に追加する
        for i in range(len(to[val])):
            wal = to[val][i]
            cos = cost[val][i]
            if dist[wal] != -1:
                continue
            dist[wal] = (dist[val] + cos)%2 
            q.append(wal)
    
    for i in range(n):
        print(dist[i])
main()
### BUGGY CODE ###

N,K = map(int,input().split())
p = list(map(int,input().split()))
A = [sum(p[i:i+K]) for i in range(N-K+1)]
print((max(A) + K) / 2)

### FIXED CODE ###

N,K = map(int,input().split())
p = list(map(int,input().split()))
result = 0
p_t = [0]
for i in range(N):
    p_t.append(p[i]+p_t[i])
ans = p_t[K] - p_t[0]

for i in range(N-K):
    tmp = p_t[i+1+K] - p_t[i+1]
    if ans < tmp:
        ans = tmp
print((ans+K)/2)
### BUGGY CODE ###


import math
n,a,b,k= map(int,input().split())	
def w(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
#コンビネーション


c = 0
if k//a >= n:
    x = n
else:
    x = k //a

if k == 0:
    c = 1   
else:
    for h in range(0,x+1):
        i = (k-a*h)/b
    
        if i == int(i) and n >= i:
            c = w(n,h)*w(n,int(i))%998244353+c

print(c%998244353)

### FIXED CODE ###

mod = 998244353

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

fact = [1]
fact_inv = [1]
for i in range(n+4):
    new_fact = fact[-1]*(i+1)%mod
    fact.append(new_fact)
    fact_inv.append(pow(new_fact,mod-2,mod))


def mod_comb_k(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod


res = 0

for i in range(n+1):
    if k - a*i < 0:
        continue
    
    if (k-a*i)%b != 0:
        continue

    j = (k-a*i)//b

    if j > n:
        continue

    res = (res + mod_comb_k(n,j,mod)*mod_comb_k(n,i,mod)%mod)%mod

print(res%mod)
### BUGGY CODE ###

import itertools
#(縦, 横)
#bfs 徒歩→ワープ→徒歩→ワープ→…

h,w = map(int,input().split())
sy, sx = map(int,input().split())
start = (sy-1, sx-1)
gy, gx = (map(int,input().split()))
goal = (gy-1, gx-1)

chizu = [input() for _ in range(h)]
kabeset = set()

for i in range(h):
	for j in range(w):
		if chizu[i][j] == "#":
			kabeset.add((i, j))

settansaku = set()
stock = set()
setmada = {start}
mode = 1
cost = 0

while len(setmada) > 0:
	while len(setmada) > 0:
		for i, j in list(setmada):
			settansaku.add((i, j))
			stock.add((i, j))
			setmada.remove((i, j))
			for k in [(i+1, j), (i-1, j), (i, j-1), (i, j+1)]:
				if not k in kabeset:
					if 0 <= k[0]:
						if 0 <= k[1]:
							if k[0] < h:
								if k[1] < w:
									if not k in setmada:
										if not k in settansaku:
											setmada.add(k)
								
	if goal in settansaku:
		mode = 0
		break
	
	cost += 1
	for i, j in list(stock):
		stock.remove((i, j))
		for k in itertools.product(range(i-2, i+3), range(j-2, j+3)):
			if not k in settansaku:
				if 0 <= k[0]:
					if 0 <= k[1]:
						if k[0] < h:
							if k[1] < w:
								if not k in kabeset:
									setmada.add(k)
	
	if goal in settansaku:
		mode = 0
		break

if mode == 0:
	print(cost)
else:
	print(-1)

### FIXED CODE ###

h,w = map(int,input().split())
sy, sx = map(int,input().split())
start = (sy-1, sx-1)
gy, gx = (map(int,input().split()))
goal = (gy-1, gx-1)

yukaset = set()

for i in range(h):
	chizu = input()
	for j in range(w):
		if chizu[j] == ".":
			yukaset.add((i, j))

settansaku = {start}
stock = []
listmada = [start]
mode = 1
cost = 0

while len(listmada) > 0:
	for i, j in listmada:
		stock.append((i, j))
		for k in [(i+1, j), (i-1, j), (i, j-1), (i, j+1)]:
			if k in yukaset:
				if k not in settansaku:
					listmada.append(k)
					settansaku.add(k)

	if goal in settansaku:
		mode = 0
		break
	
	listmada = []
	cost += 1
	for i, j in stock:
		for k in [(i-2, j-2), (i-1, j-2), (i, j-2), (i+1, j-2), (i+2, j-2), (i-2, j-1), (i-1, j-1), (i, j-1), (i+1, j-1), (i+2, j-1), (i-2, j), (i-1, j), (i+1, j), (i+2, j), (i-2, j+1), (i-1, j+1), (i, j+1), (i+1, j+1), (i+2, j+1), (i-2, j+2), (i-1, j+2), (i, j+2), (i+1, j+2), (i+2, j+2)]:
			if k in yukaset:
				if k not in settansaku:
					listmada.append(k)
					settansaku.add(k)
	
	stock = []

if mode == 0:
	print(cost)
else:
	print(-1)
### BUGGY CODE ###

# coding: utf-8


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


# solve
for i in range(N):
    t = 0
    B = list(A)
    B.pop(i)
    j = 0
    while (True):
        # 最初
        if (j == 0):
            t += abs(B[j])
            j += 1
        # 最後
        elif (j == len(B)):
            t += abs(B[j-1])
            break
        else:
            t += abs(B[j] - B[j-1])
            j += 1
    print(t)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
N = input()
A = map(int, input().split())
A = list(A)

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

for i in range(1, len(A) - 1):
    partial_sum = total_sum - abs(A[i + 1] - A[i]) - abs(A[i] - A[i - 1]) + abs(A[i + 1] - A[i - 1])
    print(partial_sum)