Harryxun/stf_run huggingface dataset:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
import sys

sys.setrecursionlimit(50000)

n,q = nm()

tval = [0]*n
t = [[] for _ in range(n)]

for i in range(n-1):
    a,b = nm()
    t[a-1].append(b-1)

for i in range(q):
    p,x = nm()
    tval[p-1] += x

ans = [0]*n
def dfs(num,val):
    now = val+tval[num]
    ans[num] = now
    for nn in t[num]:
        dfs(nn,now)

dfs(0,0)

for i in ans:
    print(i)


### FIXED CODE ###

ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
import sys

sys.setrecursionlimit(500000)

visited = set()

n,q = nm()

tval = [0]*n
t = [[] for _ in range(n)]

for i in range(n-1):
    a,b = nm()
    t[a-1].append(b-1)
    t[b-1].append(a-1)

for i in range(q):
    p,x = nm()
    tval[p-1] += x

ans = [0]*n
def dfs(num,val):
    visited.add(num)
    now = val+tval[num]
    ans[num] = now
    for nn in t[num]:
        if nn not in visited:
            dfs(nn,now)

dfs(0,0)

for i in ans:
    print(i)
N,M = map(int,input().split())
a = []
for i in range(M):
    a.append(int(input()))
dp = [0]*(N+1)
dp[1] = 1
if 1 in a:
    dp[2] = 1
    dp[1] = 0
else:
    dp[2] = 2
for i in range(3,N+1):
    if i-1 in a:
        continue
    
    dp[i] = (dp[i-2]+dp[i-1])%1000000007
ans = dp[N]
print(ans)


### FIXED CODE ###

N,M = map(int,input().split())
a = set([int(input()) for i in range(M)])
dp = [0]*(N+1)
dp[0] = 1
dp[1] = 1
if 1 in a:
    dp[1] = 0
for i in range(2,N+1):
    if i in a:
        continue
    
    dp[i] = (dp[i-2]+dp[i-1])%1000000007
ans = dp[N]
print(ans)
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


class BinaryIndexTree:
    def __init__(self, n):
        self._size = n
        self._tree = [0] * (n+1)

    def sum(self, i):
        s = 0
        i += 1
        while 0 < i:
            s += self._tree[i-1]
            i -= i & -i
        return s

    def add(self, i, x):
        i += 1
        while i <= self._size:
            self._tree[i-1] += x
            i += i & -i


def solve(N: int, a: "List[int]"):
    c = N * (N + 1) // 2
    th = (c + 1 ) // 2

    xs = list(sorted(set(a)))
    lo = 0
    hi = len(xs)

    def _f(x):
        ss = [0] + list(accumulate([1 if x <= v else -1 for v in a]))
        n = max([abs(s) for s in ss])
        bit = BinaryIndexTree(2 * n + 1)

        ret = 0
        for s in ss:
            bit.add(s + n, 1)
            ret += bit.sum(s + n - 1)
        return ret

    while lo < hi:
        mid = (lo + hi) // 2
        if th < _f(xs[mid]):
            lo = mid + 1
        else:
            hi = mid
    return xs[lo]


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    result = solve(N, a)
    print(result)

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


class BinaryIndexTree:
    def __init__(self, n):
        self._size = n
        self._tree = [0] * (n+1)

    def sum(self, i):
        s = 0
        i += 1
        while 0 < i:
            s += self._tree[i-1]
            i -= i & -i
        return s

    def add(self, i, x):
        i += 1
        while i <= self._size:
            self._tree[i-1] += x
            i += i & -i


def solve(N: int, a: "List[int]"):
    c = N * (N + 1) // 2
    th = (c + 1) // 2

    xs = list(sorted(set(a)))
    lo = 0
    hi = len(xs)

    def _f(x):
        ss = [0] + list(accumulate([1 if x <= v else -1 for v in a]))
        n = max([abs(s) for s in ss])
        bit = BinaryIndexTree(2 * n + 1)

        ret = 0
        for s in ss:
            ret += bit.sum(s + n) 
            bit.add(s + n, 1)
        return ret

    while (lo + 1) < hi:
        mid = (lo + hi) // 2
        if th <= _f(xs[mid]):
            lo = mid
        else:
            hi = mid
    return xs[lo]


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    result = solve(N, a)
    print(result)

if __name__ == '__main__':
    main()
import heapq

N = int(input())
A, B = [], []
for i in range(N):
  a,b = map(int,input().split())
  heapq.heappush(A,[-a,i])
  heapq.heappush(B,[-b,i])

flags = [1 for _ in range(N)]
Asum, Bsum = 0, 0
ans = 0
for i in range(N):
  if i%2==0:
    flag = 0
    while flag == 0:
      neg_a, ii = heapq.heappop(A)
      flag = flags[ii]
      flags[ii] = 0
    Asum += -neg_a
  else:
    neg_b, ii = heapq.heappop(B)
    flag = 0
    while flag == 0:
      neg_b, ii = heapq.heappop(B)
      flag = flags[ii]
      flags[ii] = 0
    Bsum += -neg_b  
print(Asum-Bsum)

### FIXED CODE ###

N = int(input())
AB = []
ans = 0
for _ in range(N):
  a,b = map(int,input().split())
  AB.append(a+b)
  ans -= b
AB.sort(reverse=True)

print(ans+sum(AB[::2]))
S = input()
mode = 0
now = 0
k = []
for i in range(len(S)):
    if str(S[i]) == "A" or str(S[i]) == "T" or str(S[i]) == "G" or str(S[i]) == "C":
        if mode == 0:
            mode = 1
            now += 1
        else:
            now += 1
    else:
        k.append(now)
        now = 0
        mode = 0
print(max(k))

### FIXED CODE ###

S = input()
mode = 0
now = 0
k = []
for i in range(len(S)):
    if str(S[i]) == "A" or str(S[i]) == "T" or str(S[i]) == "G" or str(S[i]) == "C":
        if mode == 0:
            mode = 1
            now += 1
        else:
            now += 1
    else:
        k.append(now)
        now = 0
        mode = 0
k.append(now)
if len(k) == 0:
    print(0)
else:
    print(max(k))
l, r = map(int, input().split())
if r-l >= 2017:
	print (0)
	exit()
else:
	for i in range(l,r+1):
		for j in range(i+1,r+1):
			a = min(a,i*j%2019)
print (a)

### FIXED CODE ###

l, r = map(int, input().split())
a = 10**5
if r - l >= 2017:
	print (0)
	exit()
else:
	for i in range(l,r+1):
		for j in range(i+1,r+1):
			a = min(a,i*j%2019)
print (a)
N,M = map(int, input().split())

MOD = 10**9 + 7

a = [int(input()) for _ in range(M)]

dp = [0] * (N+1)
dp[0] = 1
dp[1] = 1
dp[2] = 2

for i in range(1,N+1):
    if (i in a):
        dp[i] = 0
        continue
    dp[i] = (dp[i-1]) + (dp[i-2])
print(dp[i]%MOD)


### FIXED CODE ###

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

MOD = 10**9 + 7

safe = [True] * (N+1)
for i in range(len(A)):
    safe[A[i]] = False

dp = [0] * (N+1)
dp[0] = 1
if safe[1]:
    dp[1] = 1

for i in range(2, N+1):
    if(safe[i]):
        dp[i] = dp[i-1] + dp[(i-2)]
        dp[i] = dp[i] % MOD
    else:
        dp[i] = 0

print(dp[N])
a = input()
print(a + a**2 + a**3)

### FIXED CODE ###

a = input()
a = int(a)
print(a + a**2 + a**3)
import math
 
X,K,D = map(int, input().split())
tm = round(X/D)
if K <= tm:
  print(abs(X+D*K)if absabs(X+D*K) < abs(X-D*K)else abs(X-D*K))
else:
  if (K-tm)%2==1:
    print(abs(X-D*(tm+1)) if abs(X-D*(tm+1)) < abs(X-D*(tm-1))else abs(X-D*(tm-1)))
  else:
    print(abs(X+D*K)if absabs(X+D*K) < abs(X-D*K)else abs(X-D*K))

### FIXED CODE ###

X, K, D = map(int, input().split())
 
Xa = abs(X)
Xs = Xa // D
Xm = Xa % D
 
if (K <= Xs):
    print(abs(Xa-D*K))
elif (K-Xs) % 2 == 0:
    print(abs(Xm))
else:
    print(abs(D-Xm))
from math import factorial
import collections
N, *s = open(0).read().split()
s_sorted = [''.join(sorted(c)) for c in s]
c = collections.Counter(s_sorted)
res = list(set(s_sorted))
count = 0
for s in res:
  if c[s] > 2:
    count += factorial(c[s]) / factorial(2) / factorial(c[s] - 2)
  elif c[s] == 2:
    count += 1
print(int(count))

### FIXED CODE ###

N, *s = open(0).read().split()
sl = [''.join(sorted(c)) for c in s]
count = 0
dict = {}
for s in sl:
  if s in dict:
    count += dict[s]
    dict[s] += 1
  else:
    dict[s] = 1
print(count)
n = int(input())

if n % == 2:
    print(int(n /2))
else:
    print_out = int(n / 2) + 1
    print(print_out)

### FIXED CODE ###

n=int(input())

ans=int(n/2)

if n%2==0:
    print(ans)
else:
    print(ans+1)
A,B,K = map(int,input().split())
num = []
for i in range(1,min(A,B)):
    if A%i == 0 and B%i == 0:
        num.append(i)
print(num[-K])

### FIXED CODE ###

A,B,K = map(int,input().split())
num = []
for i in range(1,min(A,B)+1):
    if A%i == 0 and B%i == 0:
        num.append(i)
print(num[-K])
# D
N,A,B = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)

max_mean = sum(v[:A])/A
print(max_mean)

from collections import Counter
from math import factorial

def comb(n,r):
    return factorial(n)//(factorial(r)*factorial(n-r))

v_count = Counter(v)
ans = 0
if v[0]==v[A-1]:
    n = v_count[v[A-1]]
    for r in range(A, B+1):
        ans += comb(n, r)
else:
    n = v_count[v[A-1]]
    select_count = Counter(v[:A])
    r = select_count[v[A-1]]
    ans = comb(n,r)
print(ans)

### FIXED CODE ###

# D
N,A,B = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)

max_mean = sum(v[:A])/A
print(max_mean)

from collections import Counter
from math import factorial

def comb(n,r):
    return factorial(n)//(factorial(r)*factorial(n-r))

v_count = Counter(v)
ans = 0
if v[0]==v[A-1]:
    n = v_count[v[A-1]]
    for r in range(A, B+1):
        if r>n: break
        ans += comb(n, r)
else:
    #print(n, r)
    n = v_count[v[A-1]]
    select_count = Counter(v[:A])
    r = select_count[v[A-1]]
    ans = comb(n,r)
print(ans)
n=input()
N=int(n)
tmp=list(n)

c=0
for i in tmp():
    c+=int(i)

if N%c==0:
    print("yes")
else:
    print("no")

### FIXED CODE ###

n=input()
N=int(n)
tmp=list(n)

c=0
for i in tmp:
    c+=int(i)

if N%c==0:
    print("Yes")
else:
    print("No")
a, b, c = map(int, input().split())

if a == b+c or b = c+a or c == a+b:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

if a == b+c or b == c+a or c == a+b:
    print('Yes')
else:
    print('No')
H,W = map(int,input().split())
grid = [[0 for w in range(W)] for h in range(H)]
sharps = []
for h in range(H):
  row = input()
  print(row)
  for w,r in enumerate(row):
    #print(w,r)
    if r == "#":
      #grid[h][w] = "#"
      sharps.append([h,w])
      if h>=1:
        grid[h-1][w] += 1
        if w>=1:
          grid[h-1][w-1] += 1
        if w<=W-1:
          grid[h-1][w+1] += 1
      if h<=H-1:
        grid[h+1][w] += 1
        if w>=1:
          grid[h+1][w-1] += 1
        if w<=W-1:
          grid[h+1][w+1] += 1
      if w>=1:
        grid[h][w-1] +=1
      if w<=W-1:
        grid[h][w+1] +=1
for sharp in sharps:
  grid[sharp[0]][sharp[1]] = "#"
for g in grid:
  print("".join([str(v) for v in g]))

### FIXED CODE ###

H,W = map(int,input().split())
grid = [[0 for w in range(W)] for h in range(H)]
sharps = []
for h in range(H):
  row = [v for v in input()]
  #print(row)
  for w,r in enumerate(row):
    #print(w,r)
    if r == "#":
      #grid[h][w] = "#"
      sharps.append([h,w])
      if h>=1:
        grid[h-1][w] += 1
        if w>=1:
          grid[h-1][w-1] += 1
        if w<=W-2:
          grid[h-1][w+1] += 1
      if h<=H-2:
        grid[h+1][w] += 1
        if w>=1:
          grid[h+1][w-1] += 1
        if w<=W-2:
          grid[h+1][w+1] += 1
      if w>=1:
        grid[h][w-1] +=1
      if w<=W-2:
        grid[h][w+1] +=1
#print(sharps)
for sharp in sharps:
  grid[sharp[0]][sharp[1]] = "#"
for g in grid:
  print("".join([str(v) for v in g]))
N=int(input())
A=[int(x) for x in input().split()]
AA=sorted(set(A),reverse=True)
li=[]
for aa in AA:
  if A.count(aa)>=4:
    print(a**2)
    break
  if A.count(aa)>=2:
    li.append(aa)
  if len(li)==2:
    break
if len(li)==0:
  print(0)
if len(li)==2:
  print(li[0]*li[1])


### FIXED CODE ###

import collections
N=int(input())
A=[int(x) for x in input().split()]
C=collections.Counter(A)
C=sorted(list(C.items()),reverse=True)
li=[]
for i,j in C:
  if j>=4:
    li.append(i)
    break
  if j>=2:
    li.append(i)
  if len(li)==2:
    break
if len(li)==0:
  print(0)
if len(li)==1:
  print(li[0]**2)
if len(li)==2:
  print(li[0]*li[1])
s = input()
first = s[0]
count = 0
s_count = 0
for i in range(1,len(s)):
    if s[i] == first:
        count += 1
    else:
        second =s[i]  
        num = i
for i in range(1,len(s)):
    if num == i:
        m = 0
    elif second == s[i]:
        s_count += 1

if count == 1 and s_count == 1:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = input()
first = s[0]
count = 0
s_count = 0
num = 0
second = ""
for i in range(1,len(s)):
    if s[i] == first:
        count += 1
    else:
        second = s[i]  
        num = i
for i in range(1,len(s)):
    if num == i:
        m = 0
    elif second == s[i]:
        s_count += 1

if count == 1 and s_count == 1:
    print("Yes")
else:
    print("No")
a = sorted(list(map(int, input().split())), reverse=True)

#　せっかくなのであとでpossibleを前計算してm*v以上をbisectでもやる
def isOK(x):
  x -= 1
  if a[x] + m < a[p-1]:
    return False
  elif x+1 <= p:
    return True
  else:
    pos = m * n
    for i in range(p-1,x):
      pos -= a[i] - a[x]
    if pos >= m * v:
      return True
    else:
      return False

def binary_search():
    ok = p-1
    ng = n
    while abs(ok-ng) > 1:
        mid = (ok+ng)//2
        if isOK(mid):
            ok = mid
        else:
            ng = mid
    return ok

ans = binary_search()  
print(ans)

### FIXED CODE ###

n,m,v,p = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)

#　せっかくなのであとでmarginを前計算してm*v以上をbisect
def isOK(x):
  border = a[x-1]
  if border + m < a[p-1]:
    return False
  elif x <= p:
    return True
  else:
    margin = m * n
    for i in range(p-1,x-1):
      margin -= a[i] - border
    if margin >= m*v:
      return True
    else:
      return False

def binary_search():
    ok = p-1
    ng = n+1
    while abs(ok-ng) > 1:
        mid = (ok+ng)//2
        if isOK(mid):
            ok = mid
        else:
            ng = mid
    return ok

ans = binary_search()  
print(ans)
s=input()
ans=1
for i in range(3):
	ans*=s
print(ans)


### FIXED CODE ###

a=int(input())
print(a**3)
n = int(input())
l = [input() for _ in range(num)]
print("AC x", l.count("AC"))
print("WA x", l.count("WA"))
print("TLE x", l.count("TLE"))
print("RE x", l.count("RE"))

### FIXED CODE ###

num = int(input())
lst = [input() for _ in range(num)]
print("AC x", lst.count("AC"))
print("WA x", lst.count("WA"))
print("TLE x", lst.count("TLE"))
print("RE x", lst.count("RE"))
n, k = map(int, input().split())
x0 = list(map(int, input().split()))

x1 = [i for i in x0 if i >= 0]
x2 = list(reversed([i for i in x0 if i < 0]))
count0 = len(x1)
count1 = len(x2)
ans = float('inf')

if count1 == 0:
    print(x1[k-1])
elif count0 == 0:
    print(x2[k-1])
else:
    for i in range(min(count0, k)):
        ans = min(ans, x1[i]*2-x2[k-i-2])
    for i in range(min(count1, k)):
        ans = min(ans, -x2[i]*2+x1[k-i-2])
    print(ans)


### FIXED CODE ###

n, k = map(int, input().split())
x0 = list(map(int, input().split()))

x1 = [i for i in x0 if i >= 0]
x2 = list(reversed([i for i in x0 if i < 0]))
count0 = len(x1)
count1 = len(x2)
ans = float('inf')

if count1 == 0:
    print(x1[k-1])
elif count0 == 0:
    print(-x2[k-1])
else:
    if 0 in x1:
        x1.remove(0)
        k -= 1
        count0 -= 1
    for i in range(min(count0, k)):
        if count1 >= k-i-1:
            ans = min(ans, x1[i]*2-x2[k-i-2])
    for i in range(min(count1, k)):
        if count0 >= k-i-1:
            ans = min(ans, -x2[i]*2+x1[k-i-2])
    print(ans)
N,A,B=map(int,input().split())
V=list(map(int,input().split()))
V=sorted(V,reverse=True)

def fac(n):
  if n<= 1: return 1
  return n*fac(n-1)
def c (a,b): 
  if b==0: return 1
  return fac(a)//fac(b)//fac(a-b)


print(sum(V[:A])/A)

if V.count(V[0]) >= A:
  ans=0
  for i in range(A, min(B+1,V.count(V[A])+1))):
    ans+=c(V.count(V[A]),i)
else:
  lstcnt=A-1
  ans=V.count(V[A])
print(ans)
  


### FIXED CODE ###

N,A,B=map(int,input().split())
V=list(map(int,input().split()))
V=sorted(V,reverse=True)

def fac(n):
  if n<= 1: return 1
  return n*fac(n-1)
def c (a,b): 
  if b==0: return 1
  return fac(a)//fac(b)//fac(a-b)


print(sum(V[:A])/A)

if V.count(V[0]) >= A:
  ans=0
  for i in range(A, min(B+1,V.count(V[0])+1)):
    ans+=c(V.count(V[0]),i)
else:
  ans=c(V.count(V[A-1]), V[:A].count(V[A-1]))
print(ans)
a, b = map(int,input().split())
d = (int)a/b
r = a%b
f = a/b
print("%d %d %f"%(d,r,f))

 

### FIXED CODE ###

a, b = map(int,input().split())
d = a // b 
r = a % b
f = a / b
print("%d %d %f" %(d,r,f))
a = input()
if a.isupper() = True:
  print 'A'
else:
  print 'a'

### FIXED CODE ###

α = input()
if α.isupper() == True:
  print ('A')
else:
  print ('a')
(a, b) = map(int, raw_input().split())
print str(a * b) + " " + str(2 * (a + b))

### FIXED CODE ###

a, b = map(int, raw_input().split())
print ("%d %d" % (a * b, 2 * (a + b)))
from collections import Counter

N = int(input())
nums = [0] + list(map(int, input().split()))

A = [i + n for n in enumerate(nums, start=1)]
B = [j - n for n in enumerate(nums, start=1)]
BC = Counter(B)
answer = 0
for a in A:
  answer += BC[a]
print(answer)

### FIXED CODE ###

from collections import Counter

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

A = [i + n for i, n in enumerate(nums, start=1)]
B = [j - n for j, n in enumerate(nums, start=1)]
BC = Counter(B)
answer = 0
for a in A:
  answer += BC[a]
print(answer)
N, K = map(int, input().split())

ab = [[0, 0]] * N
for i in range(N):
    _a, _b = map(int, input().split())
    ab[i] = [_a, _b]
ab.sort(key=lambda x:x[0])

j = 0
index = 0
while j < K:
    j += ab[index][1]
    if j < K:
        index += 1

print ab[index][0]


### FIXED CODE ###

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

ab = [[0, 0]] * N
for i in range(N):
    _a, _b = map(int, input().split())
    ab[i] = [_a, _b]
ab.sort(key=lambda x:x[0])

j = 0
index = 0
while j < K:
    j += ab[index][1]
    if j < K:
        index += 1

print(ab[index][0])
n = int(input())

a = [int(i)-j for i,j in zip(input().split(),range(n))]

l = -10 ** 10

r = 10 ** 10

def f(x):
  return sum(map(lambda y: abs(y - x), a))

while r - l > 3:
  l_r = (r - l) // 3
  l_i = l + l_r
  i_r = r - l_r
  if f(l_i) > f(i_r):
    l = l_i
  else:
    r = i_r
print(min(f(l),f(l+1),f(l+2),f(l+3)))
  



### FIXED CODE ###

#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n = II()
    if n % 2:
        print(2 * n)
    else:
        print(n)
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()
N = int(input())
X = list(map(int, input().split()))
for p in range(1, max(X)):
    x_sum=0
    for x in X:
        x_sum+=(x-p)**2
    ans = min(ans, x_sum)
print(ans)

### FIXED CODE ###

N = int(input())
X = list(map(int, input().split()))
ans = float("inf")
for p in range(1, max(X)+1):
    x_sum=0
    for x in X:
        x_sum+=(x-p)**2
    ans = min(ans, x_sum)
print(ans)
from sys import stdin
import math


def lcm(a,b):
  return int(a * b / math.gcd(a, b))

A, B= [int(x) for x in stdin.readline().rstrip().split()]



print(lcm(A,B))

### FIXED CODE ###

from sys import stdin
import math

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

  return gcd(b, a % b)


def lcm(a,b):
  return int(a * b / gcd(a, b))

A, B= [int(x) for x in stdin.readline().rstrip().split()]



print(lcm(A,B))
import fractions


def args():
    N, MA, MB = list(map(int, input().split()))

    A, B, C = [], [], []
    for i in range(N):
        a, b, c = list(map(int, input().split()))
        A.append(a)
        B.append(b)
        C.append(c)

    # print(N, MA, MB)
    # print(A)
    # print(B)
    # print(C)

    return N, MA, MB, A, B, C


def solve(N, MA, MB, A, B, C):
    def recur(i, a, b):
        if not MEMO[i][a][b] is None:
            return MEMO[i][a][b]

        if not i < N:
            if 0 < a and 0 < b:
                g = fractions.gcd(a, b)
                if (MA, MB) == (a / g, b / g):
                    return 0
            return float("inf")

        res = min(recur(i + 1, a, b) + 0, recur(i + 1, a + A[i], b + B[i]) + C[i])
        MEMO[i][a][b] = res
        return res

    x, y, z = 40 + 1, 10 * 10 + 1, 10 * 10 + 1
    MEMO = [[[None] * z for _ in range(y)] for _ in range(x)]

    ans = recur(0, 0, 0)

    return ans


if __name__ == '__main__':
    res = solve(*args())

    print(-1) if res == float("inf") else print(res)


### FIXED CODE ###

import fractions


def args():
    N, MA, MB = list(map(int, input().split()))

    A, B, C = [], [], []
    for i in range(N):
        a, b, c = list(map(int, input().split()))
        A.append(a)
        B.append(b)
        C.append(c)

    # print(N, MA, MB)
    # print(A)
    # print(B)
    # print(C)

    return N, MA, MB, A, B, C

def solve(N, MA, MB, A, B, C):
    def recur(i, a, b):
        if not MEMO[i][a][b] is None:
            return MEMO[i][a][b]

        if not i < N:
            if 0 < a and 0 < b:
                g = fractions.gcd(a, b)
                if (MA, MB) == (a / g, b / g):
                    return 0
            return float("inf")

        res = min(recur(i + 1, a, b) + 0, recur(i + 1, a + A[i], b + B[i]) + C[i])
        MEMO[i][a][b] = res
        return res

    x, y, z = N + 1, 10 * N + 1, 10 * N + 1
    MEMO = [[[None] * z for _ in range(y)] for _ in range(x)]

    ans = recur(0, 0, 0)

    return ans


if __name__ == '__main__':
    res = solve(*args())

    print(-1) if res == float("inf") else print(res)
import math

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

def roof(n):
    return math.ceil(n/10) * 10

def mod(n):
    return n % 10

low = map(mod, [A,B,C,D,E])
top = map(roof, [A,B,C,D,E])

low = [i for i in low if i != 0]

ans = sum(top) + min(low) - 10
print(ans)


### FIXED CODE ###

import math

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

def roof(n):
    return math.ceil(n/10) * 10

def mod(n):
    return n % 10

low = map(mod, [A,B,C,D,E])
top = map(roof, [A,B,C,D,E])

low = [i for i in low if i != 0]

if low == []: low = [10]
ans = sum(top) + min(low) - 10
print(ans)