Harryxun/stf_run huggingface dataset:
a=input()
b=input()
if (a*b)%2==0:
  print('Even')
else:
  print('Odd')


### FIXED CODE ###

a, b = map(int, input().split())
if a*b%2==0:
  print('Even')
else:
  print('Odd')
s=input()
for i in range(len(s)//2+1):
  if s[2*i]!='R' and s[2*i]!='U' and s[2*i]!='D' :
    print('No')
    exit()
for i in range(len(s)//2):
  if s[2*i+1]!='L' and s[2*i+1]!='U' and s[2*i+1]!='D':
    print('No')
    exit()
if len(s)%2==1:
  if s[-1]!='L' and s[-1]!='U' and s[-1]!='D':
    print('No')
    exit()
print('Yes')


### FIXED CODE ###

s=input()
if len(s)%2==0:
  for i in range(len(s)//2):
    if s[2*i]!='R' and s[2*i]!='U' and s[2*i]!='D' :
      print('No')
      exit()
    if s[2*i+1]!='L' and s[2*i+1]!='U' and s[2*i+1]!='D':
      print('No')
      exit()
if len(s)%2==1:
  for i in range(len(s)//2):
    if s[2*i+1]!='L' and s[2*i+1]!='U' and s[2*i+1]!='D':
      print('No')
      exit()
  for i in range(len(s)//2+1):
    if s[2*i]!='R' and s[2*i]!='U' and s[2*i]!='D' :
      print('No')
      exit()
print('Yes')
N, K = map(int,input().split())
h = []
for i in range(N):
    x = int(input())
    h.append(x)

h.sort()
m = []
for i in range(N):
    m.append(h[i+K-1] - h[i])

print(min(m))

### FIXED CODE ###

N, K = map(int,input().split())
h = []
for i in range(N):
    x = int(input())
    h.append(x)

h.sort()
m = []
for i in range(N-K+1):
    m.append(h[i+K-1] - h[i])

print(min(m))
import sys
import math
input = sys.stdin.readline
N, K = map(int, input().split())

def combinations(n, r):
    return math.factorial(n) // math.factorial(n - r) // math.factorial(r)

for i in range(1, K+1):
    remain = N - K
    ans = combinations(remain + 1, i) % 1000000007
    ans = ans * combinations(K-1, i-1) % 1000000007
    print(ans % 1000000007 )

### FIXED CODE ###

class PERM_COMB_MOD():
    # http://drken1215.hatenablog.com/entry/2018/06/08/210000
    def __init__(self, max_n=510000, mod=10**9+7):
        self.fac = [0]*max_n
        self.finv = [0]*max_n
        self.inv = [0]*max_n
        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1
        self.max = max_n
        self.mod = mod
        self._maesyori()

    def _maesyori(self):
        for i in range(2,self.max):
            self.fac[i] = self.fac[i-1] * i % self.mod
            self.inv[i] = self.mod - self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.finv[i] = self.finv[i-1] * self.inv[i] % self.mod

    def perm(self, n, k):
        if n < k : return 0
        if n < 0 or k < 0:return 0
        return self.fac[n] * self.finv[n-k] % self.mod % self.mod

    def comb(self, n, k):
        if n < k : return 0
        if n < 0 or k < 0:return 0
        return self.fac[n] * (self.finv[k] * self.finv[n-k] % self.mod) % self.mod

p = PERM_COMB_MOD()

mod = 10**9+7
n, k = map(int, input().split())
# n個をr個に分ける
def h(n, r):
    if n == 0 and r == 0:
        return 1
    return p.comb(n-1, r-1)

for i in range(1, k+1):
    blue = h(k, i)
    red = h(n-k, i-1) + 2*h(n-k, i) + h(n-k, i+1)
    ans = blue*red
    ans %= mod
    print(ans)
import heapq
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))


def solve1():
    que = []
    for a in a:
        for b in b:
            for c in c:
                heapq.heappush(que, -(a+b+c))
    for _ in range(k):
        print(-heapq.heappop(que))


solve1()


### FIXED CODE ###

import heapq
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

X, Y, Z, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A = sorted(A, reverse=True)
B = sorted(B, reverse=True)
C = sorted(C, reverse=True)


def calc(x, y, z):
    return [-A[x]-B[y]-C[z], x, y, z]


def solve1(A, B, C, X, Y, Z, k):
    Q = []
    Q.append(calc(0, 0, 0))

    ans = []
    # dict
    memo = {(0, 0, 0): True}
    for _ in range(k):
        e, x, y, z = heapq.heappop(Q)
        ans.append(-e)
        if x+1 < X and (x+1, y, z) not in memo:
            heapq.heappush(Q, calc(x+1, y, z))
            memo[(x+1, y, z)] = True
        if y+1 < Y and (x, y+1, z) not in memo:
            heapq.heappush(Q, calc(x, y+1, z))
            memo[(x, y+1, z)] = True

        if z+1 < Z and (x, y, z+1) not in memo:
            heapq.heappush(Q, calc(x, y, z+1))
            memo[(x, y, z+1)] = True

    print("\n".join(map(str, ans[:k])))


solve1(A, B, C, X, Y, Z, k)
p = sorted([(a+b, a-b) for a, b in zip(x, l)])
    _, th = p[0]
    best = 0
    for t, s in p:
        if th <= s:
            best += 1
            th = t
    return best

n = int(input())
x = [0]*n
l = [0]*n
for i in range(n):
    x[i], l[i] = map(int, input().split())
print(solve(n, x, l))

### FIXED CODE ###

def solve(n, x, l):
    p = sorted([(a+b, a-b) for a, b in zip(x, l)])
    _, th = p[0]
    best = 0
    for t, s in p:
        if th <= s:
            best += 1
            th = t
    return best

n = int(input())
x = [0]*n
l = [0]*n
for i in range(n):
    x[i], l[i] = map(int, input().split())
print(solve(n, x, l))
while True:
(a, op, b) = [int(i) if i.isdigit() else i for i in input().split()]

if op == '?':
    break
elif op =='+':
    print(a + b)
elif op == '-':
    print(a - b)
elif op == '*':
    print(a * b)
elif op == '/':
    print(a // b)

### FIXED CODE ###

while True:
    (a, op, b) = [int(i) if i.isdigit() else i for i in input().split()]
    if op == '?':
        break
    elif op =='+':
        print(a + b)
    elif op == '-':
        print(a - b)
    elif op == '*':
        print(a * b)
    elif op == '/':
        print(a // b)
N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
if len(a) >= 3:
    b = [x for x in a[:-2] if (x % a[-1] != 0 and x != a[-1]) and (x % a[-2] != 0 and x != a[-2])]
    b += a[-2:]

N = len(b)
count = 0
for i in range(len(b)):
    for j, k in enumerate(b[i+1:]):
        if b[i] % k == 0:
            break
        elif j+i == N-2:
            count += 1
if b[-1] != b[-2]:
    count += 1
print(count)


### FIXED CODE ###

N = int(input())
A = sorted(list(map(int, input().split())))
M = A[-1]
b = [True]*(M + 1)

count = 0
for i, a in enumerate(A):
    if not b[a]:
        continue
    for j in range(a, M+1, a):
        b[j] = False
    if i < N-1 and A[i+1] == a:
        continue
    count += 1

print(count)
def main() :
    n = int(input())
    nums = [int(i) for i in input().split()]
    exchange_count = 0

    for i in range(n) :
        minj = i
        for j in range(i, n) :
            if nums[j] < nums[minj] :
                minj = j
        if minj != i :
                exchange_count += 1
        nums[i], nums[minj] = nums[minj], nums[i]

    print(" ".join(map(str, nums)))
    print(exchage_count)

if __name__ == '__main__' :
    main()

### FIXED CODE ###

def main() :
    n = int(input())
    nums = [int(i) for i in input().split()]
    exchange_count = 0

    for i in range(n) :
        minj = i
        for j in range(i, n) :
            if nums[j] < nums[minj] :
                minj = j
        if minj != i :
                exchange_count += 1
        nums[i], nums[minj] = nums[minj], nums[i]

    print(" ".join(map(str, nums)))
    print(exchange_count)

if __name__ == '__main__' :
    main()
def main()
    import sys
    input = sys.stdin.readline

    INF = 10 ** 18

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

    dp = [INF] * (H + 1)
    dp[0] = 0

    for i in range(N):
        A, B = map(int, input().split())
        for j in range(H + 1):
            if j < A:
                dp[j] = min(dp[j], dp[0] + B)
            else:
                dp[j] = min(dp[j], dp[j - A] + B)
        
    print (dp[H])

    # for d in dp:
    #     print (d)

if __name__ == '__main__':
    main()

### FIXED CODE ###

INF = 10 ** 18


H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

dp = [[INF] * (H + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
    for j in range(H + 1):
        if j < AB[i][0]:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][0] + AB[i][1])
        else:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - AB[i][0]] + AB[i][1])
    
print (dp[N][H])

# for d in dp:
#     print (d)
from collections import defaultdict
import sys
import time

sys.setrecursionlimit(2000)
N, M, K = [int(i) for i in input().split(" ")]

class UnionNode():
    def __init__(self, number):
        self.number = number
        self.volume = 1
        self.master = None

    @property
    def rootnum(self):
        return self.root.number

    @property
    def root(self):
        if self.master:
            return self.master.root
        else:
            return self


    def same(self, target):
        if self.root == target.root:
            return True
        else:
            return False

    def unite(self, target):
        seroot = self.root
        taroot = target.root
        if seroot.number == taroot.number:
            pass
        else:
            #print(f"unite {target.rootnum}({target.root.volume}), {self.rootnum}({self.root.volume})")
            if seroot.number < taroot.number:
                seroot.volume += taroot.volume
                taroot.master = seroot
            else:
                taroot.volume += seroot.volume
                seroot.master = taroot

nodes = [UnionNode(i) for i in range(N)]

outlist = defaultdict(lambda :[])

for i in range(M):
    s = input()
    a, b = s.split(" ")
    a = int(a) - 1
    b = int(b) - 1
    nodes[a].unite(nodes[b])
    outlist[a].append(b)
    outlist[b].append(a)

for i in range(K):
    s = input()
    a, b = s.split(" ")
    a = int(a) - 1
    b = int(b) - 1
    outlist[a].append(b)
    outlist[b].append(a)

result = []
for i in range(N):
    node = nodes[i]
    ret = node.root.volume - 1
    for out in outlist[i]:
        if nodes[out].rootnum == node.rootnum:
            ret -=1
    result.append(ret)

#for i in range(100):
#    print(result[i])

print(" ".join([str(i) for i in result]))

### FIXED CODE ###


a = int(input()) + 1
print(int(a/2))
N = int(input())
XD = [[int(i) for i in input().split()] for _ in range(N)]
XD.sort()
MOD = 998244353
sorted_X = [X for X,_ in XD]

edge = [[] for _ in range(N)]

from bisect import bisect_left

parent = [-1] * N

for i in range(N-1, -1, -1):
    idx = bisect_left(sorted_X, XD[i][0] + XD[i][1])
    for j in range(i+1, idx):
        if parent[j] < 0:
            parent[j] = i

for i,par in enumerate(parent):
    if par < 0:
        continue
    edge[par].append(i)

def cnt(node):
    if not edge[node]:
        return 2
    
    res = 1
    for v in edge[node]:
        res = (res * cnt(v)) % MOD
    res += 1

    return res % MOD

ans = 1
for i,par in enumerate(parent):
    if par < 0:
        ans = (ans * cnt(i)) % MOD

print(ans)

### FIXED CODE ###

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

N = int(input())
XD = [[int(i) for i in input().split()] for _ in range(N)]
XD.sort()
MOD = 998244353

def make():
    edge = [[] for _ in range(N)]
    parent = [-1] * N
    MAXIDX = N
    sorted_X = [X for X,_ in XD]
    for i in range(N-1, -1, -1):
        idx = bisect_left(sorted_X, XD[i][0] + XD[i][1])
        for j in range(i+1, min(idx, MAXIDX)):
            if parent[j] < 0:
                parent[j] = i
        if idx >= MAXIDX:
            MAXIDX = i + 1
    for i,par in enumerate(parent):
        if par < 0:
            continue
        edge[par].append(i)
    
    return parent, edge

parent, edge = make()

def cnt(node):
    if not edge[node]:
        return 2

    res = 1
    for v in edge[node]:
        res = (res * cnt(v)) % MOD
    res += 1

    return res % MOD

def main():
    ans = 1
    for i,par in enumerate(parent):
        if par < 0:
            ans = (ans * cnt(i)) % MOD

    print(ans)

if __name__ == "__main__":
    main()
matrix = [[], [], []]
for row in matrix:
    for i in range(3):
        row.append(input())
print(matrix)
print(matrix[0][0] + matrix[1][1] + matrix[2][2])

### FIXED CODE ###

row1 = input()
row2 = input()
row3 = input()
print(row1[0]+row2[1]+row3[2])
a,b = map(int, input().split())
x = a//b
y = a%b
g = a/b
print("{0} {1} {2:.5f}", format(x,y,g))

### FIXED CODE ###

a,b = map(int, input().split())
x = a//b
y = a%b
g = a/b
print("{0} {1} {2:.5f}".format(x,y,g))
#!/usr/bin/env python3

n, l = map(int, input().split())
s = []

for _ in range(n):
    s.append(str(input()))

print(''.join(sorted(s)))

### FIXED CODE ###

#!/usr/bin/env python3

import sys
  
if sorted(sys.stdin.readline().split()) == ['5', '5', '7']:
  print('YES')
else:
  print('NO')
alpha = [-1]
alpha.extend([chr(ord('a') + i) for i in range(26)])
q = N
mod = N
ans = ''
while q >= 27:
    q, mod = divmod(q, 26)
    ans = alpha[mod] + ans
if mod != 0:
    ans = alpha[q] + ans
print(ans)


### FIXED CODE ###

# 自力では解けなかった(2020.7.6)

alpha = ['Z']
alpha.extend([chr(ord('a') + i) for i in range(26)])
N = int(input())
q = N
ans = ''
while True:
    if q <= 26:
        ans += str(alpha[q])
        break
    else:
        q, mod = divmod(q, 26)
        if mod == 0:
            q -= 1
            mod = 26
        ans += str(alpha[mod])

print(ans[::-1])
N = int(input())

ans = ""
alphabet = {i+1:chr(ord("a") + i) for i in range(26)}
while N != 0:

    a, r = N//26, N%26
    # print(a,r)
    ans = alphabet[r] + ans
    N = N//26

print(ans)


### FIXED CODE ###

N = int(input())

ans = ""
while N > 0:

    N -= 1

    q, r = N//26, N%26

    ans += chr(ord("a") + r)

    N = q

print(ans[::-1])
def B()
  S = input()
  T = input()
  count=0
  for i in range(len(S)):
    if S[i]!=T[i]:
    count = count+1
print(count)
B()

### FIXED CODE ###

#172B
def B():
    s = input()
    t = input()
    count = 0
    for i in range(len(s)):
        if s[i] != t[i]:
            count += 1
    print(count)
B()
k = int(input())
x = 7%k
s = set()
while s.count(x) == 0:
  s.append(x)
  x = (10*x + 7)%k

if s[-1] == 0:
  print(len(s))
else:
  print(-1)
  

### FIXED CODE ###

k = int(input())
x = 7%k
s = []

for i in range(k):
  if x == 0:
    print(i+1)
    exit()
  s.append(x)
  x = (10*x + 7)%k

  
  
print(-1)
def sort_2(a,b):
    if b<a:
        c=a
        a=b
        b=c
    return [a,b]


def GCDbase(a,b):
    D=b//a
    if b==D*a:
        return a
    else:
        return GCD(b-a*D,a)
    
def GCD(a,b):
    ab=sort_2(a,b)
    return GCDbase(ab[0],ab[1])
    
    

K=int(input())
sum=0
for i in range(1,K+1):
    for j in range(1,K+1):
	tmp=GCD(i,j)
        for l in range(1,K+1):
            sum+=GCD(tmp,l)
print(sum)

### FIXED CODE ###

N=input()
a=int(N)//100
b=(int(N)-a*100)//10
c=int(N)-100*a-10*b
A=(a==7)
B=(b==7)
C=(c==7)
if A==True or B==True or C==True:
    print("Yes")
else:
    print("No")
n=int(input())
l=[tuple(map(int,input().split()))for i in range(n)]
s=l[0]
l2=[[x,y,s[2]+abs(x-s[0])+abs(y-s[1])]for y in range(101)for x in range(101)]
for s in l2.copy():
    for t in l:
        if s[2]!=t[2]+abs(s[0]-t[0])+abs(s[1]-t[1]):
            try:
                l2.remove(s)
            except:
                continue
print(*l2[0])

### FIXED CODE ###

n=int(input())
l=[]
for i in range(n):
    a,b,c=map(int,input().split())
    l.append((a,b,c))
    if c>0:
        x,y,h=a,b,c
ma=len(l)
for s in range(101):
    for t in range(101):
        x2,y2,h2=s,t,h+abs(x-s)+abs(y-t)  #候補点
        c=0
        if all(h3==max(h2-abs(x3-x2)-abs(y3-y2),0)for(x3,y3,h3)in l):
            print(x2,y2,h2)
            exit()
print(-1,-1,-1)
S = input()

x = len(S)-1

s = 0
for i in range(1 << x):
    t = 0
    for j in range(x):
        if ((i >> j) & 1 == 1):
            s += int(''.join(s[t:j+1]))
            t = j+1
    s += int(''.join(s[t:]))
print(s)

### FIXED CODE ###

S = input()

x = len(S)-1

s = 0
for i in range(1 << x):
    t = 0
    for j in range(x):
        if ((i >> j) & 1 == 1):
            s += int(''.join(S[t:j+1]))
            t = j+1
    s += int(''.join(S[t:]))
print(s)
a = int(input(''))
b = int(input(''))
c = int(input(''))
d = int(input(''))
e = int(input(''))
list_i = [a,b,c,d,e]

list_m = map(lambda x : 10 - x % 10 ,list_i)
list_i = [x + y if x !=10 else y for (x,y) in zip(list_m,list_i)]
list_v = filter(lambda x : x != 10 , list_m)
print sum(list_i) - max(list(list_v))

### FIXED CODE ###

a = int(input(''))
b = int(input(''))
c = int(input(''))
d = int(input(''))
e = int(input(''))
list_i = [a,b,c,d,e]
 
min_n = list_i[0] % 10
v = 0
count = 0
 
for i in range(len(list_i)):
 if list_i[i] % 10 < min_n and list_i[i] % 10 != 0:
  count = i
 
for i in range(len(list_i)):
 if i == count or list_i[i] % 10 == 0:
  v = v + list_i[i]
 else:
  v = v + list_i[i] + ( 10 - list_i[i] % 10)
 
print v
N,K = map(int,input().split())
ans = 0
temp_max = N
temp_min = 0
for i in range(K,N+2):
  temp_max += N-i+1
  temp_min += i-1
  ans += temp_max - temp_min + 1
print(ans%(10**9+7)

### FIXED CODE ###

N,K = map(int,input().split())
ans = 0
temp_max = 0
temp_min = 0
for i in range(1,N+2):
  temp_max += N-i+1
  temp_min += i-1
  if i  >= K:
    ans += (temp_max - temp_min + 1)
print(ans%(10**9+7))
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    MOD = 2 ** 31 - 1
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N = NI()
    cnt = collections.Counter()
    ans = 0
    C = []
    for _ in range(N):
        s = SI()
        a = []
        bit = 0
        for x in s:
            x = ord(x) - ord('a')
            bit |= 1 << x
            a.append(bit)
        for i in range(len(s),-1,-1):
            if i == len(s):
                c = 0
            else:
                c = (c * 27 + ord(s[i]) - ord('a') + 1) % MOD
            if i > 0:
                d = c * 27
                for j in range(26):
                    if a[i-1] & (1<<j) and i < 0:
                        cnt[(d+j+1)%MOD] += 1
        C.append(c)
    for c in C:
        ans += cnt[c] - 1

    print(ans)
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():

    N = int(input())
    d = [[0] * 19 for _ in range(19)]
    c = []
    for _ in range(N):
        x = round(float(input()) * 10**9)
        d2 = 0
        d5 = 0
        while x % 2 == 0 and d2 < 18:
            x //= 2
            d2 += 1
        while x % 5 == 0 and d5 < 18:
            x //= 5
            d5 += 1
        d[d2][d5] += 1

    a = [[0] * 19 for _ in range(19)]
    for i in range(18,-1,-1):
        s = 0
        for j in range(18,-1,-1):
            s += d[i][j]
            a[i][j] = s
            if i < 18:
                a[i][j] += a[i+1][j]

    ans = 0
    for i in range(19):
        for j in range(19):
            ans += d[i][j] * a[18-i][18-j]
            if i >= 9 and j >=9:
                ans -= d[i][j]


    print(ans//2)


if __name__ == '__main__':
    main()
import sys
sys.setrecursionlimit(10**9)
from collections import Counter
input = sys.stdin.readline

S=input[:-1]
C=Counter(S)
if all([v==2 for key,v in C.items()]):
    print("Yes")
else:
    print("No")

    


### FIXED CODE ###

from collections import Counter
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

S = input()[:-1]
C = Counter(S)
if all([v == 2 for key, v in C.items()]):
    print("Yes")
else:
    print("No")
import sys
input = sys.stdin.readline
N, W = map(int, input().split())
wv = [list(map(int,input().split())) for i in range(N)]

wv.sort()
wv.reverse()

dp = [[0]*(W+1) for i in range(N+1)]

for i, x in enumerate(wv,1):
    w = x[0]
    v = x[1]
    for j in range(w,W+1):
        dp[i][j] = max(dp[i-1][j],dp[i-1][j-w]+v)
        
print(dp[N][W])

### FIXED CODE ###

import sys
input = sys.stdin.readline
N, W = map(int, input().split())
w = [0]*N
v = [0]*N
for i in range(N):
    w[i], v[i] = map(int,input().split())

n = (N+1)*max(v)

inf = 10**14

dp = [[inf]*n for i in range(N+1)]
dp[0][0] = 0

for i in range(N):
    dp[i+1][0] = 0
    for j in range(n-2,0,-1):
        dp[i+1][j] = min(dp[i+1][j+1], dp[i][j], dp[i][j-v[i]]+w[i])

ans = 0
for i in range(n):
    if dp[N][i] <= W:
        ans = i
    else:
        break

print(ans)
D, G = map(int, input().split()) 
S = [[int(x) for x in input().split()]for i in range(D)]
Minimum_can = []
for i in range(2**D-1):
    binary = str(format(i,'b'))
    binary_zero = binary.zfill(D)
    SUM = 0
    Number = 0
    for j in range(D):
        if binary_zero[j]=='1':
            SUM += S[j][0]*100*(j+1)+S[j][1]
            Number += S[j][0]
    if SUM == G: Minimum_can.append(Number)        
    elif SUM < G:
        Biggest_0_number = 0
        for k in range(D):
            if binary_zero[D-k-1]=='0':
                Biggest_0_number = D-k-1
                break
        for k in range(S[Biggest_0_number][0]):
            if SUM+100*(Biggest_0_number+1)*(k+1) >= G:
                Minimum_can.append(Number+k+1)
                break 
print(min(Minimum_can))


### FIXED CODE ###

D, G = map(int, input().split()) 
S = [[int(x) for x in input().split()]for i in range(D)]
Minimum_can = []
for i in range(2**D):
    binary = str(format(i,'b'))
    binary_zero = binary.zfill(D)
    SUM = 0
    Number = 0
    for j in range(D):
        if binary_zero[j]=='1':
            SUM += S[j][0]*100*(j+1)+S[j][1]
            Number += S[j][0]
    if SUM >= G: Minimum_can.append(Number)        
    elif SUM < G:
        Biggest_0_number = 0
        for k in range(D):
            if binary_zero[D-k-1]=='0':
                Biggest_0_number = D-k-1
                break
        for k in range(S[Biggest_0_number][0]):
            if SUM+100*(Biggest_0_number+1)*(k+1) >= G:
                Minimum_can.append(Number+k+1)
                break 
print(min(Minimum_can))
N = int(input())
T, D = {i: [] for i in range(N)}, [-1] * N
for _ in range(N - 1):
    a, b, c = map(int, input().split())
    T[a - 1].append((b - 1, c))
    T[b - 1].append((a - 1, c))


def dfs(p, c, d):
    D[c] = d
    for c2, d2 in T[c]:
        if c2 != p:
            dfs(c, c2, d + d2)


Q, K = map(int, input().split())
dfs(-1, K - 1, 0)
for _ in range(Q):
    x, y = map(int, input().split())
    print(D[x - 1] + D[y - 1])


### FIXED CODE ###

N = int(input())
neig = [[] for _ in range(N)]

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

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

S, D = [(K - 1, K - 1)], [0] * N
while len(S) > 0:
    p, pp = S.pop()
    for c, d in neig[p]:
        if not c == pp:
            D[c] = D[p] + d
            S.append((c, p))

for _ in range(Q):
    x, y = map(int, input().split())
    print(D[x - 1] + D[y - 1])
import sys

n, m = list(map(int, input().split()))
ar = [list(map(int, input().split())) for _ in range(m)]
ans = [0 for _ in range(n)]

for a in ar:
    if a[0] == 1 and a[1] == 0:
        print(-1)
        sys.exit()
    if ans[a[0] - 1] != 0 and ans[a[0] - 1] != a[1]:
        print(-1)
        sys.exit()
    ans[a[0] - 1] = a[1]

if ans[0] == 0:
    if ans[1] == 0:
        ans[1] = 1
    ans[0] = 1

ans = int("".join(map(str, ans)))
print(ans)


### FIXED CODE ###

import math

n, m = map(int, input().split(" "))

ans = list([0 for _ in range(n)])

err = False
for i in range(m):
    s, c = map(int, input().split(" "))
    if s == 1 and c == 0:
        if n == 1:
            print(0)
            exit()
        err = True
    elif ans[s - 1] == 0:
        ans[s - 1] = c
    elif not ans[s - 1] == c:
        err = True

if ans[0] == 0:
    ans[0] = 1

if (n == 1 and ans[0] == 0) or (n == 1 and m == 0):
    print(0)
    exit()

if err:
    print(-1)
    exit()

print("".join(map(str, ans)))
from collections import deque

(d,), cc, *sstt = [list(map(int, s.split())) for s in open(0)]

ss = sstt[:d]

tt = sum(sstt[d:], [])

print(sum(ss[i][t] for (i, t) in enumerate(tt)))

### FIXED CODE ###

(d,), cc, *sstt = [list(map(int, s.split())) for s in open(0)]

ss = sstt[:d]

tt = list(map(lambda x: x-1, sum(sstt[d:], [])))

comp = [0]*len(cc)

ans = 0

for i in range(d):
    comp = [sum(x) for x in zip(comp, cc)]
    t = tt[i]
    ans += ss[i][t]
    comp[t] = 0
    ans -= sum(comp)
    print(ans)