Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

#input
K = int(input())
S = str(input())

#output
# (o以外) o (o以外) o (f以外) f (何でも)

#こちらもmodで割った余り。maxが決まっていて、大きくない時はこちらが早い。
mod = pow(10, 9) + 7

n_ = 5 * pow(10, 6)
fun = [1] * (n_+1)
for i in range(1, n_+1):
    fun[i] = fun[i-1] * i % mod
rev = [1] * (n_+1)
rev[n_] = pow(fun[n_], mod-2, mod)
for i in range(n_-1, 0, -1):
    rev[i] = rev[i+1] * (i+1) % mod
def cmb(n,r):
    if n <= 0 or r < 0 or r > n: return 0
    return fun[n] * rev[r] % mod * rev[n-r] % mod

#重複組み合わせはH(n, r) = cmb(n+r-1, r)

L = len(S)
answer = 0
for i in reversed(range(K+1)):
    answer += pow(25, K-i, mod) * pow(26, i, mod) * cmb(L+K-1-i, L-1)
    answer %= mod
print(answer)

### FIXED CODE ###

#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()

#input
K = int(input())
S = str(input())

#output
# (o以外) o (o以外) o (f以外) f (何でも)

#こちらもmodで割った余り。maxが決まっていて、大きくない時はこちらが早い。
mod = pow(10, 9) + 7

n_ = 5 * pow(10, 6)
fun = [1] * (n_+1)
for i in range(1, n_+1):
    fun[i] = fun[i-1] * i % mod
rev = [1] * (n_+1)
rev[n_] = pow(fun[n_], mod-2, mod)
for i in range(n_-1, 0, -1):
    rev[i] = rev[i+1] * (i+1) % mod
def cmb(n,r):
    if n < 0 or r < 0 or r > n: return 0
    return fun[n] * rev[r] % mod * rev[n-r] % mod

#重複組み合わせはH(n, r) = cmb(n+r-1, r)

L = len(S)
answer = 0
for i in range(L, L+K+1):
    answer += pow(25, i-L, mod) * pow(26, L+K-i, mod) * cmb(i-1, L-1)
    answer %= mod
print(answer)
### BUGGY CODE ###

#coding:utf-8
import sys
sys.setrecursionlimit(2**31-1)
input = sys.stdin.readline
write = sys.stdout.write
LMIIS = lambda : list(map(int,input().split()))
II = lambda : int(input())
dbg = lambda *something : print(*something) if DEBUG is True else 0
DEBUG = True

def main():
    X,Y,Z,K = LMIIS()
    A = LMIIS()
    B = LMIIS()
    C = LMIIS()
    
    # A.sort(reverse=True)
    # B.sort(reverse=True)
    # C.sort(reverse=True)
    
    h = []
    from heapq import heappush,heappop
    for a in A:
        for b in B:
            for c in C:
                heappush(h,-(a+b+c))
    for _ in range(K):
        print(-heappop(h))
    # A.append(0)
    # B.append(0)
    # C.append(0)

    # # ai = bi = ci = 0

    # # for i in range(min(3000,X*Y*Z)):
    # #     print(A[ai],B[bi],C[ci])
    # #     print(A[ai]+B[bi]+C[ci])
    # #     nextai = ai + 1 if ai < X else ai
    # #     nextbi = bi + 1 if bi < Y else bi
    # #     nextci = ci + 1 if ci < Z else ci

    # #     #aiを更新する場合
    # #     if  A[nextai] >= B[nextbi]:
    # #         if A[nextai] >= C[nextci]:
    # #             ai = nextai
    # #         else:
    # #             ci = nextci
    # #     else:
    # #         if B[nextbi] >= C[nextci]:
    # #             bi = nextbi
    # #         else:
    # #             ci = nextci






    pass
if __name__ == '__main__':
    main()

### FIXED CODE ###

#coding:utf-8
import sys
sys.setrecursionlimit(2**31-1)
input = sys.stdin.readline
write = sys.stdout.write
LMIIS = lambda : list(map(int,input().split()))
II = lambda : int(input())
dbg = lambda *something : print(*something) if DEBUG is True else 0
DEBUG = True

def main():
    X,Y,Z,K = LMIIS()
    A = LMIIS()
    B = LMIIS()
    C = LMIIS()
    

    AB = []
    for a in A:
        for b in B:
            AB.append(a+b)
    
    AB.sort(reverse=True)

    ABC = []
    for ab in AB[:K]:
        for c in C:
            ABC.append(ab+c)
    ABC.sort(reverse=True)
    for i in range(K):
        print(ABC[i])

    pass
if __name__ == '__main__':
    main()
### BUGGY CODE ###

n = int(input())

import math

ans = float('inf')
def calc(x,cnt):
    if x<6:
        global ans
        ans = min(ans,x+cnt)
    else:
        c = 6**int(math.log(x,6))
        if c*6==x:c*=6
        calc(x-c,cnt+1)
        c = 9**int(math.log(x,9))
        if c*9==x:c*=9
        calc(x-c,cnt+1)

calc(n,0)

print(ans)


### FIXED CODE ###

n = int(input())
ans = n
for i in range(n+1):
    c = 0
    t = i
    while t>0:
        c+=t%6
        t //= 6
    t = n-i
    while t>0:
        c+=t%9
        t //= 9
    ans = min(ans,c)
print(ans)
### BUGGY CODE ###

N,M = map(int,input().split())
A = M//N
flag = False
if (M == 999999999 and N <= 20):
  print(37037037)
else:
  for i in range(1,A+1):
    if (M%(A+1-i) == 0):
      flag = True
      break
  if flag:
    print(A+1-i)

### FIXED CODE ###

import math

N,M = map(int,input().split())
A = M//N
L = []
for i in range(1,int(math.sqrt(M))+1):
  if (M%i == 0 and i <= A):
    L.append(i)
    if (M//i <= A):
      L.append(M//i)
print(max(L))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
N = int(input())
X = input()
X_10 = int(X, 2)
popcount_X = X.count("1")
popcount_X_plus = popcount_X + 1
popcount_X_minus = popcount_X - 1
f_plus = X_10 % popcount_X_plus
f_minus = X_10 % popcount_X_minus if popcount_X_minus != 0 else 0

def popcount(n):
  return bin(n).count("1")

def f(n):
  if n == 0:
    return 0
  return n % popcount(n)

for i in range(N):
  j = N - (i + 1)
  n = 0
  ans = 1
  
  if X[i] == '0':
    n = (f_plus + (2**j % popcount_X_plus)) % popcount_X_plus
#    n = (f_plus + pow(2, j, popcount_X_plus)) % popcount_X_plus
  else:
    if popcount_X_minus == 0:
      print(0)
      continue
    else:
      n = (f_minus - (2**j % popcount_X_minus) + popcount_X_minus) % popcount_X_minus
#      n = (f_minus - pow(2, j, popcount_X_minus) + popcount_X_minus) % popcount_X_minus
  
  while n > 0:
    n = f(n)
    ans += 1
  print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
X = input()
X_10 = int(X, 2)
popcount_X = X.count("1")
popcount_X_plus = popcount_X + 1
popcount_X_minus = popcount_X - 1
f_plus = X_10 % popcount_X_plus
f_minus = X_10 % popcount_X_minus if popcount_X_minus != 0 else 0

def popcount(n):
  return bin(n).count("1")

def f(n):
  if n == 0:
    return 0
  return n % popcount(n)

for i in range(N):
  j = N - (i + 1)
  n = 0
  ans = 1
  
  if X[i] == '0':
#    n = (f_plus + (2**j % popcount_X_plus)) % popcount_X_plus
    n = (f_plus + pow(2, j, popcount_X_plus)) % popcount_X_plus
  else:
    if popcount_X_minus == 0:
      print(0)
      continue
    else:
#      n = (f_minus - (2**j % popcount_X_minus) + popcount_X_minus) % popcount_X_minus
      n = (f_minus - pow(2, j, popcount_X_minus) + popcount_X_minus) % popcount_X_minus
  
  while n > 0:
    n = f(n)
    ans += 1
  print(ans)
### BUGGY CODE ###

import numpy as np
L, R = list(map(int, input().split(' ')))
t = [i for i in range(L, R+1)]
s = t[0] % 2019
x = []
x.append(s)
for i in range(1, len(t)):
    m = t[i] % 2019
    if s == m:
        break
    x.append(m)
min_v = 2018
for i in range(0, len(x)-1):
    tmp = np.amin(np.mod([x[i]*x[j] for j in range(i+1, len(x))], 2019))
    if tmp < min_v:
        min_v = tmp

print(min_v)

### FIXED CODE ###

import numpy as np
L, R = list(map(int, input().split(' ')))
x = []
x.append(L % 2019)
for i in range(L+1, R+1):
    m = i % 2019
    if x[0] == m:
        break
    x.append(m)
    
min_v = 2018
for i in range(0, len(x)-1):
    tmp = np.amin(np.mod([x[i]*x[j] for j in range(i+1, len(x))], 2019))
    if tmp < min_v:
        min_v = tmp

print(min_v)
### BUGGY CODE ###

N, K = map(int, input().split())
List = list(map(int, input().split()))
List.sort()
List.reverse()
ans=0

if len(List) == K-1:
    print(0)
    quit()

def Check(List,ans):
    if sum(List) <= 0:
        print(ans)
        quit()

#print(List)

List=List[K:]

Check(List,ans)

j=0
while 1==1:
    ans+=List[j]
    List[j]=0
    Check(List,ans)
    j+=1
    

### FIXED CODE ###

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

h.sort(reverse=True)
for i in range(0,min(k,len(h))):
    h[i] = 0
hp = 0
for j in range(k,n):
    hp += h[j]

print(hp)
### BUGGY CODE ###

from itertools import permutations
import collections
N = int(input())
nums = list(map(int, input().split()))
odd_nums = []
even_nums = []
for i, num in enumerate(nums):
    if i % 2 == 1:
        even_nums.append(num)
    else:
        odd_nums.append(num)

useable_nums = set(nums)
even_length = len(even_nums)
odd_length = len(odd_nums)
even_counter = collections.Counter(even_nums)
odd_counter = collections.Counter(odd_nums)
# print(even_counter)  # 偶数
# print(odd_counter)  # 奇数
inf = float('inf')
min_ans = inf
if len(useable_nums) == 1:
    useable_nums.add(0)
useable_permutaions = list(permutations(useable_nums, 2))
# print(useable_permutaions)

for permutation in useable_permutaions:
    ans = 0
    if permutation[0] in odd_counter:
        ans += odd_length - odd_counter[permutation[0]]
    else:
        ans += odd_length
    if permutation[1] in even_counter:
        ans += even_length - even_counter[permutation[1]]
    else:
        ans += even_length
    min_ans = min(min_ans, ans)

print(min_ans)


### FIXED CODE ###

from itertools import permutations
import collections
N = int(input())
nums = list(map(int, input().split()))
odd_nums = []
even_nums = []
for i, num in enumerate(nums):
    if i % 2 == 1:
        even_nums.append(num)
    else:
        odd_nums.append(num)

useable_nums = set(nums)
even_length = len(even_nums)
odd_length = len(odd_nums)
even_counter = collections.Counter(even_nums).most_common()
odd_counter = collections.Counter(odd_nums).most_common()
even_counter.append((0, 0))
odd_counter.append((0, 0))
even_counter.sort(key=lambda x: x[1], reverse=True)
odd_counter.sort(key=lambda x: x[1], reverse=True)
# print(even_counter)
# print(odd_counter)


min_ans = None
if even_counter[0][0] == odd_counter[0][0]:
    min_ans = min((odd_length - odd_counter[0][1]) + (even_length - even_counter[1][1]),
                  (odd_length - odd_counter[1][1]) + (even_length - even_counter[0][1]))
else:

    min_ans = odd_length - odd_counter[0][1] + even_length - even_counter[0][1]
print(min_ans)
### BUGGY CODE ###

N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))

res = []
for i in range(1 << N):
  X = Y = 0
  for j in range(N):
    if ((i >> j) & 1):
      X += V[j]
      Y += C[j]
  res.append(X-Y)
print(max(res))

### FIXED CODE ###

def ans():
  N = int(input())
  V = list(map(int,input().split()))
  C = list(map(int,input().split()))
  ans = 0
  for i in range(N):
    if V[i] > C[i]:
      ans += V[i] - C[i]
  print(ans)

ans()
### BUGGY CODE ###

from operator import itemgetter

def main():
    n = int(input())
    keys = []
    for i in xrange(n):
        keys.append(map(int,raw_input().split())+[i])

    T = Tree()
    T.recursive_add_Node(keys,0)

    q = int(input())
    for i in xrange(q):
        sx, tx, sy, ty = map(int,raw_input().split())
        nums = []
        find(T.root,[sx,sy],[tx,ty],0,nums)
        nums.sort()
        for i in nums:
            print i
        print ""
        

def find(z,s,t,d,nums):
    if(s[0]<=z.key[0]<=t[0])and(s[1]<=z.key[1]<=t[1]):
        nums.append(z.num)

    d += 1
    if (z.left != None)and(z.key[d%2]>=s[d%2]):
        find(z.left,s,t,d,nums)
    if (z.right != None)and(z.key[d%2]<=t[d%2]):
        find(z.right,s,t,d,nums)


class Tree():
    def __init__(self):
        self.root = None

    def add_Node(self,k,n):
        y = None
        x = self.root
        d = 0
        while(x != None):
            d += 1
            y = x
            if x.key[d%2] > k[d%2]:
                x = x.left
            else:
                x = x.right
        
        z = Node(k,n)
        z.parent = y
        z.depth  = d

        if y == None:
            self.root = z
        elif y.key[d%2] > k[d%2]:
            y.left = z
        else:
            y.right = z
        
    def recursive_add_Node(self,keys,depth):
        keys.sort(key=itemgetter(depth%2))
        id_mean = len(keys)/2
        self.add_Node(keys[id_mean][:2],keys[id_mean][2])

        keys_l = keys[:id_mean]
        keys_r = keys[id_mean+1:]
       
        if keys_l:
            self.recursive_add_Node(keys_l,depth+1)
        if keys_r:
            self.recursive_add_Node(keys_r,depth+1)

class Node():
    def __init__(self,k,n):
        self.key    = k
        self.num    = n
        self.depth  = None
        self.parent = None
        self.left   = None
        self.right  = None
    


if __name__ == "__main__":
    main()

### FIXED CODE ###

from sys import stdin,stdout
import math
from operator import itemgetter
from bisect import bisect_left, bisect_right
readline = stdin.readline
 
def main():
    n = int(input())
    keys = map(lambda i: map(int,readline().split())+[i], xrange(n))
    keys.sort()

    root = int(math.sqrt(len(keys)))
 
    low = [x for x, y, i in keys[::root]]
    high = [x for x, y, i in keys[root - 1::root]] + [float('inf')]
 
    keys = [sorted(keys[i:i+root], key=itemgetter(1)) for i in range(0,len(keys),root)]
    keys_y = map(lambda k:[y for x,y,i in k], keys)

    q = int(input())
    for i in xrange(q):
        sx,tx,sy,ty = map(int,readline().split())
        
        nums = []
        for i in range(bisect_left(high, sx), bisect_right(low, tx)):
            y = keys_y[i]
            for j in range(bisect_left(y, sy), bisect_right(y, ty)):
                if sx <= keys[i][j][0] <= tx:
                    nums.append(keys[i][j][2])
        if nums:
            nums.sort()
            map(lambda n:stdout.write("{}\n".format(n)), nums)
        print("")

if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys
import math

def isPrime(n):
    if n < 2:
        return False
    elif n == 2:
        return True

    if n % 2 == 0:
        return False

    for i in range(3,math.ceil(math.sqrt(n))+1):
         if n % i == 0:
            return False
    return True

for line in sys.stdin:
    n = int(line)
    count = 0
    for i in range(2,n+1):
        if isPrime(i):
            count += 1
    print(count)

### FIXED CODE ###

import sys
prime = [0]
isPrime = [1 for i in range(1000000)]
isPrime[0] = 0
isPrime[1] = 0
for i in sys.stdin:
    n = int(i)
    if prime[len(prime)-1] < n:
        for i in range(prime[len(prime)-1]+1,n+1):
            if isPrime[i] == 1:
                prime.append(i)
                for j in range(i*2, 1000000, i):
                    isPrime[j] = 0
    print(sum(isPrime[:n+1]))
### BUGGY CODE ###

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


def f(b):
    sum_num = 0
    for x, num in enumerate(nums, 1):
        sum_num += abs(num - (b + x))

    return sum_num


maximum = max(nums)

minimum = 10000000
for i in range(-1 * maximum, maximum + 1):
    calc = f(i)
    if minimum > calc:
        minimum = calc
        ans = calc

print(ans)



### FIXED CODE ###

from statistics import median
n = int(input())
nums = list(map(int, input().split()))
bs = nums.copy()
tmp = 0

for i in range(n):
    bs[i] -= i + 1


med = median(bs)

ans = 0
for i in range(n):
    ans += abs(bs[i] - med)

print(int(ans))
### BUGGY CODE ###

import sys


sys.setrecursionlimit(10 ** 7)

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

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


E = sorted(E, key=lambda x: x[0])

damage = 0
BOMB = {}
x = 0
ans = 0
for i in range(N):
    x, h = E[i]

    dlt = []
    for xd, d in BOMB.items():
        if x > xd:
            damage -= d
            dlt.append(xd)
    for dl in dlt:
        BOMB.pop(dl)

    h -= damage

    if h <= 0:
        continue
    xm = x + 2 * D
    cnt = -1 * (-h // A)
    damage += cnt * A
    BOMB[xm] = cnt * A
    ans += cnt

print(ans)


### FIXED CODE ###

import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)

N, D, A = map(int, input().split())
E = []
for _ in range(N):
    x, h = map(int, input().split())
    E.append((x, h))
    E.append((x+2*D, 0))

E = sorted(E, key=lambda x: (x[0], -x[1]))

for i in range(len(E)-1, -1, -1):
    x, h = E[i]
    if h != 0:
        xmax = x
        break

bomb = defaultdict(int)
damage = 0
ans = 0
for i in range(len(E)):
    x, h = E[i]

    if x > xmax:
        break

    # x+2D: damageをマイナス
    if h == 0:
        damage -= bomb[x]
        continue

    h -= damage

    if h <= 0:
        continue

    x = x + 2 * D
    cnt = -1 * (-h // A)
    damage += cnt * A
    bomb[x] = cnt * A
    ans += cnt

print(ans)
### BUGGY CODE ###

n = int(input())
s = []
for i in range(n):
    s.append(input())

u = set(s)
m = 0
ans = []

for i in u:
    if s.count(i) > m:
        ans = [i]
        m = s.count(i)
    elif s.count(i) == m:
        ans.append(i)

ans.sort()
for i in range(len(ans)):
    print(ans[i])

        


### FIXED CODE ###

import collections

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

c = collections.Counter(s)
common = c.most_common()

count = common[0][1]
ans = []
for i in common:
  if i[1] == count:
    ans.append(i[0])
  else:
    break
ans.sort()
print(*ans,sep='\n')
### BUGGY CODE ###

N=int(input())
y=list(map(int, input().split()))
from itertools import combinations
C=list(combinations(range(N), 3))

def cond(a, b, c):
  c1=a+b>c
  c2=b+c>a
  c3=c+a>b
  if c1 and c2 and c3:
    return True
  else:
    return False

ans=0
for c in C:
  if cond(y[c[0]], y[c[1]], y[c[2]]):
    ans+=1

print(ans)
  

### FIXED CODE ###

import bisect as bs
N=int(input())
y=list(map(int, input().split()))
y.sort()
ans=0
for i in range(N-2):
  for j in range(i+1, N-1):
    tmp=y[i]+y[j]
    ans+=bs.bisect_left(y[(j+1):],tmp)
    
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python
# ワーシャルフロイド+全探索

import numpy as np
import itertools

def main():
    N, M, R = map(int, input().split())
    rs = map(int, input().split())
    inf = float('inf')
    cost = [[inf]*N for _ in range(N)]

    # グラフ作る
    for i in range(N):
        cost[i][i] = 0

    for _ in range(M):
        a, b, c = map(int, input().split())
        cost[a-1][b-1] = c
        cost[b-1][a-1] = c
    
    # ワーシャルフロイドで全頂点間距離算出
    for k in range(N):
        for i in range(N):
            for j in range(N):
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j])

    # 組み合わせ全探索
    ans = inf
    for route in itertools.permutations(rs):
        d = 0
        for i in range(R-1):
            d += cost[route[i]-1][route[i+1]-1]
            if d > ans:
                break
        ans = min(ans, d)
    
    print(int(ans))


if __name__=='__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python
# ワーシャルフロイド+全探索

import numpy as np
import itertools

def main():
    N, M, R = map(int, input().split())
    rs = list(map(int, input().split()))
    inf = float('inf')
    cost = [[inf]*N for _ in range(N)]

    # グラフ作る
    for i in range(N):
        cost[i][i] = 0

    for _ in range(M):
        a, b, c = map(int, input().split())
        cost[a-1][b-1] = c
        cost[b-1][a-1] = c
    
    # ワーシャルフロイドで全頂点間距離算出
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if cost[i][k]+cost[k][j] < cost[i][j]:
                    cost[i][j] = cost[i][k] + cost[k][j]

    # 組み合わせ全探索
    ans = inf
    for route in itertools.permutations(rs):
        d = 0
        for i in range(R-1):
            d += cost[route[i]-1][route[i+1]-1]
            if d > ans:
                break
        ans = min(ans, d)
    
    print(int(ans))


if __name__=='__main__':
    main()
### BUGGY CODE ###

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()))
result = [a + b + c for c in C for b in B for a in A]
result.sort(reverse = True)
for i,j in enumerate(result):
    if i == K:
        exit()
    else:print(j)

### FIXED CODE ###

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.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)
t =[]
for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if (i+1)*(j+1)*(k) <= K:
                t.append(A[i]+B[j]+C[k])
            else:break
t.sort(reverse=True)
for i in range(K):
    print(t[i])
### BUGGY CODE ###

def main():
    c11, c12, c13 = map(int, input().split())
    c21, c22, c23 = map(int, input().split())
    c31, c32, c33 = map(int, input().split())

    for a1 in range(0, 101):
        for a2 in range(0, 101):
            for a3 in range(0, 101):
                for b1 in range(0, 101):
                    C11 = a1 + b1
                    C21 = a2 + b1
                    C31 = a3 + b1
                    if C11 > 100 or C21 > 100 or C31 > 100:
                        break
                    if C11 == c11 and C21 == c21 and C31 == c31:
                        for b2 in range(0, 101):
                            C12 = a1 + b2
                            C22 = a2 + b2
                            C32 = a3 + b2
                            if C12 > 100 or C22 > 100 or C32 > 100:
                                break
                            if C12 == c12 and C22 == c22 and C32 == c32:
                                for b3 in range(0, 101):
                                    C13 = a1 + b3
                                    C23 = a2 + b3
                                    C33 = a3 + b3
                                    if C13 > 100 or C23 > 100 or C33 > 100:
                                        break
                                    if C13 == c13 and C23 == c23 and C33 == c33:
                                        print('Yes')
                                        return

    print('No')
    return


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    c11, c12, c13 = map(int, input().split())
    c21, c22, c23 = map(int, input().split())
    c31, c32, c33 = map(int, input().split())

    r1max = max([c11, c12, c13])
    r2max = max([c21, c22, c23])
    r3max = max([c31, c32, c33])
    c1max = max([c11, c21, c31])
    c2max = max([c12, c22, c32])
    c3max = max([c13, c23, c33])
    for a1 in range(0, r1max + 1):
        for a2 in range(0, r2max + 1):
            for a3 in range(0, r3max + 1):
                m = max([a1, a2, a3])
                for b1 in range(0, c1max - m + 1):
                    C11 = a1 + b1
                    C21 = a2 + b1
                    C31 = a3 + b1
                    if C11 == c11 and C21 == c21 and C31 == c31:
                        for b2 in range(0, c2max - m + 1):
                            C12 = a1 + b2
                            C22 = a2 + b2
                            C32 = a3 + b2
                            if C12 == c12 and C22 == c22 and C32 == c32:
                                for b3 in range(0, c3max - m + 1):
                                    C13 = a1 + b3
                                    C23 = a2 + b3
                                    C33 = a3 + b3
                                    if C13 == c13 and C23 == c23 and C33 == c33:
                                        print('Yes')
                                        return

    print('No')
    return


if __name__ == '__main__':
    main()