Harryxun/stf_run huggingface dataset:
a = []
for i in range(5):
  num = input()
  a.append(num)
if int(a[0][2]) <= int(a[1][2]) and int(a[0][2]) <= int(a[2][2]) and int(a[0][2]) <= int(a[3][2]) and int(a[0][2]) <= int(a[4][2]):
  b = int(a[1]) + 10-int(a[1][2]) + int(a[2]) + 10-int(a[2][2]) + int(a[3]) + 10-int(a[3][2]) + int(a[4]) + 10-int(a[4][2]) + int(a[0])
  print(b)
elif int(a[1][2]) <= int(a[0][2]) and int(a[1][2]) <= int(a[2][2]) and int(a[1][2]) <= int(a[3][2]) and int(a[1][2]) <= int(a[4][2]):
  b = int(a[0]) + 10-int(a[0][2]) + int(a[2]) + 10-int(a[2][2]) + int(a[3]) + 10-int(a[3][2]) + int(a[4]) + 10-int(a[4][2]) + int(a[1])
  print(b)
elif int(a[2][2]) <= int(a[0][2]) and int(a[2][2]) <= int(a[1][2]) and int(a[2][2]) <= int(a[3][2]) and int(a[2][2]) <= int(a[4][2]):
  b = int(a[0]) + 10-int(a[0][2]) + int(a[1]) + 10-int(a[1][2]) + int(a[3]) + 10-int(a[3][2]) + int(a[4]) + 10-int(a[4][2]) + int(a[2])
  print(b)
elif int(a[3][2]) <= int(a[0][2]) and int(a[3][2]) <= int(a[1][2]) and int(a[3][2]) <= int(a[2][2]) and int(a[3][2]) <= int(a[4][2]):
  b = int(a[0]) + 10-int(a[0][2]) + int(a[1]) + 10-int(a[1][2]) + int(a[2]) + 10-int(a[2][2]) + int(a[4]) + 10-int(a[4][2]) + int(a[3])
  print(b)
elif int(a[4][2]) <= int(a[0][2]) and int(a[4][2]) <= int(a[1][2]) and int(a[4][2]) <= int(a[2][2]) and int(a[4][2]) <= int(a[3][2]):
  b = int(a[0]) + 10-int(a[0][2]) + int(a[1]) + 10-int(a[1][2]) + int(a[2]) + 10-int(a[2][2]) + int(a[3]) + 10-int(a[3][2]) + int(a[4])
  print(b)

### FIXED CODE ###

A = [int(input()) for i in range(5)]
B = [a - a % 10 + 10 if a % 10 != 0 else a for a in A]
diff = [(b - a) for a, b in zip(A, B)]
print(sum(B)-max(diff))
N = input()
lst = []
for i in range(N):
  s, p = map(int, input().split())
  lst.append([s, p, i])
  lst_2 = sort(key = lambda x : (x[0], -1 * int(x[1])))
  
for i in lst_2:
  print(i[2] + 1)

### FIXED CODE ###

N = int(input())
lst = []
for i in range(N):
  s, p = input().split()
  lst.append([s, p, i])
  lst_2 = sorted(lst, key = lambda x : (x[0], -1 * int(x[1])))
  
for i in lst_2:
  print(i[2] + 1)
n = int(input())
c = sorted([int(_) for _ in input().split()], reverse=True)
ans = 0
mod = 10**9+7
for i in range(n):
    ans += (c[i] * (pow(2, n-1, mod) + pow(2, n-2, mod) * i)) % mod
    ans %= mod
ans *= pow(2, n, mod)
ans %= mod
print(ans)


### FIXED CODE ###

import sys


n = int(input())
c = sorted([int(_) for _ in input().split()], reverse=True)
mod = 10**9+7
ans = 0
if n == 1:
    ans += c[0] * 2
    ans %= mod
    print(ans)
    sys.exit()
for i in range(n):
    ans += (c[i] * (pow(2, n-1, mod) + pow(2, n-2, mod) * i)) % mod
    ans %= mod
ans *= pow(2, n, mod)
ans %= mod
print(ans)
from math import sqrt, inf

a = []


def dis(n):
    for i in range(1, int(sqrt(n)) + 1):
        if n % i == 0:
            a.append(i)


num = int(input())
dis(num)
ans = inf
for e in a:
    ans = min(ans, e + num // e - 2)
print(ans)


### FIXED CODE ###

def solve(n):
    ans = int(1e12)
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0 and i + n // i - 2 < ans:
            ans = i + n // i - 2
    return int(ans)


num = int(input())
print(solve(num))
N,M=list(map(int,input().split()))
A=[]
for i in range(N):
    A.append(list(map(int,input().split())))
# print(A)
A.sort()
#print(A)
res,count=0,0
for i in range(N):
    res+=A[i][0]*A[i][1]
    count+=A[i][1]
    if(count==M):
        break 
    if(count>M):
        res-=A[i][0]*A[i][1]
        count-=A[i][1]
        for j in range(1,A[i][1]+1):
            res+=A[i][0]
            count+=1
            if(count==M):
                print(res)
                exit()

print(res)
exit()a
                


### FIXED CODE ###

N,M=list(map(int,input().split()))
A=[]
for i in range(N):
    A.append(list(map(int,input().split())))
# print(A)
A.sort()
#print(A)
res,count=0,0
for i in range(N):
    res+=A[i][0]*A[i][1]
    count+=A[i][1]
    if(count==M):
        break 
    if(count>M):
        res-=A[i][0]*A[i][1]
        count-=A[i][1]
        for j in range(1,A[i][1]+1):
            res+=A[i][0]
            count+=1
            if(count==M):
                print(res)
                exit()

print(res)
exit()
# 最大公約数
def gcd(m, n):
    while(n != 0):
        temp = n
        n = m % n
        m = temp
    return m


N = int(input())
T = [int(input()) for _ in range(N)]
ans = 0
for i in range(len(T)):
    if ans == 0:
        ans = T[i]
    else:
        ans = int((ans * T[i]) / gcd(ans, T[i]))
print(ans)


### FIXED CODE ###

# 最大公約数
def gcd(m, n):
    while(n != 0):
        temp = n
        n = m % n
        m = temp
    return m


N = int(input())
T = [int(input()) for _ in range(N)]
ans = 0
for i in range(len(T)):
    if ans == 0:
        ans = T[i]
    else:
        ans = ans // gcd(ans, T[i]) * T[i]
print(ans)
N=int(input())
A=list(map(int,input().split()))
B=A.copy()
counter=0
for num in range(N-1):
  if A[num] in B:
    counter+=1
    while A[num] in B:
      B.remove(A[num])
  
print(counter)

### FIXED CODE ###

N=int(input())
z=[]
for num in range(101):
  z.append(0)
counter=0
while counter < N:
  d=int(input())
  z[d]=1
  counter+=1
result=sum(z)
print(result)
import copy, collections, itertools
H, W = [int(_) for _ in input().split()]
S = [['#'] * (W + 2)] + [['#'] + list(input()) + ['#']
                          for _ in range(H)] + [['#'] * (W + 2)]
ans = 0
def bfs(x, y, S):
    s = copy.deepcopy(S)
    q = collections.deque([(x, y, 0)])
    while q:
        x, y, d = q.popleft()
        for dx, dy in [[-1, 0], [1, 0], [0, -1], [0, 1]]:
            nx, ny = x + dx, y + dy
            if s[nx][ny] == '.':
                q += [[nx, ny, d + 1]]
                s[nx][ny] = '#'
    return x, y, d
for x,y in itertools.product(range(1, H + 1), range(1, W + 1)):
    if S[x][y] == '.':
        s[x][y] = '#'
        break
x, y, d = bfs(x, y, S)
x, y, d = bfs(x, y, S)
print(d)


### FIXED CODE ###

import copy, collections, itertools
H, W = [int(_) for _ in input().split()]
S_ = [['#'] * (W + 2)] + [['#'] + list(input()) + ['#']
                          for _ in range(H)] + [['#'] * (W + 2)]
ans = 0
for i, j in itertools.product(range(1, H + 1), range(1, W + 1)):
    if S_[i][j] == '.':
        S = copy.deepcopy(S_)
        S[i][j] = '#'
        q = collections.deque([(i, j, 0)])
        while q:
            x, y, d = q.popleft()
            for dx, dy in [[-1, 0], [1, 0], [0, -1], [0, 1]]:
                if S[x + dx][y + dy] == '.':
                    X, Y = x + dx, y + dy
                    S[X][Y] = '#'
                    q += [(X, Y, d + 1)]
        ans = max(d, ans)
print(ans)
import math
a, b, h, m = map(int, input().split())
angle = abs(90 - abs(h * 30 + (m / 60) * 30 - m * 6))
n = b * math.sin(math.radians(angle))
x = b * math.cos(math.radians(angle)) * (1 / (1 - n / a)) - b * math.cos(math.radians(angle))
print(math.sqrt(((b * math.cos(math.radians(angle)) + x) ** 2 + a ** 2)) - math.sqrt(n ** 2 + x ** 2))

### FIXED CODE ###

import math
a, b, h, m = map(int, input().split())
ang = min(h * 30 + (m / 60) * 30 - m * 6, 360 - (h * 30 + (m / 60) * 30 - m * 6))
print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(ang))))
s = [[1, 3, 5, 7, 8, 10, 12][4, 6, 9, 11][2]]
x, y = map(int, input().split())
for i in range(3):
  if x in s[i] and y in s[i]:
    print("Yes")
    exit()
print("No")

### FIXED CODE ###

s = [[1, 3, 5, 7, 8, 10, 12],[4, 6, 9, 11],[2]]
x, y = map(int, input().split())
for i in range(3):
  if x in s[i] and y in s[i]:
    print("Yes")
    exit()
print("No")
a,b,c = stdin.readline().rstrip().split()
if a+b+c >= 22:
	print('bust')
else:
	print('win')

### FIXED CODE ###

from sys import stdin
a, b, c = [int(x) for x in stdin.readline().rstrip().split()]
if a+b+c >= 22:
  print('bust')
else:
  print('win')
H, W, N = map(int, input().split())
mat = [[0]*W for _ in range(H)]

for _ in range(N):
    a, b = map(int, input().split())
    mat[a-1][b-1] = 1


dp = [[0]*W for _ in range(H)]
for h in range(H):
    cnt = 0
    if mat[h][0] == 1:
        dp[h][0] = 1
    for w in range(1, W):
        if mat[h][w] == 1:
            dp[h][w] += 1
        dp[h][w] += dp[h][w-1]


ans = [0]*10
for i in range(10):
    tmp = 0
    for h in range(H-3):
        for w in range(W-3):
            s = 0
            for k in range(3):
                s += dp[h+k][w+2]-dp[h+k][w]
            if s == i:
                tmp += 1
    ans[i] = tmp

for i in ans:
    print(i)


### FIXED CODE ###

s = input()
nums = [int(v) for v in s]

l = len(s)

ans = 0
for i in range(1 << (l-1)):
    tmp = s[0]
    for j in range(l-1):
        if i & 1 << j:
            tmp += '+'+s[j+1]
        else:
            tmp += s[j+1]
    ans += eval(tmp)
print(ans)
n = int(input())
ab = str(input())

ans = set([0])
lenab = len(ab)
for h in range(lenab):
    abc = ab[h:]
    lenabc = lenab - h
    A = [0] * lenabc
    i = 1; j = 0
    midlen = lenabc//2
    while i < lenabc:
        while i+j < lenabc and abc[j] == abc[i+j] and j < midlen:
            j += 1
        if not j:
            i += 1
            continue
        A[i] = j
        ans.add(j)
        k= 1
        while lenabc-i > k < j - A[k]:
            A[i+k] = A[k]
            k += 1
        i += k; j -= k

print(max(ans))


### FIXED CODE ###

n = str(input())
a = ["Sunny", "Cloudy", "Rainy"]
b = [1, 2, 0]
print(a[b[a.index(n)]])
import math
menu = []
for i in range(0, 5):
        menu.append(int(input()))
df = max([10 - i % 10 for i in menu if i % 10 != 0 ])
sum = 0
for i in menu:
        sum += ((i + 9) // 10) * 10
if(len(df) == 0):
        print(sum)
else:
        print(sum-df)

### FIXED CODE ###

import math
menu = []
for i in range(0, 5):
        menu.append(int(input()))
df = max([10 - i % 10 for i in menu if i % 10 != 0 ],default=0)
sum = 0
for i in menu:
        sum += ((i + 9) // 10) * 10
if(df == 0):
        print(sum)
else:
        print(sum-df)
from decimal import Decimal

numbers = input().split()
a = float(numbers[0])
b = Decimal(numbers[1])

c = a * b

print(int(c))


### FIXED CODE ###

from decimal import Decimal

numbers = input().split()
a = Decimal(numbers[0])
b = Decimal(numbers[1])

c = a * b

print(int(c))
x=int(input())
l=[]
for b in range (2,32):
    for i in range (1,10):
        if b**i <=x:
            l.apprnd b**i
print(max(l))


### FIXED CODE ###

x=int(input())
l=[]
for b in range (1,32):
    for i in range (2,10):
        if b**i <=x:
            l.append (b**i)
print(max(l))
from collections import Counter

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

charctor_count = Counter(s)
max_count = max(charctor_count.values())
for k, v in charctor_count.items():
  if v == max_count:
    ans.append( k)
print("\n".join(sorted(ans)))

### FIXED CODE ###

a, b ,c = map(int,input().split())
if  a == b and b == c and a == c:
  print("No")
elif a == b or b == c or a == c:
  print("Yes")
else:
  print("No")
while True:
    try:
        n = int(raw_input())
        count = 0
        for i in range(10):
           for j in range(10):
                for k in range(10):
                    for l in range(10):
                         if i+j+k+l == n:
                         count += 1
        print count
    except:
        break

### FIXED CODE ###

while True:
    try:
        n = int(raw_input())
        count = 0
        for i in range(10):
           for j in range(10):
                for k in range(10):
                    for l in range(10):
                         if i+j+k+l == n:
                             count += 1
        print count
    except:
        break
a, b = map(int, input().split)
print(a*b)

### FIXED CODE ###

a, b = map(int, input().split())
print(a*b)
s = input()
if s[0] == 'Y' and s[1] == "A" and s[2] == "K" and s[3] == "I":
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = input()
if len(s) >=4:
    if s[0] == 'Y' and s[1] == "A" and s[2] == "K" and s[3] == "I":
        print("Yes")
    else:
        print("No")
else:
    print("No")
import nmpy as np
n=input()
v=np.array(map(int, input().split()))
c=np.array(map(int, input().split()))
t=v-c
a=0
for i in range(n)
if t[i]>0 :
a+=t[i]
print(a)


### FIXED CODE ###

n=input()
v=list(map(int, input().split()))
c=list(map(int, input().split()))
t=[i-j if i-j>0 else 0 for i,j in zip(v,c)]
print(sum(t))
n, a, b = map(int, input().split())
ball= ("b"*a+"r"*b)*(n//(a+b)+1)
print(ball[0:n].count("b"))

### FIXED CODE ###

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

ans = n//(a+b)*a
ans += min(a, n%(a+b))

print(ans)
ans = int(input())
ans *= int(input())
print(ans)

### FIXED CODE ###

a, b = map(int,input().split())
print(a*b)
N = int(input())
a = list(map(int,input().split()))
count = 0
flag = 0
for i in range(N):
	for j in range(N):
		if a[i]%a[j] ==0 and i!= j:
			flag = 1
	if(flag == 0):
		count = count +1
	flag = 0
print(count)

### FIXED CODE ###

x = list(map(int,input().split()))
print(x.index(0)+1)
n = input()
digitSum = 0
for digit in n:
    digitSum += int(digit)

print("Yes" if int(n) % digitSum == 0 else "No")

### FIXED CODE ###

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

print(a*n if a*n < b else b)
N = int(input())
T,A = map(float,input().split())

num = 0
pre = A
for i in range(N):
    x = float(input())
    ave = T - x*0.006
    if abs(A-ave)<pre:
        pre = abs(A-ave)
        num = i
print(i)

### FIXED CODE ###

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

dis = []
for i in range(N):
    dis.append(abs(A-(T-H[i]*0.006)))
print(dis.index(min(dis))+1)
from collections import Counter
def main():
    s,k = input(), int(input())
    for i,v in enumerate(s):
        if v != '1':
            r = v
            break
    if k < i:
        print(1)
    else:
        print(r)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    s = input()
    k = int(input())
    r = '1'
    for i,v in enumerate(s):
        if v != '1':
            r = v
            break
    if i >= k:
        print(1)
    else:
        print(r)
    
if __name__ == "__main__":
    main()
X,K,D = map(int,input().split())

if K*D<=X:
    print(abs(X)-K*D)
    exit()
move_num_before = abs(X)//D
move_num_after = move_num_before+1
if (K - move_num_after)%2 == 0:
    print(abs(abs(X)-move_num_after*D))
    exit()
print(min(abs(X)-move_num_before*D))




### FIXED CODE ###

X,K,D = map(int,input().split())
if K*D<=abs(X):
    print(abs(X)-K*D)
    exit()

move_num_before = abs(X)//D
move_num_after = move_num_before+1
if (K - move_num_after)%2 == 0:
    print(abs(abs(X)-move_num_after*D))
    exit()
print(abs(X)-move_num_before*D)
w,h,x,y,r = map(int, input().split())

if x-r <= 0 or y-r <= 0 or x+r => w or y+r => h:
    print("No")
else:
    print("Yes")
    


### FIXED CODE ###

#
# 2d
#

def main():
    W, H, x, y, r = map(int, input().split())
    if x-r < 0 or x+r > W or y-r < 0 or y+r > H:
        print("No")
    else:
        print("Yes")


if __name__ == '__main__':
    main()
# coding: utf-8
# Here your code !
def mcg(a,b):
    while a%b !=0:
        x = a%b
        a = b
        b = x
    return x

num =sorted(list(map(int,input().split(" "))))
print(mcg(num[0],num[1]))

### FIXED CODE ###

# coding: utf-8
# Here your code !
def mcg(a,b):
    if a==b:
        return a
    else:
        
        while a%b !=0:
            x = a%b
            a = b
            b = x
        return x

num =sorted(list(map(int,input().split(" "))))
print(mcg(num[0],num[1]))
A,B=int(input().split())
print((A+B)%24)

### FIXED CODE ###

A,B=map(int,input().split())
print((A+B)%24)
import sys
from collections import deque
import itertools
from collections import deque
sys.setrecursionlimit(10 ** 9)
import heapq
import numpy as np

# map(int, sys.stdin.read().split())


def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    print(int(N*( N-1)/2))

    pass



if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from collections import deque
import itertools
from collections import deque
sys.setrecursionlimit(10 ** 9)

# map(int, sys.stdin.read().split())


def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    print(int(N*(N-1)//2))




if __name__ == "__main__":
    main()
[a,b,c,d]=[int(input()) for i in range(1,4+1)]
a1 = d // 500
b1 = d// 100
c1 = d// 50
coun = 0
for i in range(0,min([a+1,a1+1])):
    a = 500*i
    if a == d:
        coun = coun +1
        break
    for j in range(0,min([b+1,b1+1-5*i])):
        s = a + 100*j
        if s == d :
            coun = coun +1
            break
        for k in range(0,min([c+1,c1+1-10*i-2*j]):
            v = s + 50*k
            if v == d :
                coun = coun+1
                break
print(coun)

### FIXED CODE ###

[a,b,c,d]=[int(input()) for i in range(1,4+1)]
a1 = d // 500
b1 = d// 100
c1 = d// 50
coun = 0
for i in range(0,min([a+1,a1+1])):
    a = 500*i
    if a == d:
        coun = coun +1
        break
    for j in range(0,min([b+1,b1+1-5*i])):
        s = a + 100*j
        if s == d :
            coun = coun +1
            break
        for k in range(0,min([c+1,c1+1-10*i-2*j])):
            v = s + 50*k
            if v == d :
                coun = coun+1
                break
print(coun)
temp_in=input()
temp_in=temp_in.split(" ")
temp_in=list(map(int,temp_in))
a,b=temp_in
times=[0]*(10**5+1)
times_sum=[0]*(10**5+1)
for i in range(a):
    temp_in=input()
    temp_in=temp_in.split(" ")
    temp_in=list(map(int,temp_in))
    times[temp_in[0]]+=1
    times[temp_in[1]+1]-=1
for i in range(len(times_sum)-1):
    times_sum[i]+=times_sum[i-1]+times[i]
print(max(times_sum))



### FIXED CODE ###

import numpy as np

LIM = int(10e5)
time = [0] * (LIM + 1)
N, C = list(map(int, input().split(" ")))
schs = []
for _ in range(N):
    s, t, c = list(map(int, input().split(" ")))
    schs.append((s,t,c))
schs.sort(key = lambda x:x[0])

schs.sort(key = lambda x:x[2])

# print(schs)
for i,temp in enumerate(schs):
    s,t,c = temp

    s_p,t_p,c_p = schs[i-1]
    if i != 0 and c_p == c and t_p == s:
        time[t_p + 1] += 1
        time[t + 1] -= 1

    else:
        time[s] += 1
        time[t + 1] -= 1
# print(time[:100])
ruiseki = np.cumsum(time)

# print(ruiseki[:10])x
print(np.max(ruiseki[1:]))
def D():
    def dfs(x,d,s):
        for y in v[x]:
            if d[y]:
                s += f[y]
                ans[y] = s
                d[y] = 0
                dfs(y,d,s)
                s -= f[y]
    n,q = LI()
    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)
    f = [0]*n
    for i in range(q):
        p,x = LI()
        p -= 1
        f[p] += x
    ans = [0]*n
    d = [1]*n
    d[0] = 0
    ans[0] = f[0]
    s = f[0]
    dfs(0,d,s)
    print(*ans)
    return
 
#Solve
if __name__ == "__main__":
    D()

### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
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

#A
def A():
    a = I()
    s = input()
    if a >= 3200:
        print(s)
    else:
        print("red")
    return

#B
def B():
    n = I()
    a = LI()
    ans = 0
    for i in a:
        ans += 1/i
    print(1/ans)
    return

#C
def C():
    n = I()
    v = LI()
    q = []
    for i in v:
        heappush(q,i)
    while q:
        x = heappop(q)
        if not q:
            print(x)
            return
        y = heappop(q)
        heappush(q,(x+y)/2)
    return

#D
def D():
    def dfs(x,d,s):
        for y in v[x]:
            if d[y]:
                s += f[y]
                ans[y] = s
                d[y] = 0
                dfs(y,d,s)
                s -= f[y]
    n,q = LI()
    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)
    f = [0]*n
    for i in range(q):
        p,x = LI()
        p -= 1
        f[p] += x
    ans = [0]*n
    d = [1]*n
    d[0] = 0
    ans[0] = f[0]
    s = f[0]
    dfs(0,d,s)
    print(*ans)
    return

#E
def E():
    s = input()
    t = input()

    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    D()
n=int(input())
a=list(map(int,input().split()))
b=[0]*(n)
b[0]=abs(a[0])
c=b[0]
for i in range(n-1):
  b[i+1]=abs(a[i+1]-a[i])
  c+=b[i+1]
for i in range(n):
  if i==0:
    if 0<=a[i]<=a[i+1]:
      print(c)
    else:
      print(c-b[i]+abs(a[i+1]))
  if a[i-1]<=a[i]<=a[i+1]:
    print(c)
  else:
    print(c-b[i]-b[i-1]+abs(a[i-1]-a[i+1]))

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=[0]*(n+1)
b[0]=abs(a[0])
b[-1]=abs(a[-1])
c=b[0]+b[-1]
for i in range(n-1):
  b[i+1]=abs(a[i+1]-a[i])
  c+=b[i+1]
for i in range(n):
  if i==0:
    if 0<=a[i]<=a[i+1] or a[i+1]<=a[i]<=0:
      print(c)
    else:
      print(c-b[i]-b[i+1]+abs(a[i+1]))
    continue
  if i==n-1:
    if a[i-1]<=a[i]<=0 or 0<=a[i]<=a[i-1]:
      print(c)
    else:
      print(c-b[i]-b[i+1]+abs(a[i-1]))
    continue
  if a[i-1]<=a[i]<=a[i+1] or a[i+1]<=a[i]<=a[i-1]:
    print(c)
  else:
    print(c-b[i]-b[i+1]+abs(a[i-1]-a[i+1]))
N = int(input())
W = list(map(int, input().split()))
W = sorted(W)
m = 100000
for i in range(len(W)):
  m = min(m, abs(W[:i]-W[i:]))
print(m)

### FIXED CODE ###

N = int(input())
W = list(map(int, input().split()))
m = 100000
for i in range(len(W)):
  m = min(m, abs(sum(W[:i])-sum(W[i:])))
print(m)
N, M = map(int, input().split())
A = list(map(int, input().split())

s = sum(A)

print( max(N - A, -1) )

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
 
s = sum(A)
 
print( max(N - s, -1) )
N = int(input())
ls = map(int,input().split())
print(max(ls)-min(ls))

### FIXED CODE ###

N = int(input())
ls = list(map(int,input().split()))
print(max(ls)-min(ls))
a,b = [int x for in input().split()]
print( a * b,(a * b ) * 2)

### FIXED CODE ###

a,b=[int(x) for x in input().split()]
print(a*b,(a+b)*2)
# dp[i][t_sum]: i番目までの品物で時間がt_sumを超えないように選んだときの、満足度の総和の最大値
N, T = map(int, input().split())
items = sorted([tuple(map(int, input().split()))
                for i in range(N)], key=lambda x: x[0])

dp = [[0 for t_sum in range(T+3003)] for i in range(N)]

for i in range(N):
    for t_sum in range(T):

        # これは配るDP
        dp[i+1][t_sum+items[i][0]] = max(dp[i+1][t_sum+items[i][0]],
                                         dp[i][t_sum]+items[i][1])

        # i-1番目の品物を選ばない場合
        dp[i+1][t_sum] = max(dp[i+1][t_sum], dp[i][t_sum])


ans = 0
for t in range(T+3003):
    ans = max(ans, dp[N-1][t])
print(ans)


### FIXED CODE ###

# dp[i][t_sum]: i番目までの品物で時間がt_sumを超えないように選んだときの、満足度の総和の最大値
N, T = map(int, input().split())
items = [tuple(map(int, input().split())) for i in range(N)]

dp1 = [[0 for t_sum in range(T+1)] for i in range(N+2)]
dp2 = [[0 for t_sum in range(T+1)] for i in range(N+2)]

for i in range(N):
    for t_sum in range(T+1):
        if t_sum-items[i][0] >= 0:
            dp1[i+1][t_sum] = max(dp1[i+1][t_sum], dp1[i]
                                  [t_sum-items[i][0]]+items[i][1])
        dp1[i+1][t_sum] = max(dp1[i+1][t_sum], dp1[i][t_sum])

    for t_sum in range(T+1):
        if t_sum-items[N-1-i][0] >= 0:
            dp2[N-1-i][t_sum] = max(dp2[N-1-i][t_sum], dp2[N-i]
                                    [t_sum-items[N-1-i][0]]+items[N-1-i][1])
        dp2[N-1-i][t_sum] = max(dp2[N-1-i][t_sum], dp2[N-i][t_sum])


ans = 0
for i in range(N):
    for t in range(T):
        ans = max(ans, dp1[i][t]+dp2[i+1][T-1-t]+items[i][1])
print(ans)
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
    
print(len(set(a)))

### FIXED CODE ###

a,b=map(int,input().split())
if a*b%2==1:
  print("Odd")
else:
  print("Even")