Harryxun/stf_run huggingface dataset:
N = int(input())
A = list(map(int, input().split()))
 
# Aに0が含まれていたら、積も0とする
# Aに0が含まれていなければ、順に積を取り、10^18を超えたら終了する
ans = 0
if 0 not in A:
  ans = 1
  for a in A:
    ans *= a
    if ans > 10**18:
      ans = '-1'
      break
 
print(ans)

### FIXED CODE ###

a,b=map(int,input().split())
print(a*b)
def main():
  N = int(input())
  A = tuple(map(int, input().split()))
  r = 1
  cnt = 1
  T = A[0]
  t = 1
  flg = False
  for l in range(N):
    while True:
      if T ^ A[r] == T + A[r]:
        t += 1
        cnt += t
        T += A[r]
        r += 1
      else:
        T -= A[l]
        t -= 1
        break
      if r == N:
        flg = True
        break
    if flg:
      break
  print(cnt)  

main()

### FIXED CODE ###

N = int(input())
A = tuple(map(int, input().split()))
if len(A) == 1:
  print(1)
  exit()
r = 1
cnt = 1
T = A[0]
t = 1
flg = False
for l in range(N):
  while True:
    if T ^ A[r] == T + A[r]:
      t += 1
      cnt += t
      T += A[r]
      r += 1
    else:
      T -= A[l]
      t -= 1
      break
    if r == N:
      flg = True
      break
  if flg:
    break
print(cnt)
s=int(input())
print(s.count("1")

### FIXED CODE ###

s=input()
print(s.count("1"))
def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

k = int(arr_data[0][0])
a = int(arr_data[0][1])
b = int(arr_data[0][2])

cnt = (k-a) // (a-b)

#print(cnt)

if a-b<0 and k>a:

    print(-1)

else:
    if ((k-a) % (a-b) == 0):

        print(1 + cnt * 2)

    else:

        print(1 + (cnt + 1) * 2)

    


### FIXED CODE ###

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

k = int(arr_data[0][0])
a = int(arr_data[0][1])
b = int(arr_data[0][2])

cnt = a - b

rate = a

if rate >= k:
    
    print(1)
    
elif cnt==0:

    print(-1)
else:
    
    if (k-rate) % cnt == 0:
        
        num = (k-rate) // cnt 
        
        print(1+ num*2)
    
    else:
        
        num = ((k-rate) // cnt) + 1
        
        if num>=1 :
        
            print(num*2+1)
        
        else:
            
            print(-1)
Dice1 = list(input().split())
Dice2 = list(input().split())
a = list
b = 1

for q in range(3):
    if Dice1[q] == Dice2[q]:
        a[q] = 1
    else :
        a[q] = -1

for q in range(3):
    b = b*a[q]

if b == 1 :
    print("Yes")
elif b == -1 :
    print("No")

### FIXED CODE ###

class Dice:
    same_dice_index = ('123456', '135246', '142536', '154326',
                       '214365', '231645', '246135', '263415',
                       '312564', '326154', '351624', '365214',
                       '415263', '421653', '456123', '462513',
                       '513462', '536142', '541632', '564312',
                       '624351', '632541', '645231', '653421')
 
    def __init__(self, num_list):
        self.faces = num_list
 
    def is_same(self, dice):
        for i in Dice.same_dice_index:
            example_faces = []
            for j in i:
                example_faces.append(self.faces[int(j) - 1])
            if example_faces == dice.faces:
                return 'Yes'
        return 'No'
 
num_list1 = list(map(int, input().split()))
num_list2 = list(map(int, input().split()))
 
dice1 = Dice(num_list1)
dice2 = Dice(num_list2)
 
ans = dice1.is_same(dice2)
 
print(ans)
from collections import Counter

N = int(input())
X = input()

x1 = 0
for i in X:
    if i == '1':
        x1 += 1

for i in range(N):
    if X[i] == '1':
        tmp = - (1<<(N-i-1))
        tmp2 = -1
    else:
        tmp = (1<<(N-i-1))
        tmp2 = 1
    
    n = int(X, 2) + tmp
    n %= x1 + tmp2
    cnt = 1
    while n != 0:
        c = 0
        for j in bin(n):
            c += j=='1'
        n %= c
        cnt += 1
    print(cnt)

### FIXED CODE ###

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


def pop_cnt(n):
    return bin(n).count('1')


def f(n):
    cnt = 0
    while n != 0:
        n = n % pop_cnt(n)
        cnt += 1
    return cnt
 
n = int(readline())
x2 = list(readline().decode().rstrip())
x10 = int(''.join(x2), 2)

c = x2.count('1')
mod1 = x10 % (c + 1)
mod2 = x10 % (c - 1) if c-1 != 0 else 0

for i in range(n):
    ans = 0
    if x2[i] == '0':
        t = (mod1 + pow(2, n-i-1, c+1)) % (c+1)
    else:
        if c-1 != 0:
            t = (mod2 - pow(2, n-i-1, c-1)) % (c-1)
        else:
            print(0)
            continue
    
    ans = f(t) + 1
    print(ans)
n = int(input())
arr = list(map(int, input().split()))

ans,flag = 1,0
for elem in arr:
  ans = ans*elem
  if ans>1e18:
  	flag=1
    break
    
if flag==1: print(-1)
else: print(ans)

### FIXED CODE ###

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

ans,flag = 1,0
for elem in sorted(arr):
    ans = ans*elem
    if ans>1e18:
        flag = 1
        break
    if ans==0: break
    
if flag==1: print(-1)
else: print(ans)
S=input()
n=len(S)
ans="Good"
for i in (1,n):
  if S[i]==S[i-1]:
    ans="Bad"
    break
print(ans)

### FIXED CODE ###

S=input()
n=len(S)
ans="Good"
for i in range(1,n):
  if S[i]==S[i-1]:
    ans="Bad"
    break
print(ans)
W,H,x,y,r = map(int,raw_input())
if x + r <= W and y + r <= H:
  print "Yes"
else:
  print "No"

### FIXED CODE ###

W,H,x,y,r = map(int,raw_input().split(" "))
if x + r <= W and y + r <= H and x - r >= 0 and y - r >= 0:
  print "Yes"
else:
  print "No"
def inpl():
    return list(map(int, input().split()))


S = inpu()
print(min(S.count('0'), S.count('1')))

### FIXED CODE ###

def inpl():
    return list(map(int, input().split()))


S = input()
print(min(S.count('0'), S.count('1')) * 2)
from collections import Counter

N = int(input())
#s = [0,]*(N-1)
s = []
for i in range(N-1):
    #s[i] = int(input())
    s.append(int(input()))

ct = Counter(s)

for i in range(N):
    print(ct[i+1])


### FIXED CODE ###

import collections

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

ct = collections.Counter(s)

for i in range(N):
    print(ct[i+1])
ab = [int(input()) for _ in range(2)]
if a[0] > a[1]: print('GREATER')
elif a[0] < a[1]: print('LESS')
else: print('EQUAL')

### FIXED CODE ###

a = [int(input()) for _ in range(2)]
if a[0] > a[1]: print('GREATER')
elif a[0] < a[1]: print('LESS')
else: print('EQUAL')
a = input()
a = 'ACL' * a
print(a)

### FIXED CODE ###

word = 'ACL'
a = int(input())
word = word *a
print(word)
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
n=int(input())
b = [int(input()) for i in range(n)]
f=False
for i in range(3):
    for j in range(n):
        if l1[i]==b[j]:
            l1[i]=0
        elif l2[i]==b[j]:
            l2[i]=0
        elif l3[i]==b[j]:
            l3[i]=0
for i in range(3):
    if l1[i]==l2[i] and l2[i]==l3[i] and l1[i]==l3[i]:
        f=True
if l1[0]==l1[1] and l1[1]==l[2] and l1[0]==l1[2]:
    f=True
elif l2[0]==l2[1] and l2[1]==l2[2] and l2[0]==l2[2]:
    f=True
elif l3[0]==l3[1] and l3[1]==l3[2] and l3[0]==l3[2]:
    f=True
elif l1[0]==0 and l2[1]==0 and l3[2]==0:
    f=True
elif l3[0]==0 and l1[2]==0 and l2[1]==0:
    f=True
    
if f==True:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
n=int(input())
b = [int(input()) for i in range(n)]
f=False
for i in range(3):
    for j in range(n):
        if l1[i]==b[j]:
            l1[i]=0
        elif l2[i]==b[j]:
            l2[i]=0
        elif l3[i]==b[j]:
            l3[i]=0
for i in range(3):
    if l1[i]==l2[i] and l2[i]==l3[i] and l1[i]==l3[i]:
        f=True
if l1[0]==l1[1] and l1[1]==l1[2] and l1[0]==l1[2]:
    f=True
elif l2[0]==l2[1] and l2[1]==l2[2] and l2[0]==l2[2]:
    f=True
elif l3[0]==l3[1] and l3[1]==l3[2] and l3[0]==l3[2]:
    f=True
elif l1[0]==0 and l2[1]==0 and l3[2]==0:
    f=True
elif l3[0]==0 and l1[2]==0 and l2[1]==0:
    f=True
    
if f==True:
    print('Yes')
else:
    print('No')
a =map(int, input().split())
b = [0 for i in range(2)]
b[0] = a[0]*a[1]
b[1] = (a[0]+a[1])*2
print(*b)


### FIXED CODE ###

a,b = [int(x) for x in input().split()]
print(a*b,2*(a+b))
class unionFind():
	def __init__(self,n):
		self.tree=[-1]*n
	def find(self, x):
        if self.tree[x] < 0:
            return x
        else:
            self.tree[x] = self.find(self.id[x])
            return self.tree[x]
	def union(self,x,y):
		xr=self.find(x)
		yr=self.find(y)
		if xr!=yr:
			if self.tree[xr]<self.tree[yr]:
				self.tree[yr]=xr
			elif self.tree[xr]>self.tree[yr]:
				self.tree[xr]=yr
			else:
				self.tree[xr]-=1
				self.tree[yr]=xr
			return True
		
		return False
def main():
	ans=0
	n,m=map(int,input().split())
	a=unionFind(n)
	li=[x-1 for x in list(map(int,input().split()))]
	for _ in range(m):
		x,y=map(int,input().split())
		a.union(x-1,y-1)
	for x in range(n):
		ans += a.find(x)==a.find(li[x])
	return ans
print(main())



### FIXED CODE ###

from collections import defaultdict
import sys
sdin = sys.stdin.readline

class UnionFind:
    def __init__(self, node:int) -> None:
        self.n = node
        self.par = [i for i in range(self.n)]
        self.rank = [0 for i in range(self.n)]
        
    def find(self, x:int) -> int:
        if x == self.par[x]:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
        
    def unite(self, x:int, y:int) -> bool:
        if self.isSame(x,y):
            #print("x and y has already united")
            return False
        
        rx = self.find(x)
        ry = self.find(y)
        
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
        else:
            self.par[ry] = rx
            
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1
                
        return True
    
    def isSame(self, x:int, y:int) -> bool:
        return self.find(x) == self.find(y)

    

        
N, M = map(int, sdin().split())
P = list(map(int, sdin().split()))
XY = []
for i in range(M):
    XY.append(list(map(int, sdin().split())))


root_node = defaultdict(list)

uf = UnionFind(N)
for x,y in XY:
    x -= 1
    y -= 1
    uf.unite(x,y)

for i in range(N):
    uf.find(i)
    
par = uf.par

for i,root in enumerate(par):
    root_node[root].append(i)
    
ans = 0
for node_list in root_node.values():
    num_list = []
    for i in node_list:
        num_list.append(P[i]-1)
    
    ans += len(set(node_list)&set(num_list))
            
print(ans)
from collections import defaultdict
import sys
input = sys.stdin.readline

N, M = [int(item) for item in input().split()]
A = [int(item) for item in input().split()]
A.sort()

new_dict = defaultdict(lambda: 0)
for i in range(M):
    b, c = [int(item) for item in input().split()]
    new_dict[c] += b
new_dict = sorted(new_dict.items(), key=lambda x: -x[0])


new_list = []
for k, v in new_dict:
    new_list += ([k] * v)
    # if len(new_list) >= N:
    #    break

"""
new_list = new_list[:N]

#####

n = min(N, len(new_list))
for i in range(n):
    if A[i] >= new_list[i]:
        break
    A[i] = new_list[i]

print(sum(A))
"""


### FIXED CODE ###

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

N, M = [int(item) for item in input().split()]
A = [int(item) for item in input().split()]
A.sort()

new_dict = defaultdict(lambda: 0)
for i in range(M):
    b, c = [int(item) for item in input().split()]
    new_dict[c] += b
new_dict = sorted(new_dict.items(), key=lambda x: -x[0])

new_list = []
for k, v in new_dict:
    if v > N:
        v = N
    new_list += [k] * v
    if len(new_list) >= N:
        break

new_list = new_list[:N]

#####

n = min(N, len(new_list))
for i in range(n):
    if A[i] >= new_list[i]:
        break
    A[i] = new_list[i]

print(sum(A))
s = input().split()
A = s[0]
B = s[1]
K = s[2]
 
for j in range(K):
  if A >0:
    A -= 1
  elif B >0:
    B -= 1
  else:
    break
 
print(A, B)

### FIXED CODE ###

i = list(map(int, input().split()))
A = i[0]
B = i[1]
K = i[2]

if K <= A :
    A -= K
elif K <= A + B :
    B -= K - A
    A = 0
else :
    A = 0
    B = 0

print(A, B)
A,B,C=map(str,input().split(' '))
D,E,F=map(str,input().split(' '))
if (A==F) and (B==E) and (C==D):
    print('YES')
else:
    print('NO')

### FIXED CODE ###

A=input()
B=input()
C=B[2]+B[1]+B[0]
if A==C:
    print('YES')
else:
    print('NO')
import collections

n,m = map(int,raw_input().split(' '))
print n - sum([map(int,raw_input().split(' '))] or [0])

### FIXED CODE ###

n,m = map(int,raw_input().split(' '))
a = n - sum(map(int,raw_input().split(' ')) or [0])
print a if a >= 0 else -1
#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    X=input().strip("\n")[::-1]
    cnt=[0]*N
    for i in range(1,N):
        n=i
        while(n>0):
            pc=0
            for j in range(19):
                if (n>>j)&1==1:
                    pc+=1
            n%=pc
            cnt[i]+=1
    pc=X.count("1")
    t=0
    c=[0]*N
    for i in range(N):
        if X[i]=="1":
            t+=2**i
            c[i]=1
    X=t
    ans=[0]*N
    for i in range(N):
        if c[i]==1:
            x=X-pow(2,i)
            pci=pc-1
            x-=(x//pci)*pci
            ans[i]=cnt[x%pci]+1
        else:
            x=X+pow(2,i)
            pci=pc+1
            x-=(x//pci)*pci
            ans[i]=cnt[x%pci]+1
    ans=ans[::-1]
    for i in range(N):
        print(ans[i])
    
    
    
if __name__=="__main__":
    main()


### FIXED CODE ###

#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    X=input().strip("\n")
    cnt=[0]*N
    for i in range(1,N):
        n=i
        while(n>0):
            pc=0
            for j in range(19):
                if (n>>j)&1==1:
                    pc+=1
            n%=pc
            cnt[i]+=1
    pc=X.count("1")
    if pc==0:
        for i in range(N):
            print(1)
        exit()

    rp=[0]*N
    rn=[0]*N
    for i in range(N):
        rp[i]=pow(2,i,pc+1)
        if pc!=1:
            rn[i]=pow(2,i,pc-1)
    rp=rp[::-1]
    rn=rn[::-1]
            
    Xrp=0
    Xrn=0
    for i in range(N):
        if X[i]=="1":
            Xrp=(Xrp+rp[i])%(pc+1)
            if pc!=1:
                Xrn=(Xrn+rn[i])%(pc-1)
            
    for i in range(N):
        if X[i]=="1":
            if pc==1:
                print(0)
                continue
            r=Xrn-rn[i]
            print(cnt[r%(pc-1)]+1)
        else:
            r=Xrp+rp[i]
            print(cnt[r%(pc+1)]+1)
    
    
    
if __name__=="__main__":
    main()
import math
S = input()
K = int(input())

ps = []

for s in S:
    i = int(s)
    if(i == 1):
        p = -1
    else:
        p = 5*(10**15) * math.log(i)
    ps.append(p)

sum = 0
index = 0
    
if K == 1:
    print(S[0])
else:
    for p in ps:

        if not p == -1:
            sum += p
        else:
            K -= 1

        if math.log(K) < sum:
            #print(index)
            print(S[index])
            break
        index += 1



### FIXED CODE ###

A, B = map(int, input().split())
area = (A - 1) * (B - 1)
print(area)
n = int(input())
if n[0] == n[2]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = input()
if n[0] == n[-1]:
    print('Yes')
else:
    print('No')
x = 2
print (x*x*x}

### FIXED CODE ###

a = int(input())
print (a**3)
import fractions
L = [0]
R = [0]
for i in range(N-1):
    L.append(gcd(L[i], A[i]))
    R.append(gcd(R[i], A[-i-1]))
MAX = 0
for i in range(N):
    MAX = max(MAX, gcd(L[i], R[-i-1]))
print(MAX)



### FIXED CODE ###

from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
L = [0]
R = [0]
for i in range(N-1):
    L.append(gcd(L[i], A[i]))
    R.append(gcd(R[i], A[-i-1]))
MAX = 0
for i in range(N):
    MAX = max(MAX, gcd(L[i], R[-i-1]))
print(MAX)
a=int(input('a? >>'))
b=int(input('b? >>'))
ans='Even' if (a * b % 2) == 0 else 'Odd'
print(ans)


### FIXED CODE ###

a,b=map(int,input().split())
ans="Even" if (a * b % 2) == 0 else "Odd"
print(ans)
import os

N, K = map(int, input().split(' '))
d_list = input().split(' ')
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                number =  i * 1000 + j * 100 + k * 10 + l
                result = set(list(str(number)))
                if set(d_list) & result != set():
                    continue
                if number >= N:
                    print(number)
                    os._exit(1)





### FIXED CODE ###

N, K = map(int, input().split(' '))
d_list = input().split(' ')
for h in range(10):
    for i in range(10):
        for j in range(10):
            for k in range(10):
                for l in range(10):
                    number = h * 10000 + i * 1000 + j * 100 + k * 10 + l
                    result = set(list(str(number)))
                    if set(d_list) & result != set():
                        continue
                    if number >= N:
                        print(number)
                        break
                else:
                    continue
                break
            else:
                continue
            break
        else:
            continue
        break
    else:
        continue
    break
a=input()
b=input()
square=int(a)*int(b)
length=int(a)*2+int(b)*2
print(square,length)

### FIXED CODE ###

InputNum = input().split()
tate = int(InputNum[0])
yoko = int(InputNum[1])
square = tate * yoko
length = 2* (tate + yoko)
print(square,length)
n,m = (int(i) for i in input().split())
x = [int(i) for i in input().split()]

if m == 1:
	print(0)
else:
	sorted_x = sorted(x)
 
	diff_x = []
	diff = 0
	result = 0
 
	for i in range(m-1):
		diff = sorted_x[i+1] - sorted_x[i]
		result += diff
		diff_x.append(diff)

	sorted_diff = sorted(diff_x, reverse=True)[:n-1]
 
	if n == 1:
 		result -= sorted_diff[0]
	else:
		for i in range(n-1):
			result -= sorted_diff[i]
	 
	print(result)	

### FIXED CODE ###

n,m = (int(i) for i in input().split())
x = [int(i) for i in input().split()]

if n >= m:
	print(0)
else:
	sorted_x = sorted(x)
 
	diff_x = []
	diff = 0
	result = 0
 
	for i in range(m-1):
		diff = sorted_x[i+1] - sorted_x[i]
		result += diff
		diff_x.append(diff)

	sorted_diff = sorted(diff_x, reverse=True)[:n-1]
 
	for i in range(n-1):
		result -= sorted_diff[i]
	 
	print(result)
s, w = input().split(' ')
s = int(s)
w = int(w)
 
if s > w :
  print('safe')
else:
  pritn('unsafe')

### FIXED CODE ###

s, w = input().split(' ')
s = int(s)
w = int(w)
 
if s > w :
  print('safe')
else:
  print('unsafe')
n=int(input())
a=[int(input()) for i in range(n)]
max1 = 0
max1_ind = 0
max2 = 0
max2_ind = 0
 
for i in range(n):
    if max2 =< a[i]:
        if max1 =< a[i]:
            mzx1 = a[i]
            max1_ind = i
            max2 = max1
            max2_ind = max1_ind
        else:
            max2 = a[i]
            max2_ind = i
    
for j in range(n):
    if j == max1_ind:
        print(max2)
    else:
        print(max1)

### FIXED CODE ###

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

max1 = 0
max1_ind = 0
max2 = 0
max2_ind = 0
 
for i in range(n):
    if max2 <= a[i]:
        if max1 <= a[i]:
            max2 = max1
            max2_ind = max1_ind
            max1 = a[i]
            max1_ind = i
            
        else:
            max2 = a[i]
            max2_ind = i
    
for j in range(n):
    if j == max1_ind:
        print(max2)
    else:
        print(max1)
max = 0
i = 0
j = 0
k = 0
n_max = 0

n_max = int(raw_input())
price = [1,2,3,4,5]

for i in range(5)
    for j in range(j, 5)
        if max <= price[5] - price[i]:
            print max

### FIXED CODE ###

import sys

n = int(raw_input())

min_R = int(raw_input())
nums = map(int, sys.stdin.readlines())

ans = -10**9

for num in nums:
    if num - min_R > ans:
        ans = num - min_R
    if num < min_R:
        min_R = num
        
print ans
import collections
n = int(input())
s = [str(input()) for _ in range(n)]
m = int(input())
t = [str(input()) for _ in range(m)]
s = collections.Counter(s)
t = collections.Counter(t)

for k, j in t.items():
    if k in s:
        s[k] -= j

values, counts = zip(*s.most_common())
print(max(0,counts[0))


### FIXED CODE ###

import collections
n = int(input())
s = [str(input()) for _ in range(n)]
m = int(input())
t = [str(input()) for _ in range(m)]
s = collections.Counter(s)
t = collections.Counter(t)

for k, j in t.items():
    if k in s:
        s[k] -= j

values, counts = zip(*s.most_common())
print(max(0,counts[0]))
print(-((-(input())//2)))

### FIXED CODE ###

a,b=map(int,input().split())
print(-((-a-b)//2))
N = int(input())
A = int(input())
B = int(input())

if N*A < B:
    print(N*A)
else:
    print(B)

### FIXED CODE ###

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

N *= A

if (N) < B:
    print(N)
else:
    print(B)
S = {}

A = input()
B = input()
C = input()

S['a'] = A
S['b'] = B
S['c'] = C

player = 'a'
for i in range(len(A) + len(B) + len(C)):
    # pass
    # print(S[player][0])
    S[player] = S[player][1:]
    
    if len(S[player]) == 0:
        break
    
    player = S[player][0]
    

# print(A)
# print(B)
# print(C)

print(player.upper())

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())

result = h * (a + b) / 2
result = int(result)

print(result)
tree = {}
ans = []
def resolve():
    N, Q = map(int, input().split())
    ans.extend([0 for _ in range(N)])

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

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

    dfs(0, ans[0])

    print(' '.join([str(x) for x in ans]))


def dfs(k, val, par=0):
    if k not in tree:
        return
    for c in tree.get(k, []):
        if c == par:
            continue
        ans[c] += val
        dfs(c, ans[c], k)
    return

if __name__ == "__main__":
    resolve()

### FIXED CODE ###

N, Q = map(int, input().split())
tree = {}
ans = []
ans.extend([0 for _ in range(N)])

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

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

sta = [(0, 0)]
while sta:
    k, p = sta.pop()
    for c in tree.get(k, []):
        if c == p:
            continue
        ans[c] += ans[k]
        sta.append((c, k))

print(' '.join([str(x) for x in ans]))
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

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

root = [[] for _ in range(n+1)]
for i in range(n-1):
    a, b = map(int, input().split())
    root[a].append(b)
    root[b].append(a)
    
cnt = [0 for _ in range(n+1)]
for i in range(q):
    p, x = map(int, input().split())
    cnt[p] += x

def rec(node, parent):
    for i in root[node]:
        if i == parent:
            continue
        cnt[node] += cnt[parent]
        rec(i, node)

rec(1, 1)
print(" ".join(map(str, cnt[1:])))

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(300000)

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

root = [[] for _ in range(n+1)]
for i in range(n-1):
    a, b = map(int, input().split())
    root[a].append(b)
    root[b].append(a)
    
cnt = [0 for _ in range(n+1)]
for i in range(q):
    p, x = map(int, input().split())
    cnt[p] += x

def rec(node, parent):
    for i in root[node]:
        if i == parent:
            continue
        cnt[i] += cnt[node]
        rec(i, node)

rec(1, 1)
print(" ".join(map(str, cnt[1:])))