Harryxun/stf_run huggingface dataset:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
n=int(0)
manzoku=int(0)
hantei = int(1)
if A[0] == hantei:
        manzoku += sum(C) + sum(B)
else:
        manzoku += sum(C) - C[A[0]-1] +sum(B)

print(manzoku)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
i = 1
manzoku = sum(B)
while N>i:
    if A[i]-A[i-1] == 1:
      j = A[i-1]
      manzoku += C[j-1]
    i += 1
print(manzoku)
n = int(input())
s = input()
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
b = ""
for i in s:
    j = (s.index(i) + n) % 26
    b += s[j]
print(b)

### FIXED CODE ###

n = int(input())
s = input()
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
b = ""
for i in s:
    j = (alpha.index(i) + n) % 26
    b += alpha[j]
print(b)
def lcs():
???x = raw_input()
  y = raw_input()
???x_len = len(x)
  y_len = len(y)
  z2 = [0 for i in range(y_len+1)]

???for j in range(x_len):
   z1 = z2 + []
    for k in range(y_len):
       if x[k] = y[k]:
          z2[k+1] = z2[k] + 1
       elif z2[j+1] < z2[j]:???
?????????    z2[j+1] = z2[j]

  return z2[-1]

num = input()
for l in range(num):
  print lcs()

### FIXED CODE ###

def lcs():
  x = raw_input()
  y = raw_input()
  x_len = len(x)
  y_len = len(y)
  z2 = [0 for i in range(y_len+1)]

  for i in range(x_len):
    z1 = z2 + []
    ele = x[i]
    for k in range(y_len):
      if ele == y[k]:
        z2[k+1] = z1[k] + 1
      elif z2[k+1] < z2[k]:
        z2[k+1] = z2[k]

  return z2[-1]

num = input()
for j in range(num):
  print lcs()
s = input()
count = 0

for i in range(len(s)//2):
  if s[i] != s[-1]:
    count += 1
    
return count

### FIXED CODE ###

s = input()
count = 0

for i in range(len(s)//2):
  if s[i] != s[-1-i]:
    count += 1
    
print(count)
from collections import deque

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
H, W = list(map(int, input().split()))
field = [input() for _ in range(H)]

dist = [[float('inf')] * W for _ in range(W)]
que = deque()
que.append((0, 0))
dist[0][0] = 0

while len(que) > 0:
  y, x = que.popleft()
  if y == H - 1 and x == W - 1:
    break
  for i in range(4):
    ny, nx = y + dy[i], x + dx[i]
    if 0<=nx<W and 0<=ny<H and field[ny][nx]=='.' and dist[ny][nx]==float('inf'):
      dist[ny][nx] = dist[y][x] + 1
      que.append((ny, nx))
    
count = sum([f.count('#') for f in field])
      
if dist[H - 1][W - 1] != -1:
  print(H * W - count - dist[H - 1][W - 1] - 1)
else:
  print(-1)

### FIXED CODE ###

from collections import deque

R,C = list(map(int,input().split()))
Sx,Sy = 0,0
Gx,Gy = R-1,C-1
Mize = [input() for _ in range(R)]
dd = [[1, 0], [-1, 0], [0, 1], [0, -1]]

def bfs():
    d = [[float('inf')] * C for i in range(R)]
    q = deque([])
    d[Sx][Sy] = 0
    q.append((Sx,Sy))
    while(len(q) != 0):
        x,y = q.popleft()
        if x == Gx and y == Gy:
            break
        for dx,dy in dd:
            
            if -1<x+dx<R and -1<y+dy<C and Mize[x+dx][y+dy]=='.' and d[x+dx][y+dy] == float('inf'):
                q.append([x+dx,y+dy])
                d[x+dx][y+dy] = d[x][y] + 1
    return d[Gx][Gy]

white = sum([m.count('#') for m in Mize])
need = bfs()
if need == float('inf'):
    print(-1)
else:
    print(R*C-white-need-1)
python3 make.py abc 999 --num 6

S, W = [int(x) for x in input().split()]

if S > W:
  print('safe')
else:
  print('unsafe')

### FIXED CODE ###

s, w = list(map(int, input().split()))

if w >= s:
    print("unsafe")
else:
    print("safe")
M = 10**6
N = int(input())
A = list(map(int, input().split()))


def solve():
    memo = [0] * M
    for a in A:
        i = 1
        while i*a < M:
            memo[i*a] += 1
            i += 1

    count = 0
    for a in A:
        if memo[a] == 1:
            count += 1

    return count

if __name__ == "__main__":
    print(solve())


### FIXED CODE ###

M = 10**6
N = int(input())
A = list(map(int, input().split()))


def solve():
    amax = max(A)+1
    memo = [0] * amax
    for a in A:
        i = 1
        while i*a < amax:
            memo[i*a] += 1
            i += 1

    count = 0
    for a in A:
        if memo[a] == 1:
            count += 1

    return count

if __name__ == "__main__":
    print(solve())
X, K, D = map(int, input().split())
X_a = abs(X)
if X_a - K * D > D:
    print(X_a - K * D)
else:
    K -= X_a // D
    X_a = X_a % D
    while X_a >= D:
        X_a -= D
        K -= 1
    if  K % 2 == 0:
        print(X_a)
    else:
        print(abs(X_a-D))

### FIXED CODE ###

S = input()
if S == 'SSS':
    print(0)
elif S == 'RRR':
    print(3)
elif S == 'RRS' or S == 'SRR':
    print(2)
else:
    print(1)
aa

### FIXED CODE ###

l,r,d=map(int,input().split())
c=0

for i in range(l,r+1):
    if i%d==0:
        c+=1
print(c)
N=int(input())


depth=[-1]*N
parent=[-1]*N
childs=[[] for i in range(N)]

depth[0]=0
def calc_depth(n):
    for child in childs[n]:
        depth[child]=depth[n]+1
        calc_depth(child)

def calc_height(n):
    if childs[n]==[]:
        return 0 
    childs_height=[]
    for child in childs[n]:
        childs_height.append(calc_height(child))
    childs_height.sort(reverse=True)
    heightlist=[childs_height[i]+i for i in range(len(childs_height))]
    return max(heightlist)+1

for i in range (1,N):
    a=int(input())-1
    childs[a].append(i)

print(calc_height(0))


### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)

N=int(input())


depth=[-1]*N
parent=[-1]*N
childs=[[] for i in range(N)]

depth[0]=0
def calc_depth(n):
    for child in childs[n]:
        depth[child]=depth[n]+1
        calc_depth(child)

def calc_height(n):
    if childs[n]==[]:
        return 0 
    childs_height=[]
    for child in childs[n]:
        childs_height.append(calc_height(child))
    childs_height.sort(reverse=True)
    heightlist=[childs_height[i]+i for i in range(len(childs_height))]
    return max(heightlist)+1

for i in range (1,N):
    a=int(input())-1
    childs[a].append(i)

print(calc_height(0))
34I=lambda:list(map(int,input().split()))
mod=10**9+7
n,=I()
l=I()
pre=l.copy()
suf=l.copy()
for i in range(n-2,-1,-1):
	suf[i]+=suf[i+1]
ans=0
#print(suf)
for i in range(n-1):
	ans+=(l[i]*suf[i+1])
	ans%=mod
print(ans)


### FIXED CODE ###

I=lambda:list(map(int,input().split()))
mod=10**9+7
n,=I()
l=I()
pre=l.copy()
suf=l.copy()
for i in range(n-2,-1,-1):
	suf[i]+=suf[i+1]
ans=0
#print(suf)
for i in range(n-1):
	ans+=(l[i]*suf[i+1])
	ans%=mod
print(ans)
n,q = map(int, input().split())
ans = [0]*n
ki = [ [] for _ in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a -=1
    b -=1
    ki[a].append(b)

def ki_add(p,x):
    ans[p] += x
    for i in ki[p]:
        ki_add(i,x)

for i in range(q):
    p,x = map(int, input().split())
    p -=1
    ki_add(p,x)
print(*ans)

### FIXED CODE ###

import heapq

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

node = [0]*N
edge = [[] for _ in range(N)]
color = [0]*N

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

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

stack = [0]
while stack:
    s = stack.pop()
    color[s] = 1
    for t in edge[s]:
        if color[t]==0:
            stack.append(t)
            node[t] += node[s]
    color[s]=2

print(*node)
a,b,c = map(int, input().split())

print [i for i in range(a,b+1) if c % i == 0]

### FIXED CODE ###

a,b,c = map(int,input().split())
count = 0
for i in range(a,b+1):
    d = c % i
    if d == 0:
        count += 1
print (count)
x,s=map(int(input().split()))
n=x+1
a=0
for i in range(n):
    for j in range(n):
        if 0<=s-(i+j)<=x:
            a+=1
print(a)

### FIXED CODE ###

x,s=map(int,input().split())
n=x+1
a=0
for i in range(n):
    for j in range(n):
        if 0<=(s-(i+j))<=x:
            a+=1
print(a)
import numpy as np


def move_and_compute_cost(field, h, d, l, r):
    if l == r:
        return 0

    ff = field.ravel()
    # create l to r route
    route = np.arange(l, r + 1, d)

    indices = np.arange(len(ff))
    cond = np.isin(ff, route)

    indices = indices[cond]
    ff = ff[cond]
    v = indices[ff.argsort()]

    points = np.vstack([v // h, v % h]).T
    next_points = np.vstack([points[1:], points[-1]])

    cost = np.abs(points - next_points).sum()
    return cost


if __name__ == '__main__':
    h, w, d = [int(v) for v in input().split()]

    # read field
    field = np.empty((h, w), dtype=int)
    for i in range(h):
        line = [int(v) for v in input().split()]
        field[i, :] = line

    ls, rs = [], []
    q = int(input())
    for i in range(q):
        line = [int(v) for v in input().split()]
        ls.append(line[0])
        rs.append(line[1])

    costs = [move_and_compute_cost(field, h, d, l, r) for l, r in zip(ls, rs)]
    for c in costs:
        print(c)


### FIXED CODE ###

if __name__ == '__main__':
    h, w, d = map(int, input().split())
    f = [list(map(int, input().split())) for _ in range(h)]

    # f => (y, x) mapping
    c_map = [0] * (h * w)
    for y in range(h):
        for x in range(w):
            c_map[f[y][x] - 1] = (y, x)

    # cost accumulation
    d_map = [0] * (h * w)
    for i in range(d, h * w):
        y, x = c_map[i]
        y2, x2 = c_map[i - d]
        d_map[i] = d_map[i - d] + abs(y2 - y) + abs(x2 - x)

    results = []
    q = int(input())
    for _ in range(q):
        l, r = map(int, input().split())
        results.append(d_map[r - 1] - d_map[l - 1])

    print("\n".join(map(str, results)))
a, b, c, d = map(int, raw_input().split())
if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a, b, c, d = map(int, input().split())
if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
    print('Yes')
else:
    print('No')
def gcd(a, b):
  if b > a:
    a, b = b, a
    while b != 0:
      a, b = b, a % b
    return a

n = int(input())
ans = n * 2 // gcd(n, 2)
print(ans)


### FIXED CODE ###

def gcd(a, b):
  if b > a:
    a, b = b, a
  while b != 0:
    a, b = b, a % b
  return a
 
n = int(input())
ans = n * 2 // gcd(n, 2)
print(ans)
N = int(input())
K = len(str(N))
MS = int(str(N)[0])
ML = int(str(N)[-1])
res = 0

for i in range(1, N+1):
    AS = int(str(i)[0])
    AL = int(str(i)[-1])

    if AL == 0:
        continue

    for k in range(1, K+1):
        if k == 1:
            if AS == AL and AS <= N:
                res += 1
            continue
        if k == 2:
            if int(str(AL) + str(AS)) <= N:
                res += 1
            continue
        if k < K:
            res += 10 ** (k - 2)
            continue
        if k == K:
            if AL > MS:
                continue
            if AL < MS:
                res += 10 ** (k - 2)
                continue
            if AL == MS:
                if AS < ML:
                    res += int(str(N)[1:] + 9) // 10
                    continue
                else:
                    if int(str(N)[1:]) >= AS:
                        res += (int(str(N)[1:]) + 9) // 10
                    continue


print(res)


### FIXED CODE ###

N = int(input())
K = len(str(N))
MS = int(str(N)[0])
ML = int(str(N)[-1])
res = 0

for i in range(1, N+1):
    AS = int(str(i)[0])
    AL = int(str(i)[-1])

    if AL == 0:
        continue

    for k in range(1, K+1):
        if k == 1:
            if AS == AL and AS <= N:
                res += 1
            continue
        if k == 2:
            if int(str(AL) + str(AS)) <= N:
                res += 1
            continue
        if k < K:
            res += 10 ** (k - 2)
            continue
        if k == K:
            if AL > MS:
                continue
            if AL < MS:
                res += 10 ** (k - 2)
                continue
            if AL == MS:
                if AS <= ML:
                    res += (int(str(N)[1:])+9) // 10
                    continue
                else:
                    res += (int(str(N)[1:])) // 10
                    continue


print(res)
# coding:utf-8

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

ind = n.index(min(n))
POT = n.pop(ind)

for i in range(0, len(n)):
    ind = n.index(min(n))
    POT = (POT + n.pop(ind)) / 2

print(POT)

### FIXED CODE ###

#coding:utf-8

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

if a >= 3200:
    print(s)
else:
    print("red")
n = int(input()) 
a = list(map(int,input().split())) 
a = sorted(a)
mod = 10**9+7
if n%2==0:
    k = 0
else:
    k = 1
if k==0:
    for i in range(1,n,2):
        if a[i]!=i or a[i+1]!=i:
            print(0)
    else:
        print(2**(n//2)%mod)
else:
    if a[0]!=0:
        print(0)
    else:
        for i in range(2,n,2):
            if a[i-1]!=i or a[i]!=i:
                print(0)
        else:
            print(2**(n//2)%mod)

### FIXED CODE ###

n = int(input()) 
a = list(map(int,input().split())) 
a = sorted(a)
mod = 10**9+7
if n%2==0:
    k = 0
else:
    k = 1
if k==0:
    for i in range(1,n,2):
        if a[i]!=i or a[i-1]!=i:
            print(0)
            exit()
    else:
        print(2**(n//2)%mod)
else:
    if a[0]!=0:
        print(0)
        exit()
    else:
        for i in range(2,n,2):
            if a[i-1]!=i or a[i]!=i:
                print(0)
                exit()
        else:
            print(2**(n//2)%mod)
n=int(input())
m=int(n**0.5)
li=[0]*(10**4)
c=0
for i in range(1,m):
  for j in range(1,m):
    for k in range(1,m):
      li[i*i+j*j+k*k+i*j+k*j+k*i-1]+=1
for i in range(n):
  print(li[i])

### FIXED CODE ###

n=int(input())
m=int(n**0.5)
li=[0]*(10**4)
c=0
for i in range(1,m):
  for j in range(1,m):
    for k in range(1,m):
      if i*i+j*j+k*k+i*j+k*j+k*i<=n:
        li[i*i+j*j+k*k+i*j+k*j+k*i-1]+=1
for i in range(n):
  print(li[i])
H,W = map(int,input().split())
arr = []

for i in range(H):
  S = list(input())
  arr.append(S)
  
ck = 0
for i in range(H):
  for j in range(W):
    if arr[i][j] == "#":
      if i != 0:
        a = arr[i-1][j]
      else:
        a = "."
      if i != H-1:
        b = arr[i+1][j]
      else:
        b = "."
      if j != 0:
        c = arr[i][j-1]
      else:
        c = "."
      if j != W-1:
        d = arr[i][j+1]
      else:
        d = "."
    if a == "." and b == "." and c == "." and d == ".":
      ck = 1
      
if ck == 1:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

H,W = map(int,input().split())
arr = []

for i in range(H):
  S = list(input())
  arr.append(S)
  
ck = 0
for i in range(H):
  for j in range(W):
    if arr[i][j] == "#":
      if i != 0:
        a = arr[i-1][j]
      else:
        a = "."
      if i != H-1:
        b = arr[i+1][j]
      else:
        b = "."
      if j != 0:
        c = arr[i][j-1]
      else:
        c = "."
      if j != W-1:
        d = arr[i][j+1]
      else:
        d = "."

      if a == "." and b == "." and c == "." and d == ".":
        ck = 1
      
if ck == 1:
  print("No")
else:
  print("Yes")
n, q = map(int, input().split())
s = list(input())

for i in range(q):
    count = 0
    l, r = map(int, input().split())
    # ss = s[l:r]
    for j in range(l-1,r):
        if s[j] == 'A':
            if j+1 < r:
                if s[j+1] == 'C':
                    count += 1
                j += 1
    print(count)

### FIXED CODE ###


b = input()
if b == 'A':
    print('T')
elif b == 'T':
    print('A')
elif b == 'C':
    print('G')
else:
    print('C')
N=int(input())
A=list(map(int,input().split()))

ans=sum(A)
s=N+1
j=s

if A==sorted(A):
    print(0)
    exit()

for i in range(N//2):
    x=max(A[:s])
    s=A.index(x)
    A[s:j]=[x]*len(A[s:j])
    j=s
    if  A==sorted(A):
        break

print(sum(A)-ans)

### FIXED CODE ###

N,X,T=map(int,input().split())
if N%X==0:
    ans=T*(N//X)
else:
    ans=T*((N//X)+1)
print(ans)
import math
N, K = map(int, input().split())
x = list(map(int, input().split()))
for i in range(N):
  if x[i] == 0:
    p, m = i, i+1
    break
  elif x[i] > 0:
    p, m = i, i
    break
    
pls = x[p:]
mns = x[:m]
ans = math.inf

for i in range(len(pls)):
  if i < K-1:
    if pls[0] == 0:
      n = K - i
    else:
      n = K - i - 1
    if len(mns) >= n:
      tmp = 2*abs(mns[-n]) + pls[i]
      ans = min(ans, tmp)
  if i == K-1:
    ans = min(ans, pls[i])
    break
    
for i in range(len(mns)):
  m = len(mns)-i
  if m < K:
    if pls[0] == 0:
      n = K - m
    else:
      n = K - m - 1
    if len(pls) > n:
      tmp = 2*pls[n] + abs(mns[-m])
      ans = min(ans, tmp)
  if m == K:
    ans = min(ans, abs(mns[i]))
    
print(ans)

### FIXED CODE ###

import math
N, K = map(int, input().split())
x = list(map(int, input().split()))
for i in range(N):
  if x[i] == 0:
    p, m = i, i+1
    break
  elif x[i] > 0:
    p, m = i, i
    break
    
if (x[0]<0) and (x[-1]>0):
  pls = x[p:]
  mns = x[:m]
  ans = math.inf

  for i in range(len(pls)):
    if i < K-1:
      if pls[0] == 0:
        n = K - i
      else:
        n = K - i - 1
      if len(mns) >= n:
        tmp = 2*abs(mns[-n]) + pls[i]
        ans = min(ans, tmp)
    if i == K-1:
      ans = min(ans, pls[i])
      break
    
  for i in range(len(mns)):
    m = len(mns)-i
    if m < K:
      if pls[0] == 0:
        n = K - m
      else:
        n = K - m - 1
      if len(pls) > n:
        tmp = 2*pls[n] + abs(mns[-m])
        ans = min(ans, tmp)
    if m == K:
      ans = min(ans, abs(mns[i]))
    
elif x[0] >= 0:
  ans = x[K-1]
  
else:
  ans = abs(x[-K])
  
print(ans)
def solve(s,p):
    if s[0]!='[':
        return[p//1000,p//100%10,p//10%10,p%10][ord(s[0])-ord('a')]
    i=3
    while s.count('[',2,i)!=s.count(']',2,i):
        i+=1
    j=i+1
    while s.count('[',i,j)!=s.count(']',i,j):
        j+=1
    l=solve(s[2:i])
    r=solve(s[i:j])
    if s[1]=='+':
        return l|r
    elif s[1]=='*':
        return l&r
    else:
        return l^r
while True:
    s=input()
    if s=='.':break
    p=int(input())
    a=solve(s,p)
    c=0
    for i in range(10000):
        if solve(s,i)==a:
            c+=1
    print(a,c)


### FIXED CODE ###

def solve(s,p):
    if s[0]!='[':
        return[p//1000,p//100%10,p//10%10,p%10][ord(s[0])-ord('a')]
    i=3
    cs=s[2]=='['
    ce=0
    while cs!=ce:
        if s[i]=='[':
            cs+=1
        elif s[i]==']':
            ce+=1
        i+=1
    j=i+1
    cs=s[i]=='['
    ce=0
    while cs!=ce:
        if s[j]=='[':
            cs+=1
        elif s[j]==']':
            ce+=1
        j+=1
    l=solve(s[2:i],p)
    r=solve(s[i:j],p)
    if s[1]=='+':
        return l|r
    elif s[1]=='*':
        return l&r
    else:
        return l^r
while True:
    s=input()
    if s=='.':break
    p=int(input())
    a=solve(s,p)
    c=0
    for i in range(10000):
        if solve(s,i)==a:
            c+=1
    print(a,c)
A, B = list(map(int, input().split()))

print(A * B // 1)

### FIXED CODE ###

A, B = input().split()

print(int(A) * round(float(B) * 100) // 100)
import math
while True:
    try:
        a, b = map(int, input().split())
    except:
        break
    gcd = math.gcd(a, b)
    lcm = (a*b) // gcd
    print(gcd, lcm)

### FIXED CODE ###

def GCD(m, n):
    while n:
        m, n = n, m % n
    return m

while True:
    try:
        a, b = map(int, input().split())
    except:
        break
    if a < b:
        a, b = b, a
    gcd = GCD(a, b)
    lcm = (a * b) // gcd
    print(gcd, lcm)
import sys
import numpy as np
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
n, m = [int(i) for i in sys.stdin.readline().split()]
INF = 10**9
graph = np.ones(shape=(n,n)) * INF
for i in range(m):
    l, r, c = [int(i) for i in sys.stdin.readline().split()]
    l -= 1
    r -= 1
    graph[l][:r+1] = np.where(graph[l][:r+1] < c, graph[l][:r+1], np.ones_like(graph[l][:r+1]) * c)
graph = np.where(graph == INF, np.zeros_like(graph), graph)
graph = csr_matrix(graph)
res = dijkstra(graph, indices=[0])
print(int(res[0][-1]) if res[0][-1] < INF else -1)


### FIXED CODE ###

import sys
import heapq
sys.setrecursionlimit(10**7)
n, m = [int(i) for i in sys.stdin.readline().split()]
INF = 10**9
graph = {j:[(j-1, 1e-10)] if j > 0 else [] for j in range(n)}
for i in range(m):
    l, r, c = [int(i) for i in sys.stdin.readline().split()]
    l -= 1
    r -= 1
    graph[l].append((r, c))
    graph[r].append((l, c))
que = [(0,0)]
already = set()
res = [-1 for i in range(n)]
while len(que) > 0:
    cost, cand = heapq.heappop(que)
    if cand in already:
        continue
    res[cand] = cost
    already.add(cand)
    for _next, _next_cost in graph[cand]:
        if _next in already:
            continue
        heapq.heappush(que, (cost + _next_cost, _next))
print(int(res[-1]))
A, B, C = map(int, input().split())
print('YES' if a <= c <= b else 'NO')

### FIXED CODE ###

A, B, C = map(int, input().split())
print('Yes' if A <= C <= B else 'No')
n, q = map(int, input().split())
g = [[] for _ in range(n)]
score = [0]*n
visited = [False]*n

for i in range(n-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  g[a].append(b)
  g[b].append(a)
  
for j in range(q):
  p, x = map(int, input().split())
  p -= 1
  score[p] += x

def dfs(i):
  visited[i] = True
  for j in g[i]:
    if visited[j] == True:
      continue
    score[j] += score[i]
    dfs(j)
dfs(0)
print(*score)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
n,q = map(int,input().split())

g = [[] for _ in range(n)]
c = [0] * n
visited = [False] * n

#根に近い順に累積和
def dfs(i):
    visited[i] = True
    for j in g[i]:
        if visited[j] == True:
            continue
        c[j]+=c[i]
        dfs(j)

for i in range(n - 1):
    a,b = map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)

for i in range(q):
    p,x = map(int,input().split())
    c[p - 1]+=x

dfs(0)
print(*c)
def prod(li, MOD):
    ret = 1
    for a in li:
        ret *= a
        ret %= MOD
    return ret

N, K = map(int, input().split())
MOD = 1_000_000_007
aaa = list(map(int, input().split()))
if N == K:
    print(prod(aaa, MOD))
    exit()
aaa.sort(key=lambda x : abs(x))
if sum(a < 0 for a in aaa[-K:]) % 2 == 0:
    print(prod(aaa[-K:], MOD))
else:
    if all(a <= 0 for a in aaa):
        bbb = aaa[:K]
    else:
        try:
            x1, y1 = min([a for a in aaa[-K:] if a > 0]), min([a for a in aaa[:-K] if a < 0])
        except:
            x1, y1 = 10**10, 1
        try:
            x2, y2 = max([a for a in aaa[-K:] if a < 0]), max([a for a in aaa[:-K] if a >= 0])
        except:
            x2, y2 = 10**10, 1
        bbb = aaa[-K:]
        if abs(x2 * y1) > abs(x1 * y2):
            bbb.remove(x1)
            bbb.append(y1)
        else:
            bbb.remove(x2)
            bbb.append(y2)
    print(prod(bbb, MOD))


### FIXED CODE ###

def prod(li, MOD):
    ret = 1
    for a in li:
        ret *= a
        ret %= MOD
    return ret

N, K = map(int, input().split())
MOD = 1_000_000_007
aaa = list(map(int, input().split()))
if N == K:
    print(prod(aaa, MOD))
    exit()
aaa.sort(key=lambda x : abs(x))
if sum(a < 0 for a in aaa[-K:]) % 2 == 0:
    print(prod(aaa[-K:], MOD))
else:
    if all(a <= 0 for a in aaa):
        bbb = aaa[:K]
    else:
        try:
            x1, y1 = min([a for a in aaa[-K:] if a > 0]), min([a for a in aaa[:-K] if a < 0])
        except:
            x1, y1 = 1, 0
        try:
            x2, y2 = max([a for a in aaa[-K:] if a < 0]), max([a for a in aaa[:-K] if a >= 0])
        except:
            x2, y2 = 1, 0
        bbb = aaa[-K:]
        if abs(x2 * y1) > abs(x1 * y2):
            bbb.remove(x1)
            bbb.append(y1)
        else:
            bbb.remove(x2)
            bbb.append(y2)
    print(prod(bbb, MOD))
N = int(input())
A = list(map(int,input().split()))

k = 1000000007

sm = sum(A)

ans = 0
for s in range(len(A)-1):
    #ans += A[s]*sum(A[s+1:])
    sm -= A[s]
    ans += A[s]*sm

if ans>1000000007:
    print(ans%k)
else:
    print(ans)


### FIXED CODE ###

D, T, S = map(int, input().split())

if T*S >= D:
    print("Yes")
else:
    print ("No")