Bizon the Champion is called the Champion for a reason. 

Bizon the Champion has recently got a present — a new glass cupboard with n shelves and he decided to put all his presents there. All the presents can be divided into two types: medals and cups. Bizon the Champion has a_1 first prize cups, a_2 second prize cups and a_3 third prize cups. Besides, he has b_1 first prize medals, b_2 second prize medals and b_3 third prize medals. 

Naturally, the rewards in the cupboard must look good, that's why Bizon the Champion decided to follow the rules:  any shelf cannot contain both cups and medals at the same time;  no shelf can contain more than five cups;  no shelf can have more than ten medals. 

Help Bizon the Champion find out if we can put all the rewards so that all the conditions are fulfilled.


-----Input-----

The first line contains integers a_1, a_2 and a_3 (0 ≤ a_1, a_2, a_3 ≤ 100). The second line contains integers b_1, b_2 and b_3 (0 ≤ b_1, b_2, b_3 ≤ 100). The third line contains integer n (1 ≤ n ≤ 100).

The numbers in the lines are separated by single spaces.


-----Output-----

Print "YES" (without the quotes) if all the rewards can be put on the shelves in the described manner. Otherwise, print "NO" (without the quotes).


-----Examples-----
Input
1 1 1
1 1 1
4

Output
YES

Input
1 1 3
2 3 4
2

Output
YES

Input
1 0 0
1 0 0
1

Output
NO

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
sumC = sum(list(map(int, input().split())))
sumM = sum(list(map(int, input().split())))
s = int(input())

def qu(a, b):
	if a == 0:
		return 0
	elif a / b <= 1:
		return 1
	elif a % b == 0:
		return int(a / b)
	else:
		return int(a / b) + 1
if qu(sumC, 5) + qu(sumM, 10) <= s:
	print('YES')
else:
	print('NO')


from math import ceil
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
if ceil(sum(a) / 5) + ceil(sum(b) / 10) > n:
	print('NO')
else:
	print('YES')


__author__ = 'Gleb'
(a1, a2, a3) = input().split()
sa = int(a1) + int(a2) + int(a3)
(a1, a2, a3) = input().split()
sb = int(a1) + int(a2) + int(a3)
n = int(input())
s = int(sa / 5)
if not sa % 5 == 0:
	s += 1
s += int(sb / 10)
if not sb % 10 == 0:
	s += 1
if s <= n:
	print('YES')
else:
	print('NO')


ls1 = [int(i) for i in input().split()]
ls2 = [int(i) for i in input().split()]
n = int(input())
sum1 = sum(ls1)
sum2 = sum(ls2)
count1 = sum1 // 5
if sum1 % 5:
	count1 += 1
count2 = sum2 // 10
if sum2 % 10:
	count2 += 1
n = n - count1 - count2
if n < 0:
	print('NO')
else:
	print('YES')


import sys
from functools import reduce
from collections import Counter
import time
import datetime
import math

def ip():
	return int(sys.stdin.readline())

def sip():
	return sys.stdin.readline()

def mip():
	return map(int, sys.stdin.readline().split())

def mips():
	return map(str, sys.stdin.readline().split())

def lip():
	return list(map(int, sys.stdin.readline().split()))

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.insert(i, arr)
	return lst

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def minJumps(arr, n):
	jumps = [0 for i in range(n)]
	if n == 0 or arr[0] == 0:
		return float('inf')
	jumps[0] = 0
	for i in range(1, n):
		jumps[i] = float('inf')
		for j in range(i):
			if i <= j + arr[j] and jumps[j] != float('inf'):
				jumps[i] = min(jumps[i], jumps[j] + 1)
				break
	return jumps[n - 1]

def dic(arr):
	return Counter(arr)

def check_prime(n):
	if n < 2:
		return False
	for i in range(2, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True
lst = lip()
arr = lip()
n = ip()
a = math.ceil(sum(lst) / 5)
b = math.ceil(sum(arr) / 10)
if a + b <= n:
	print('YES')
else:
	print('NO')


def solve(a, b, n):
	a = sum(a)
	b = sum(b)
	x = a // 5 + (1 if a % 5 != 0 else 0)
	y = b // 10 + (1 if b % 10 != 0 else 0)
	return 'YES' if x + y <= n else 'NO'

def main():
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	n = int(input())
	print(solve(a, b, n))
main()


import math
(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
cups = (a1 + a2 + a3) / 5
c = math.ceil(cups)
medals = (b1 + b2 + b3) / 10
m = math.ceil(medals)
if c + m <= n:
	print('YES')
elif c + m > n:
	print('NO')


a = sum(map(int, input().split()))
b = sum(map(int, input().split()))
n = int(input())
if a % 5 == 0:
	a = a // 5
else:
	a = a // 5 + 1
if b % 10 == 0:
	b = b // 10
else:
	b = b // 10 + 1
if a + b <= n:
	print('YES')
else:
	print('NO')


s1 = int((sum((int(x) for x in input().split(' '))) + 4) / 5)
s2 = int((sum((int(x) for x in input().split(' '))) + 9) / 10)
n = int(input())
if s1 + s2 > n:
	print('NO')
else:
	print('YES')


(a, b, c) = [int(x) for x in input().split()]
(d, e, f) = [int(x) for x in input().split()]
count = (a + b + c + 4) // 5 + (d + e + f + 9) // 10
n = int(input())
if n >= count:
	print('YES')
else:
	print('NO')


import math
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
n = int(input())
if math.ceil(sum(a) / 5) + math.ceil(sum(b) / 10) <= n:
	print('YES')
else:
	print('NO')


a = input().split()
b = input().split()
d = int(input())
c = 0
g = 0
m = 0
for i in range(3):
	c = c + int(a[i])
	m = m + int(b[i])
if c == 0:
	c = 0
elif c <= 5:
	c = 1
elif c % 5 == 0:
	c = c // 5
else:
	c = c // 5 + 1
if m == 0:
	m = 0
elif m <= 10:
	m = 1
elif m % 10 == 0:
	m = m // 10
else:
	m = m // 10 + 1
if m + c <= d:
	print('YES')
else:
	print('NO')


s1 = sum(map(int, input().split()))
s2 = sum(map(int, input().split()))
n = int(input())
k = 0
if s1 % 5 == 0:
	k += s1 // 5
else:
	k += s1 // 5 + 1
if s2 % 10 == 0:
	k += s2 // 10
else:
	k += s2 // 10 + 1
if k <= n:
	print('YES')
else:
	print('NO')


from math import ceil
a = ceil(sum(map(int, input().split())) / 5)
b = ceil(sum(map(int, input().split())) / 10)
print(('NO', 'YES')[a + b <= int(input())])


from math import ceil
from typing import Tuple

def parse_input() -> Tuple[int, int, int, int, int, int, int]:
	(a1, a2, a3) = [int(x) for x in input().split()]
	(b1, b2, b3) = [int(x) for x in input().split()]
	n = int(input())
	return (a1, a2, a3, b1, b2, b3, n)

def solve(a1: int, a2: int, a3: int, b1: int, b2: int, b3: int, n: int):
	if ceil((a1 + a2 + a3) / 5) + ceil((b1 + b2 + b3) / 10) <= n:
		return 'YES'
	return 'NO'
(a1, a2, a3, b1, b2, b3, n) = parse_input()
print(solve(a1, a2, a3, b1, b2, b3, n))


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
shelves = int(input())
(s1, s2) = (0, 0)
if (a1 + a2 + a3) % 5 == 0:
	s1 = (a1 + a2 + a3) // 5
else:
	s1 = (a1 + a2 + a3) // 5 + 1
s2 = shelves - s1
if 10 * s2 >= b1 + b2 + b3:
	print('YES')
else:
	print('NO')


arg1 = list(map(int, input().split()))
arg2 = list(map(int, input().split()))
arg3 = list(map(int, input().split()))
a = arg1[0] + arg1[1] + arg1[2]
b = arg2[0] + arg2[1] + arg2[2]
n = arg3[0]
while a > 0:
	a -= 5
	n -= 1
while b > 0:
	b -= 10
	n -= 1
if n >= 0:
	print('YES')
else:
	print('NO')


import math

def main():
	(sum1, sum2) = (0, 0)
	a = [int(x) for x in input().strip().split(' ')]
	b = [int(x) for x in input().strip().split(' ')]
	v1 = math.ceil(sum(a) / 5) + math.ceil(sum(b) / 10)
	v2 = int(input().strip())
	if v2 >= v1:
		print('YES')
	else:
		print('NO')
main()


import math
l = input().split()
(a1, a2, a3) = (int(l[0]), int(l[1]), int(l[2]))
l = input().split()
(b1, b2, b3) = (int(l[0]), int(l[1]), int(l[2]))
n = int(input())
if math.ceil((a1 + a2 + a3) / 5) + math.ceil((b1 + b2 + b3) / 10) <= n:
	print('YES')
else:
	print('NO')


x = [int(w) for w in input().split()]
y = [int(r) for r in input().split()]
n = int(input())
if sum(x) % 5 != 0:
	n -= int(sum(x) / 5) + 1
else:
	n -= int(sum(x) / 5)
if sum(y) % 10 != 0:
	n -= int(sum(y) / 10) + 1
else:
	n -= int(sum(y) / 10)
if n >= 0:
	print('YES')
else:
	print('NO')


a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
n = int(input())
cup_shelf_count = round(sum(a) / 5 + 0.49)
medal_shelf_count = round(sum(b) / 10 + 0.49)
if cup_shelf_count + medal_shelf_count <= n:
	print('YES')
else:
	print('NO')


a = input().split()
c = 0
for i in range(3):
	c += int(a[i])
b = input().split()
m = 0
for i in range(3):
	m += int(b[i])
n = int(input())
x = (c - 1) // 5 + 1 + (m - 1) // 10 + 1
if x > n:
	print('NO')
else:
	print('YES')


(cups, medals) = (0, 0)
for x in input().split():
	cups += int(x)
for x in input().split():
	medals += int(x)
rem_shelves = int(input())
for i in range(rem_shelves):
	if cups != 0:
		cups = max(0, cups - 5)
		continue
	if medals != 0:
		medals = max(0, medals - 10)
		continue
if cups == 0 and medals == 0:
	print('YES')
else:
	print('NO')


cups = sum(list(map(int, input().split())))
medals = sum(list(map(int, input().split())))
n = int(input())
if cups % 5 == 0:
	cups = cups // 5
else:
	cups = cups // 5 + 1
if medals % 10 == 0:
	medals = medals // 10
else:
	medals = medals // 10 + 1
if medals + cups <= n:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
rez = 0
suma = sum(a)
sumb = sum(b)
if suma > 5:
	if suma % 5 == 0:
		rez += suma // 5
	else:
		rez += suma // 5
		rez += 1
elif suma > 0:
	rez += 1
if sumb > 10:
	if sumb % 10 == 0:
		rez += sumb // 10
	else:
		rez += sumb // 10
		rez += 1
elif sumb > 0:
	rez += 1
print('YES' if rez <= n else 'NO')


import math
(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
sm1 = a1 + a2 + a3
sm2 = b1 + b2 + b3
r1 = sm1 / 5
r2 = sm2 / 10
x = math.ceil(r1) + math.ceil(r2)
if x <= n:
	print('YES')
else:
	print('NO')


(cups, medals) = (sum([int(e) for e in input().split(' ')]), sum([int(e) for e in input().split(' ')]))
n = int(input())
if int(cups / 5) + int(cups % 5 != 0) + int(medals / 10) + int(medals % 10 != 0) <= n:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
if (a1 + a2 + a3 + 4) // 5 + (b1 + b2 + b3 + 9) // 10 <= n:
	print('YES')
else:
	print('NO')


a = sum(map(int, input().split()))
b = sum(map(int, input().split()))
c = int(input())
if a // 5 + bool(a % 5) + b // 10 + bool(b % 10) <= c:
	print('YES')
else:
	print('NO')


import math
c = map(int, input().split())
m = map(int, input().split())
n = int(input())
tc = 0
tm = 0
for i in c:
	tc += i
for i in m:
	tm += i
if math.ceil(tc / 5) + math.ceil(tm / 10) > n:
	print('NO')
else:
	print('YES')


from sys import stdin, stdout
from collections import *
from math import ceil, floor, log, gcd
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	l = li()
	k = li()
	n = inp()
	(a, b) = (ceil(sum(l) / 5), ceil(sum(k) / 10))
	if a + b <= n:
		pr('YES')
	else:
		pr('NO')
for _ in range(1):
	solve()


import math as m
a = sum(map(int, input().split()))
b = sum(map(int, input().split()))
n = int(input())
a = m.ceil(a / 5)
b = m.ceil(b / 10)
if a + b <= n:
	print('YES')
else:
	print('NO')


import sys
(a1, a2, a3) = map(int, sys.stdin.readline().split())
(b1, b2, b3) = map(int, sys.stdin.readline().split())
n = int(input())
ss = a1 + a2 + a3
ms = b1 + b2 + b3
ssh = ss // 5
if ss % 5 != 0:
	ssh += 1
msh = ms // 10
if ms % 10 != 0:
	msh += 1
if msh + ssh > n:
	print('NO')
else:
	print('YES')


import sys
a = list(map(int, sys.stdin.readline().split()))
b = list(map(int, sys.stdin.readline().split()))
ta = 0
tb = 0
for i in range(3):
	ta += a[i]
	tb += b[i]
total = ta // 5 + tb // 10
if tb % 10 != 0:
	total += 1
if ta % 5 != 0:
	total += 1
n = int(sys.stdin.readline())
if n < total:
	print('NO')
else:
	print('YES')


import math
a = list(input().split())
sumA = 0
sumB = 0
count = 0
b = list(input().split())
for i in range(len(a)):
	sumA += int(a[i])
for j in range(len(b)):
	sumB += int(b[j])
c = int(input())
if c < math.ceil(sumA / 5) + math.ceil(sumB / 10):
	print('NO')
else:
	print('YES')


k = list(map(int, input().split()))
m = list(map(int, input().split()))
n = int(input())
ans = 0
x = sum(k)
y = sum(m)
while x > 0:
	ans += 1
	x -= 5
while y > 0:
	ans += 1
	y -= 10
if ans > n:
	print('NO')
else:
	print('YES')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
k = int(input())
kub_i = a1 + a2 + a3
med_i = b1 + b2 + b3
pol_m = med_i // 10
pol_k = kub_i // 5
ost_m = med_i % 10
ost_k = kub_i % 5
pol = pol_m + pol_k
if ost_m != 0 and ost_k == 0 or (ost_m == 0 and ost_k != 0):
	pol += 1
elif ost_m != 0 and ost_k != 0:
	pol += 2
elif ost_m == 0 and ost_k == 0:
	pol += 0
if pol <= k:
	print('YES')
elif pol > k:
	print('NO')


(a1, a2, a3) = list(map(int, input().split()))
(b1, b2, b3) = list(map(int, input().split()))
n = int(input())
A = a1 + a2 + a3
B = b1 + b2 + b3
n1 = A // 5
if A % 5 > 0:
	n1 += 1
n2 = B // 10
if B % 10 > 0:
	n2 += 1
if n1 + n2 <= n:
	print('YES')
else:
	print('NO')


import math as m
A = sum([int(x) for x in input().split()])
B = sum([int(x) for x in input().split()])
n = int(input())
print('YES' if n >= m.ceil(A / 5) + m.ceil(B / 10) else 'NO')


def PlaceRewards(a1, a2, a3, b1, b2, b3, n):
	suma = a1 + a2 + a3
	sumb = b1 + b2 + b3
	x1 = (suma + 4) // 5
	x2 = (sumb + 9) // 10
	m = x1 + x2
	return m <= n
(a1, a2, a3) = map(int, input().split(' '))
(b1, b2, b3) = map(int, input().split(' '))
n = int(input())
print('YES' if PlaceRewards(a1, a2, a3, b1, b2, b3, n) == True else 'NO')


(a, b, c) = map(int, input().split())
(d, e, f) = map(int, input().split())
g = int(input())
cups = (a + b + c) // 5
if (a + b + c) % 5 != 0:
	cups += 1
med = (d + e + f) // 10
if (d + e + f) % 10 != 0:
	med += 1
if g - cups - med >= 0:
	print('YES')
else:
	print('NO')


aes = list(map(int, input().split()))
bs = list(map(int, input().split()))
n = int(input())
numas = sum(aes)
numbs = sum(bs)
shelvesNeeded = int(numas / 5)
shelvesNeeded += 1 if numas % 5 != 0 else 0
shelvesNeeded += int(numbs / 10)
shelvesNeeded += 1 if numbs % 10 != 0 else 0
print('YES' if shelvesNeeded <= n else 'NO')


cups = input().split(' ')
medals = input().split(' ')
shelves = int(input())
totalcups = 0
totalmedals = 0
for x in cups:
	totalcups += int(x)
for y in medals:
	totalmedals += int(y)
while shelves > 0:
	if totalcups > 0:
		shelves -= 1
	if totalcups >= 5:
		totalcups -= 5
	else:
		totalcups = 0
	if shelves == 0:
		break
	if totalmedals > 0:
		shelves -= 1
	if totalmedals >= 10:
		totalmedals -= 10
	else:
		totalmedals = 0
	if totalmedals == 0 and totalcups == 0:
		break
if totalmedals > 0 or totalcups > 0:
	print('NO')
else:
	print('YES')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
a = 0
if (a1 + a2 + a3) % 5 != 0:
	a = a + 1
if (b1 + b2 + b3) % 10 != 0:
	a = a + 1
if (a1 + a2 + a3) // 5 + (b1 + b2 + b3) // 10 + a <= n:
	print('YES')
else:
	print('NO')


from math import ceil
a = input().split()
b = input().split()
n = int(input())
cups = 0
medals = 0
for i in range(3):
	cups += int(a[i])
	medals += int(b[i])
n -= ceil(cups / 5) + ceil(medals / 10)
if n >= 0:
	print('YES')
else:
	print('NO')


su = 0
s = input()
a = s.split()
for i in range(len(a)):
	a[i] = int(a[i])
if sum(a) % 5 == 0:
	su += int(sum(a) / 5)
else:
	su += int(sum(a) / 5) + 1
s = input()
a = s.split()
for i in range(len(a)):
	a[i] = int(a[i])
if sum(a) % 10 == 0:
	su += int(sum(a) / 10)
else:
	su += int(sum(a) / 10) + 1
n = int(input())
if su <= n:
	print('YES')
else:
	print('NO')


def nagrady(a, b, n):
	if (sum(a) + 9) // 10 + (sum(b) + 4) // 5 > n:
		return 'NO'
	return 'YES'
medals = [int(i) for i in input().split()]
cups = [int(i) for i in input().split()]
m = int(input())
print(nagrady(cups, medals, m))


lst = list(map(int, input().split()))
lst1 = list(map(int, input().split()))
q1 = int(input())
p = sum(lst) // 5
if sum(lst) % 5 != 0:
	p += 1
q = sum(lst1) // 10
if sum(lst1) % 10 != 0:
	q += 1
if p + q <= q1:
	print('YES')
else:
	print('NO')


from math import ceil
a = sum([int(i) for i in input().split()])
b = sum([int(i) for i in input().split()])
n = int(input())
n -= ceil(a / 5)
n -= ceil(b / 10)
if n < 0:
	print('NO')
else:
	print('YES')


import math
(ca, cb, cc) = [int(i) for i in input().split()]
nc = ca + cb + cc
(ma, mb, mc) = [int(i) for i in input().split()]
nm = ma + mb + mc
youjiceng = int(input())
n = math.ceil(nc / 5) + math.ceil(nm / 10)
if n > youjiceng:
	print('NO')
else:
	print('YES')


import math
(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
ans = math.ceil((a1 + a2 + a3) / 5) + math.ceil((b1 + b2 + b3) / 10)
if ans <= n:
	print('YES')
else:
	print('NO')


import math

def main():
	k = sum(list(map(int, input().split())))
	m = sum(list(map(int, input().split())))
	n = int(input())
	print('NO' if math.ceil(k / 5) + math.ceil(m / 10) > n else 'YES')
main()


p = input
i = int
f = lambda x: abs(-sum(map(i, p().split())) // x)
print('YNEOS'[f(5) + f(10) > i(p())::2])


(a1, a2, a3) = [int(x) for x in input().split()]
(b1, b2, b3) = [int(x) for x in input().split()]
n = int(input())
cups = a1 + a2 + a3
medals = b1 + b2 + b3
n -= cups // 5
n -= medals // 10
if cups < 5 and cups != 0:
	n -= 1
if medals < 5 and medals != 0:
	n -= 1
if cups > 5 and cups % 5 > 0:
	n -= 1
if medals > 10 and medals % 10 > 0:
	n -= 1
if n < 0:
	print('NO')
else:
	print('YES')


import math
cups = list(map(int, input().split()))
medals = list(map(int, input().split()))
k = int(input())
cups = math.ceil(sum(cups) / 5)
medals = math.ceil(sum(medals) / 10)
print('YNEOS'[cups + medals > k::2])


from math import ceil
c = sum([int(x) for x in input().split()])
m = sum([int(x) for x in input().split()])
s = int(input())
total = ceil(c / 5) + ceil(m / 10)
if total <= s:
	print('YES')
else:
	print('NO')


x = sum(list(map(int, input().split())))
y = sum(list(map(int, input().split())))
n = int(input())
X = x // 5
Y = y // 10
X += 1 if x % 5 else 0
Y += 1 if y % 10 else 0
print(['YES', 'NO'][X + Y > n])


import math
cups = sum([int(k) for k in input().split()])
medals = sum([int(p) for p in input().split()])
n = int(input())
shelfs = math.ceil(cups / 5) + math.ceil(medals / 10)
if n >= shelfs:
	print('YES')
else:
	print('NO')


import functools
value1 = [int(x) for x in input().split()]
value2 = [int(x) for x in input().split()]
value3 = input()
value3 = int(value3)
value1 = functools.reduce(lambda x, y: x + y, value1)
value2 = functools.reduce(lambda x, y: x + y, value2)
count1 = value1 // 5
value1 = value1 - 5 * count1
count1 += 1 if value1 % 5 > 0 else 0
count2 = value2 // 10
value2 = value2 - 10 * count2
count2 += 1 if value2 % 10 > 0 else 0
print('YES' if count1 + count2 <= value3 else 'NO')


import math

def find_total_no_of_items(string):
	sum = 0
	for i in string.split(' '):
		sum = sum + int(i)
	return sum
cups_string = input()
medals_string = input()
n = int(input())
no_of_cups = find_total_no_of_items(cups_string)
no_of_medals = find_total_no_of_items(medals_string)
total_shelves_required = math.ceil(no_of_cups / 5) + math.ceil(no_of_medals / 10)
if total_shelves_required <= n:
	print('YES')
else:
	print('NO')


import math
cups = sum(list(map(int, input().split())))
medals = sum(list(map(int, input().split())))
k = int(input())
(cups, medals) = (math.ceil(cups / 5), math.ceil(medals / 10))
if k - cups - medals >= 0:
	print('YES')
else:
	print('NO')


c = sum([int(x) for x in input().split(' ')])
m = sum([int(x) for x in input().split(' ')])
sh = int(input())
s = 0
if c % 5 != 0:
	s += c // 5 + 1
else:
	s += c // 5
if m % 10 != 0:
	s += m // 10 + 1
else:
	s += m // 10
print('YES' if s <= sh else 'NO')


nk = sum([int(x) for x in input().split()])
nm = sum([int(x) for x in input().split()])
nk = nk // 5 + (1 if nk % 5 != 0 else 0)
nm = nm // 10 + (1 if nm % 10 != 0 else 0)
print('YES' if nk + nm <= int(input()) else 'NO')


import math
(a1, a2, a3) = list(map(int, input().split()))
(b1, b2, b3) = list(map(int, input().split()))
n = int(input())
cups = a1 + a2 + a3
medals = b1 + b2 + b3
if math.ceil(cups / 5) + math.ceil(medals / 10) <= n:
	print('YES')
else:
	print('NO')


a = sum([int(_) for _ in input().split()])
b = sum([int(_) for _ in input().split()])
n = int(input())
for i in range(n):
	if a > 0:
		a -= 5
	elif b > 0:
		b -= 10
if a > 0 or b > 0:
	print('NO')
else:
	print('YES')


import math
cups = [int(x) for x in input().split()]
medals = [int(x) for x in input().split()]
n = int(input())
shelf_a = math.ceil(sum(cups) / 5)
shelf_b = n - shelf_a
if 10 * shelf_b >= sum(medals):
	print('YES')
else:
	print('NO')


import math

def ost(a, b):
	if a % b != 0:
		return 1
	else:
		return 0
(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
if (a1 + a2 + a3) // 5 + ost(a1 + a2 + a3, 5) + (b1 + b2 + b3) // 10 + ost(b1 + b2 + b3, 10) <= n:
	print('YES')
else:
	print('NO')


import math
import os
import sys
import re
import string
import itertools
import functools
import operator
a = (sum(map(int, input().split())) + 4) // 5
b = (sum(map(int, input().split())) + 9) // 10
print('YES' if int(input()) >= a + b else 'NO')


s = input()
a = [int(i) for i in s.split()]
s = input()
b = [int(i) for i in s.split()]
n = int(input())
ta = sum(a)
req = int(ta / 5)
if int(ta % 5) > 0:
	req += 1
if req <= n:
	n = n - req
	ta = sum(b)
	req = int(ta / 10)
	if int(ta % 10) > 0:
		req += 1
	if req <= n:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


def solve(xs, ys, n):
	cups = sum(xs)
	medals = sum(ys)
	shelves_needed = (cups + 4) // 5 + (medals + 9) // 10
	return shelves_needed <= n

def tf_to_yn(tf):
	return 'YES' if tf else 'NO'

def main():
	xs = [int(i) for i in input().strip().split()]
	ys = [int(i) for i in input().strip().split()]
	n = int(input())
	assert len(xs) == len(ys) == 3
	result = tf_to_yn(solve(xs, ys, n))
	print(result)
main()


from sys import *

def main():
	a = sum(map(int, stdin.readline().split()))
	b = sum(map(int, stdin.readline().split()))
	n = int(stdin.readline())
	l = b // 10 + (1 if b % 10 else 0) + a // 5 + (1 if a % 5 else 0)
	if l > n:
		print('NO')
	else:
		print('YES')
main()


import math
(a1, a2, a3) = input().split()
(a1, a2, a3) = (int(a1), int(a2), int(a3))
(b1, b2, b3) = input().split()
(b1, b2, b3) = (int(b1), int(b2), int(b3))
n = int(input())
a = a1 + a2 + a3
b = b1 + b2 + b3
x = math.ceil(a / 5)
y = math.ceil(b / 10)
n = n - x - y
if n >= 0:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
sum1 = sum(a)
sum2 = sum(b)
count1 = 0
count2 = 0
if sum1 <= 5 and sum1 > 0:
	count1 = count1 + 1
elif sum1 != 0:
	if sum1 % 5 != 0:
		count1 = count1 + sum1 // 5 + 1
	else:
		count1 = count1 + sum1 // 5
if sum2 <= 10 and sum2 > 0:
	count2 = count2 + 1
elif sum2 != 0:
	if sum2 % 10 != 0:
		count2 = count2 + sum2 // 10 + 1
	else:
		count2 = count2 + sum2 // 10
if count1 + count2 <= n:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = int(input())
if s >= (sum(a) + 4) // 5 + (sum(b) + 9) // 10:
	print('YES')
else:
	print('NO')


l = sum(list(map(int, input().split())))
l1 = sum(list(map(int, input().split())))
n = int(input())
t = 0
s = 0
s1 = 0
if 1 != 0:
	if l % 5 == 0:
		s = s + l // 5
	else:
		s = s + 1 + l // 5
else:
	t = t + 0
t = t + s
if l1 != 0:
	if l1 % 10 == 0:
		s1 = s1 + l1 // 10
	else:
		s1 = s1 + 1 + l1 // 10
else:
	t = t + 0
t = t + s1
if t <= n:
	print('YES')
else:
	print('NO')


import math
cup = [int(i) for i in input().split()]
medal = [int(j) for j in input().split()]
n = int(input())
x = math.ceil(sum(cup) / 5)
y = math.ceil(sum(medal) / 10)
if x + y > n:
	print('NO')
else:
	print('YES')


import math
x = sum(list(map(int, input().split())))
y = sum(list(map(int, input().split())))
n = int(input())
f = 0
if math.ceil(x / 5) <= n:
	n -= math.ceil(x / 5)
	if math.ceil(y / 10) > n:
		f = 1
else:
	f = 1
if f == 1:
	print('NO')
else:
	print('YES')


(a1, a2, a3) = input().split()
(b1, b2, b3) = input().split()
n = int(input())
a1 = int(a1)
a2 = int(a2)
a3 = int(a3)
b1 = int(b1)
b2 = int(b2)
b3 = int(b3)
cup = 0
medal = 0
s1 = a1 + a2 + a3
s2 = b1 + b2 + b3
if n == 0:
	print('NO')
elif s1 > 300 or s2 > 300:
	print('NO')
elif s1 == 0 and s2 == 0:
	print('YES')
elif s1 <= 5 and s2 <= 10:
	if s1 > 0:
		cup = 1
	else:
		cup = 0
	if s2 > 0:
		medal = 1
	else:
		medal = 0
	if n >= cup + medal:
		print('YES')
	else:
		print('NO')
elif s1 % 5 != 0 and s2 % 10 != 0:
	cup = 1 + s1 // 5
	medal = 1 + s2 // 10
	if n >= cup + medal:
		print('YES')
	else:
		print('NO')
elif s1 % 5 == 0 and s2 % 10 != 0:
	cup = s1 // 5
	medal = 1 + s2 // 10
	if n >= cup + medal:
		print('YES')
	else:
		print('NO')
elif s1 % 5 != 0 and s2 % 10 == 0:
	cup = 1 + s1 // 5
	medal = s2 // 10
	if n >= cup + medal:
		print('YES')
	else:
		print('NO')
elif s1 % 5 == 0 and s2 % 10 == 0:
	cup = s1 // 5
	medal = s2 // 10
	if n >= cup + medal:
		print('YES')
	else:
		print('NO')


from math import ceil
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
n = int(input())
print('YNEOS'[not ceil(sum(a) / 5) + ceil(sum(b) / 10) <= n::2])


l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
n = int(input())
su1 = 0
su2 = 0
for i in l1:
	su1 += i
for i in l2:
	su2 += i
n1 = su1 // 5
n2 = su2 // 10
if su1 % 5 != 0:
	n1 += 1
if su2 % 10 != 0:
	n2 += 1
if n1 + n2 <= n:
	print('YES')
else:
	print('NO')


s = list(map(int, input().split()))
k = list(map(int, input().split()))
n = int(input())
c = 0
t = sum(s)
r = sum(k)
if t <= 5 and t != 0:
	c += 1
elif t % 5 == 0:
	c += t // 5
else:
	c += t // 5 + 1
if r <= 10 and r != 0:
	c += 1
elif r % 10 == 0:
	c += r // 10
else:
	c += r // 10 + 1
if c <= n:
	print('YES')
else:
	print('NO')


cups = list(map(int, input().split()))
medals = list(map(int, input().split()))
N = int(input())
SumOfCups = 0
SumOfMedals = 0
for i in range(len(cups)):
	SumOfCups = SumOfCups + cups[i]
for i in range(len(medals)):
	SumOfMedals = SumOfMedals + medals[i]
while SumOfCups > 0:
	if N <= 0 and SumOfCups > 0:
		break
	SumOfCups = SumOfCups - 5
	N = N - 1
if N == 0 and SumOfMedals > 0 or (N <= 0 and SumOfCups > 0):
	print('NO')
else:
	while SumOfMedals > 0:
		if N <= 0 and SumOfMedals > 0:
			print('NO')
			break
		SumOfMedals = SumOfMedals - 10
		N = N - 1
if SumOfMedals <= 0 and SumOfCups <= 0 and (N >= 0):
	print('YES')


import math
cup = list(map(int, input().split()))
medal = list(map(int, input().split()))
shelves = int(input())
check = False
cups = sum(cup)
medals = sum(medal)
res = 0
cups /= 5
medals /= 10
res = math.ceil(cups) + math.ceil(medals)
ex = False
if res <= shelves and shelves > 1:
	check = True
if res > shelves:
	ex = True
if sum(medal) == 0 and shelves >= 1 and (ex == False):
	check = True
if sum(cup) == 0 and shelves >= 1 and (ex == False):
	check = True
if sum(cup) == 0 and sum(medal) == 0 and (shelves >= 0) and (ex == False):
	check = True
if check == True:
	print('YES')
else:
	print('NO')


import math
s1 = input()
s1 = s1.split()
a1 = int(s1[0])
a2 = int(s1[1])
a3 = int(s1[2])
s2 = input()
s2 = s2.split()
b1 = int(s2[0])
b2 = int(s2[1])
b3 = int(s2[2])
a = math.ceil((a1 + a2 + a3) / 5)
b = math.ceil((b1 + b2 + b3) / 10)
n = int(input())
if a + b > n:
	print('NO')
else:
	print('YES')


cups = list(map(int, input().split()))
medals = list(map(int, input().split()))
total_cups = sum(cups)
total_medals = sum(medals)
shelves_req_cups = total_cups // 5
if total_cups % 5 != 0:
	shelves_req_cups = shelves_req_cups + 1
shelves_req_medals = total_medals // 10
if total_medals % 10 != 0:
	shelves_req_medals = shelves_req_medals + 1
total_shelves = shelves_req_cups + shelves_req_medals
n = int(input())
if n >= total_shelves:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
(x, y, z) = map(int, input().split())
n = int(input())
m = (a + b + c) // 5
if (a + b + c) % 5 != 0:
	m += 1
if m > n:
	print('NO')
else:
	m += (x + y + z) // 10
	if (x + y + z) % 10 != 0:
		m += 1
	if m <= n:
		print('YES')
	else:
		print('NO')


goblets = sum(map(int, input().split()))
medals = sum(map(int, input().split()))
n = int(input())
print('YES' if n - (goblets // 5 + (1 if goblets % 5 != 0 else 0)) - (medals // 10 + (1 if medals % 10 != 0 else 0)) >= 0 else 'NO')


cups = sum((int(i) for i in input().split()))
medals = sum((int(i) for i in input().split()))
print('YES' if (cups + 4) // 5 + (medals + 9) // 10 <= int(input()) else 'NO')


def getSum(mylist):
	ret = 0
	for l in mylist:
		ret += int(l)
	return ret
a = str(input())
b = str(input())
n = int(input())
a1 = getSum(a.split())
b1 = getSum(b.split())
if n > 0 and n < int(a1 / 5) + (a1 % 5 > 0) + int(b1 / 10) + (b1 % 10 > 0):
	print('NO')
elif n > 0:
	print('YES')


cups = input()
medal = input()
n = int(input())
total_cups = 0
for y in cups.split():
	total_cups += int(y)
total_medal = 0
for x in medal.split():
	total_medal += int(x)
total_shelf = 0
if total_cups % 5 == 0:
	total_shelf += total_cups // 5
else:
	total_shelf += total_cups // 5 + 1
if total_medal % 10 == 0:
	total_shelf += total_medal // 10
else:
	total_shelf += total_medal // 10 + 1
if total_shelf > n:
	print('NO')
else:
	print('YES')


import math
a = sum(list(map(int, input().split())))
b = sum(list(map(int, input().split())))
n = int(input())
if math.ceil(a / 5) + math.ceil(b / 10) > n:
	print('NO')
elif a != 0 and b != 0 and (n == 1):
	print('NO')
else:
	print('YES')


from math import ceil as c
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
k = c(sum(a) / 5)
l = c(sum(b) / 10)
if k + l > n:
	print('NO')
else:
	print('YES')


from sys import stdin, stdout
from sys import stdin, stdout
from math import ceil
cups = list(map(int, stdin.readline().strip().split()))
medals = list(map(int, stdin.readline().strip().split()))
n = int(stdin.readline().strip())
total_cups = 0
total_medals = 0
for i in cups:
	total_cups += i
for j in medals:
	total_medals += j
cup_shelf = ceil(total_cups / 5)
medal_shelf = ceil(total_medals / 10)
total = cup_shelf + medal_shelf
if total <= n:
	stdout.write('YES')
else:
	stdout.write('NO')


import math
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
c = sum(a)
d = sum(b)
if c > 0 and d > 0 and (n < 2):
	print('NO')
elif math.ceil(c / 5) + math.ceil(d / 10) <= n:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
(d, e, f) = map(int, input().split())
n = int(input())
x = (a + b + c + 4) // 5
y = (d + e + f + 9) // 10
if x + y <= n:
	print('YES')
else:
	print('NO')


cups = input()
cups = cups.split(' ')
medals = input()
medals = medals.split(' ')
shelf = int(input())
cup = int(cups[0]) + int(cups[1]) + int(cups[2])
medal = int(medals[0]) + int(medals[1]) + int(medals[2])
prateleira = 0
while cup > 0:
	if cup >= 5:
		cup -= 5
		prateleira += 1
	else:
		cup = 0
		prateleira += 1
while medal > 0:
	if medal > 10:
		medal -= 10
		prateleira += 1
	else:
		medal = 0
		prateleira += 1
if prateleira > shelf:
	print('NO')
else:
	print('YES')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = int(input())
k = 0
if sum(a) % 5 == 0:
	k += sum(a) // 5
else:
	k += sum(a) // 5 + 1
if sum(b) % 10 == 0:
	k += sum(b) // 10
else:
	k += sum(b) // 10 + 1
if c >= k:
	print('YES')
else:
	print('NO')


c = sum(list(map(int, input().split())))
m = sum(list(map(int, input().split())))
n = int(input())
import math
z = math.ceil(c / 5) + math.ceil(m / 10)
if z > n:
	print('NO')
else:
	print('YES')


def win(c, m, n):
	count_c = 0
	count_m = 0
	if sum(c) / 5 > sum(c) // 5:
		count_c = sum(c) // 5 + 1
	else:
		count_c = sum(c) // 5
	if sum(m) / 10 > sum(m) // 10:
		count_m = sum(m) // 10 + 1
	else:
		count_m = sum(m) // 10
	if count_c + count_m <= n:
		return 'YES'
	else:
		return 'NO'
c = list(map(int, input().split()))
m = list(map(int, input().split()))
n = int(input())
print(win(c, m, n))


__author__ = 'Utena'
import math
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = int(input())
if math.ceil(sum(a) / 5) + math.ceil(sum(b) / 10) <= c:
	print('YES')
else:
	print('NO')


l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
n = int(input())
r = sum(l)
r1 = sum(l1)
if r % 5 == 0:
	r = r // 5
else:
	r = r // 5 + 1
if r1 % 10 == 0:
	r1 = r1 // 10
else:
	r1 = r1 // 10 + 1
if r1 + r <= n:
	print('YES')
else:
	print('NO')


import sys
(a1, a2, a3) = map(int, sys.stdin.readline().split())
(b1, b2, b3) = map(int, sys.stdin.readline().split())
n = int(input())
a = a1 + a2 + a3
b = b1 + b2 + b3
s = (a + 4) // 5 + (b + 9) // 10
if s <= n:
	print('YES')
else:
	print('NO')


from math import *
x = list(map(int, input().split()))
y = list(map(int, input().split()))
number = int(input())
n1 = ceil(sum(x) / 5)
n2 = ceil(sum(y) / 10)
if number - n1 - n2 >= 0:
	print('YES')
else:
	print('NO')


a = [int(m) for m in input().split()]
b = [int(o) for o in input().split()]
c = int(input())
d = a[0] + a[1] + a[2]
e = b[0] + b[1] + b[2]
k = d // 5
if d % 5 != 0:
	k += 1
j = e // 10
if e % 10 != 0:
	j += 1
f = k + j
if f <= c:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
bsum = b1 + b2 + b3
b = bsum // 10 + int(bsum % 10 != 0)
asum = a1 + a2 + a3
a = asum // 5 + int(asum % 5 != 0)
if n >= a + b:
	print('YES')
else:
	print('NO')


a = sum(map(int, input().split())) + 4
b = sum(map(int, input().split())) + 9
n = int(input())
s = 'NO'
if a // 5 + b // 10 <= n:
	s = 'YES'
print(s)


co = input().split()
a = list(map(int, co))
co = input().split()
b = list(map(int, co))
n = int(input())
(c, s) = (0, 0)
s = a[0] + a[1] + a[2]
c = c + s // 5
if s % 5 != 0:
	c = c + 1
s = 0
s = b[0] + b[1] + b[2]
c = c + s // 10
if s % 10 != 0:
	c = c + 1
if c > n:
	print('NO')
else:
	print('YES')


(a1, a2, a3) = [int(i) for i in input().split()]
(b1, b2, b3) = [int(i) for i in input().split()]
n = int(input())
k1 = a1 + a2 + a3
k2 = b1 + b2 + b3
t = 0
if k1 % 5 == 0:
	t = t + k1 // 5
else:
	t = t + k1 // 5 + 1
if k2 % 10 == 0:
	t = t + k2 // 10
else:
	t = t + k2 // 10 + 1
if t > n:
	print('NO')
else:
	print('YES')


from math import ceil

def main():
	a = sum(map(int, input().split()))
	b = sum(map(int, input().split()))
	n = int(input())
	if ceil(a / 5) + ceil(b / 10) <= n:
		print('YES')
	else:
		print('NO')
	return
main()


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
count = 0
sum_a = a1 + a2 + a3
sum_b = b1 + b2 + b3
a = (a1 + a2 + a3) // 5
b = (b1 + b2 + b3) // 10
if sum_a % 5 == 0:
	count += a
else:
	count += a + 1
if sum_b % 10 == 0:
	count += b
else:
	count += b + 1
if count <= n:
	print('YES')
else:
	print('NO')


a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = int(input())
s = int(sum(a) / 5)
ss = int(sum(b) / 10)
if sum(a) % 5 != 0:
	s += 1
if sum(b) % 10 != 0:
	ss += 1
if sum(a) > 0 and sum(b) > 0 and (c == 1):
	print('NO')
	quit()
if s + ss <= c:
	print('YES')
else:
	print('NO')


cups = sum([int(x) for x in input().split()])
medals = sum([int(x) for x in input().split()])
shelves_cups = [cups // 5, cups // 5 + 1][cups % 5 != 0]
shelves_medals = [medals // 10, medals // 10 + 1][medals % 10 != 0]
if int(input()) >= shelves_cups + shelves_medals:
	print('YES')
else:
	print('NO')


def rewards(s1, s2, n):
	r1 = int(s1 // 5)
	r2 = int(s2 // 10)
	r3 = s1 % 5
	r4 = s2 % 10
	if (r1 == 0 or r3 != 0) and s1 != 0:
		r1 = r1 + 1
	if (r2 == 0 or r4 != 0) and s2 != 0:
		r2 = r2 + 1
	if r1 + r2 <= n:
		print('YES')
	else:
		print('NO')
(a1, a2, a3) = input().split()
(b1, b2, b3) = input().split()
n = int(input())
a1 = int(a1)
a2 = int(a2)
a3 = int(a3)
b1 = int(b1)
b2 = int(b2)
b3 = int(b3)
s1 = a1 + a2 + a3
s2 = b1 + b2 + b3
rewards(s1, s2, n)


cups = list(map(int, input().split()))
medals = list(map(int, input().split()))
n = int(input())
cupssum = sum(cups)
medalssum = sum(medals)
count = 0
quotient1 = cupssum // 5
count += quotient1
cupssum = cupssum - quotient1 * 5
if 0 < cupssum < 5:
	count += 1
quotient2 = medalssum // 10
count += quotient2
medalssum = medalssum - quotient2 * 10
if 0 < medalssum < 10:
	count += 1
if count <= n:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = [int(k) for k in input().split()]
(b1, b2, b3) = [int(k) for k in input().split()]
(a, b) = (a1 + a2 + a3, b1 + b2 + b3)
n = int(input())
if a // 5 + int(bool(a % 5)) + b // 10 + int(bool(b % 10)) <= n:
	print('YES')
else:
	print('NO')


n = list(map(int, input().split()))
m = list(map(int, input().split()))
s = int(input())
t1 = sum(n)
t2 = sum(m)
if t1 % 5 != 0:
	cups = int(t1 / 5) + 1
else:
	cups = int(t1 / 5)
if t2 % 10 != 0:
	medals = int(t2 / 10) + 1
else:
	medals = int(t2 / 10)
total = cups + medals
if total <= s:
	print('YES')
else:
	print('NO')


from math import ceil
kub = [int(i) for i in input().split()]
med = [int(i) for i in input().split()]
n = int(input())
kub = sum(kub)
med = sum(med)
kub = ceil(kub / 5)
med = ceil(med / 10)
if kub + med <= n:
	print('YES')
else:
	print('NO')


import math
(x, y, z) = map(int, input().split())
a = x + y + z
(x, y, z) = map(int, input().split())
b = x + y + z
n = int(input())
m = math.ceil(a / 5) + math.ceil(b / 10)
if n >= m:
	print('YES')
else:
	print('NO')


s = input().split()
a = int(s[0]) + int(s[1]) + int(s[2])
s = input().split()
b = int(s[0]) + int(s[1]) + int(s[2])
n = int(input())
k1 = a // 5 if a % 5 == 0 else a // 5 + 1
k2 = b // 10 if b % 10 == 0 else b // 10 + 1
print('YES' if k1 + k2 <= n else 'NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
a_res = (sum(a) + 5 - 1) // 5
b_res = (sum(b) + 10 - 1) // 10
print('NO' if a_res + b_res > n else 'YES')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = int(input())
t = sum(a)
r = sum(b)
k = int(t / 5)
q = int(r / 10)
if t % 5 != 0:
	k = k + 1
if r % 10 != 0:
	q = q + 1
if k + q > s:
	print('NO')
else:
	print('YES')


import math
need = math.ceil(sum((int(x) for x in input().split())) / 5) + math.ceil(sum((int(x) for x in input().split())) / 10)
N = int(input())
print('YES' if N >= need else 'NO')


import math
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
suma = 0
sumb = 0
for i in a:
	suma += i
for i in b:
	sumb += i
c = int(input())
cc = math.ceil(suma / 5) + math.ceil(sumb / 10)
if c >= cc:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = int(input())
m = sum(a)
n = sum(b)
p = 0
if m % 5 == 0:
	p += int(m / 5)
else:
	p += int(m / 5) + 1
if n % 10 == 0:
	p += int(n / 10)
else:
	p += int(n / 10) + 1
if p <= s:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
(d, e, f) = map(int, input().split())
n = int(input())
t = 0
if a + b + c <= 5 and a + b + c != 0:
	t += 1
elif (a + b + c) % 5 == 0:
	t += (a + b + c) // 5
else:
	t += 1 + (a + b + c) // 5
if d + e + f <= 10 and d + e + f != 0:
	t += 1
elif (d + e + f) % 10 == 0:
	t += (d + e + f) // 10
else:
	t += 1 + (d + e + f) // 10
print(['YES', 'NO'][n < t])


(a, b, c) = [int(i) for i in input().split()]
(x, y, z) = [int(i) for i in input().split()]
n = int(input())
if (a + b + c) % 5 == 0:
	p = (a + b + c) // 5
else:
	p = (a + b + c) // 5 + 1
if (x + y + z) % 10 == 0:
	q = (x + y + z) // 10
else:
	q = (x + y + z) // 10 + 1
if p + q <= n:
	print('YES')
else:
	print('NO')


from math import ceil as c
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
(sum1, sum2) = (0, 0)
for i in range(3):
	sum1 += a[i]
	sum2 += b[i]
n = n - int(c(sum1 / 5))
n = n - int(c(sum2 / 10))
if n >= 0:
	print('YES')
else:
	print('NO')


i = lambda k: -(-sum(map(int, input().split())) // k)
print('YNEOS'[i(5) + i(10) > i(1)::2])


import math
A = list(map(int, input().split()))
B = list(map(int, input().split()))
N = int(input())
a = math.ceil(sum(A) / 5)
b = math.ceil(sum(B) / 10)
if a + b <= N:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
(d, e, f) = map(int, input().split())
n = int(input())
g = (a + b + c) // 5 if (a + b + c) % 5 == 0 else (a + b + c) // 5 + 1
h = (d + e + f) // 10 if (d + f + e) % 10 == 0 else (d + e + f) // 10 + 1
if g + h > n:
	print('NO')
else:
	print('YES')


i = input
r = round
a = sum(map(int, i().split()))
b = sum(map(int, i().split()))
n = int(i())
print(['YES', 'NO'][r(a / 5 + 0.49) + r(b / 10 + 0.49) > n])


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
cupsum = a1 + a2 + a3
medalsum = b1 + b2 + b3
cshel = cupsum // 5
if cupsum % 5 != 0:
	cshel += 1
medalshel = medalsum // 10
if medalsum % 10 != 0:
	medalshel += 1
shelves = cshel + medalshel
if shelves == 0:
	print('YES')
elif shelves <= n:
	print('YES')
else:
	print('NO')


a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
n = int(input())
if sum(a) % 5 == 0:
	cup = sum(a) // 5
else:
	cup = sum(a) // 5 + 1
if sum(b) % 10 == 0:
	med = sum(b) // 10
else:
	med = sum(b) // 10 + 1
if cup + med <= n:
	print('YES')
else:
	print('NO')


cups = [int(i) for i in input().split()]
medals = [int(i) for i in input().split()]
n = int(input())
s = 0
if sum(cups) + sum(medals) == 0 and n > 0:
	print('YES')
	exit()
if n * 5 < sum(cups):
	print('NO')
	exit()
a = sum(cups) // 5
if sum(cups) % 5 != 0:
	a += 1
b = sum(medals) // 10
if sum(medals) % 10 != 0:
	b += 1
if a + b <= n:
	print('YES')
else:
	print('NO')


import math
(a1, a2, a3) = list(map(int, input().split()))
(b1, b2, b3) = list(map(int, input().split()))
n = int(input())
s1 = a1 + a2 + a3
s2 = b1 + b2 + b3
s3 = math.ceil(s1 / 5) + math.ceil(s2 / 10)
if s3 <= n:
	print('YES')
else:
	print('NO')


ls_1 = [*map(int, input().split())]
ls_2 = [*map(int, input().split())]
print(('YES', 'NO')[(sum(ls_1) + 4) // 5 + (sum(ls_2) + 9) // 10 > int(input())])


a = input().split(' ')
b = input().split(' ')
n = int(input())
a = list(map(int, a))
b = list(map(int, b))
s = 0
x = 0
while sum(a) > s:
	s += 5
	n -= 1
while sum(b) > x:
	x += 10
	n -= 1
if n == 1 and sum(a) > 0 and (sum(b) > 0):
	print('NO')
elif n >= 0:
	print('YES')
else:
	print('NO')


from math import ceil

def solve():
	cs = sum(map(int, input().split()))
	ms = sum(map(int, input().split()))
	n = int(input())
	return ceil(cs / 5) + ceil(ms / 10) <= n
print('YES' if solve() else 'NO')


import math
(a, b, c) = map(int, input().split())
cup = a + b + c
(a, b, c) = map(int, input().split())
medal = a + b + c
shelf = int(input())
if math.ceil(cup / 5) + math.ceil(medal / 10) <= shelf:
	print('YES')
else:
	print('NO')


x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
z = int(input())
if z >= (sum(x) - 0.5) // 5 + (sum(y) - 0.5) // 10 + 2:
	print('YES')
else:
	print('NO')


l = list(map(int, input().rstrip().split()))
m = list(map(int, input().rstrip().split()))
count = sum(l) // 5 + 1 if sum(l) % 5 != 0 else sum(l) // 5
count += sum(m) // 10 + 1 if sum(m) % 10 != 0 else sum(m) // 10
print(['NO', 'YES'][count <= int(input())])


import math
(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
cup = a1 + a2 + a3
medal = b1 + b2 + b3
shelf = 0
shelf += math.ceil(cup / 5)
shelf += math.ceil(medal / 10)
if n >= shelf:
	print('YES')
else:
	print('NO')


import math
print('YES' if math.ceil(sum(list(map(int, input().split()))) / 5) + math.ceil(sum(list(map(int, input().split()))) / 10) <= int(input()) else 'NO')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
a = sum([a1, a2, a3])
b = sum([b1, b2, b3])
da = a // 5
if a % 5 != 0:
	da += 1
db = b // 10
if b % 10 != 0:
	db += 1
if da + db <= n:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
if sum(a) * sum(b) != 0 and (n == 1 or n == 0):
	print('NO')
elif (sum(a) + 4) // 5 + (sum(b) + 9) // 10 > n:
	print('NO')
else:
	print('YES')


import math
cups = sum(list(map(int, input().split())))
medals = sum(list(map(int, input().split())))
n = int(input())
cnt1 = math.ceil(cups / 5)
cnt2 = math.ceil(medals / 10)
if cnt1 + cnt2 <= n:
	print('YES')
else:
	print('NO')


import math
x = list(map(int, input().split()))
y = list(map(int, input().split()))
n = int(input())
x_n = x[0] + x[1] + x[2]
y_n = y[0] + y[1] + y[2]
x_n = math.ceil(x_n / 5)
y_n = math.ceil(y_n / 10)
if x_n + y_n <= n:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
a1 = sum(a)
n1 = 0
while a1 > 0:
	n1 += 1
	a1 -= 5
b1 = sum(b)
n2 = 0
while b1 > 0:
	n2 += 1
	b1 -= 10
if n1 + n2 <= n:
	print('YES')
else:
	print('NO')


cups = list(map(int, input().split()))
medals = list(map(int, input().split()))
shelves = int(input())
totalCups = sum(cups)
totalMedals = sum(medals)
cupsShelves = totalCups // 5
cupsShelves += 0 if totalCups % 5 == 0 else 1
medalShelves = totalMedals // 10
medalShelves += 0 if totalMedals % 10 == 0 else 1
print('YES') if medalShelves + cupsShelves <= shelves else print('NO')


import math
l1 = list(map(int, input().split(' ')))
l2 = list(map(int, input().split(' ')))
n = int(input())
k1 = sum(l1)
k2 = sum(l2)
s1 = math.ceil(k1 / 5)
s2 = math.ceil(k2 / 10)
s = s1 + s2
if s <= n:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
shelves = (sum(a) + 4) // 5 + (sum(b) + 9) // 10
print('YNEOS'[shelves > n::2])


a = sum([int(x) for x in input().split()])
b = sum([int(x) for x in input().split()])
n = int(input())
print('YES' if n >= (a + 4) // 5 + (b + 9) // 10 else 'NO')


import sys

def readLines(countLines):
	lines = []
	for n in range(0, countLines):
		lines.append(input())
	return lines

def readInput(lines):
	kubki = lines[0].split()
	medali = lines[1].split()
	kubki = [int(x) for x in kubki]
	medali = [int(x) for x in medali]
	shelfCount = int(lines[2])
	return [kubki, medali, shelfCount]

def problem(lines):
	kubki = lines[0]
	medali = lines[1]
	shelfCount = lines[2]
	kubkiCount = sum(kubki)
	medaliCount = sum(medali)
	usedShelfCount = 0
	while kubkiCount > 0:
		kubkiCount = kubkiCount - 5
		usedShelfCount += 1
	while medaliCount > 0:
		medaliCount -= 10
		usedShelfCount += 1
	if usedShelfCount > shelfCount:
		print('NO')
		return
	else:
		print('YES')
		return
problem(readInput(readLines(3)))


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
n = int(input())
z = sum(a)
t = 0
zz = sum(b)
if zz % 10 == 0:
	t1 = zz / 10
else:
	t1 = zz // 10 + 1
if z % 5 == 0:
	t2 = z // 5
else:
	t2 = z // 5 + 1
if t1 + t2 <= n:
	print('YES')
else:
	print('NO')


(a, b, c) = list(map(int, input().split()))
(d, e, f) = list(map(int, input().split()))
g = int(input())
if (a + b + c) / 5 % 1 == 0:
	check1 = (a + b + c) / 5
else:
	check1 = int((a + b + c) // 5 + 1)
if (d + e + f) / 10 % 1 == 0:
	check2 = (d + e + f) / 10
else:
	check2 = int((d + e + f) // 10 + 1)
print('YES' if g - (check1 + check2) >= 0 else 'NO')


import math
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = int(input())
a1 = sum(a)
a2 = math.ceil(a1 / 5)
b1 = sum(b)
b2 = math.ceil(b1 / 10)
if a2 + b2 <= c:
	print('YES')
else:
	print('NO')


def r(n):
	ret = sum(list(map(int, input().split())))
	if ret % n == 0:
		return ret // n
	else:
		return ret // n + 1
print('YES' if r(5) + r(10) <= int(input()) else 'NO')


(a, b, c) = [int(x) for x in input().split(' ')]
(d, e, f) = [int(x) for x in input().split(' ')]
n = int(input())
m = -(-(a + b + c) // 5) - -(d + e + f) // 10
if m > n:
	print('NO')
else:
	print('YES')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
import math
x = math.ceil((a1 + a2 + a3) / 5) + math.ceil((b1 + b2 + b3) / 10)
print(('NO', 'YES')[x <= n])


import math
cups = [int(i) for i in input().split()]
medals = [int(i) for i in input().split()]
number_of_shelves = int(input())
cups = sum(cups)
medals = sum(medals)
cups_shelves = math.ceil(cups / 5)
medals_shelves = math.ceil(medals / 10)
if cups_shelves + medals_shelves <= number_of_shelves:
	print('YES')
else:
	print('NO')


from math import *
a = [int(n) for n in input().split()]
b = [int(n) for n in input().split()]
x = int(input())
k = ceil(sum(a) / 5)
j = x - k
t = ceil(sum(b) / 10)
if j >= t:
	print('YES')
else:
	print('NO')


cups = input().split()
a1 = int(cups[0])
a2 = int(cups[1])
a3 = int(cups[2])
medals = input().split()
b1 = int(medals[0])
b2 = int(medals[1])
b3 = int(medals[2])
n = int(input())
suma = a1 + a2 + a3
sumb = b1 + b2 + b3
if suma > 5:
	n -= int(suma / 5)
	if suma % 5 > 0:
		n -= 1
elif suma != 0:
	n -= 1
if sumb > 10:
	n -= int(sumb / 10)
	if sumb % 10 > 0:
		n -= 1
elif sumb != 0:
	n -= 1
if n >= 0:
	print('YES')
else:
	print('NO')


def read(mode=2):
	inputs = input().strip()
	if mode == 0:
		return inputs
	if mode == 1:
		return inputs.split()
	if mode == 2:
		return [int(x) for x in inputs.split()]

def write(s='\n'):
	if isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='')
a = sum(read())
b = sum(read())
(n,) = read()
if -(-a // 5) - -b // 10 > n:
	print('NO')
else:
	print('YES')


lis1 = input().split()
for i in range(3):
	lis1[i] = int(lis1[i])
lis2 = input().split()
for i in range(3):
	lis2[i] = int(lis2[i])
c = sum(lis1)
m = sum(lis2)
n = int(input())
if c % 5 == 0:
	s1 = int(c / 5)
else:
	s1 = c // 5 + 1
if m % 10 == 0:
	s2 = m // 10
else:
	s2 = m // 10 + 1
if s1 + s2 > n:
	print('NO')
else:
	print('YES')


sum1 = sum(list(map(int, input().split())))
sum2 = sum(list(map(int, input().split())))
n = int(input())
if sum1 % 5 == 0:
	sum1 //= 5
else:
	sum1 //= 5
	sum1 += 1
if sum2 % 10 == 0:
	sum2 //= 10
else:
	sum2 //= 10
	sum2 += 1
if sum1 + sum2 <= n:
	print('YES')
else:
	print('NO')


n = list(map(int, input().split()))
l = list(map(int, input().split()))
s = int(input())
d = sum(n)
f = sum(l)
if d % 5 == 0:
	h = int(d / 5)
else:
	h = int(d / 5) + 1
if f % 10 == 0:
	j = int(f / 10)
else:
	j = int(f / 10) + 1
if h + j <= s:
	print('YES')
else:
	print('NO')


from math import ceil
(a1, a2, a3) = [int(i) for i in input().split()]
(b1, b2, b3) = [int(i) for i in input().split()]
n = int(input())
sa = a1 + a2 + a3
sb = b1 + b2 + b3
if ceil(sa / 5) + ceil(sb / 10) > n:
	print('NO')
else:
	print('YES')


import math
(a, b, c) = [int(x) for x in input().split()]
(d, e, f) = [int(x) for x in input().split()]
if math.ceil((a + b + c) / 5) + math.ceil((d + e + f) / 10) > int(input()):
	print('NO')
else:
	print('YES')


q = lambda : map(int, input().split())
qi = lambda : int(input())
qs = lambda : input().split()
a = sum(q())
b = sum(q())
n = qi()
n -= a // 5 + 1 if a % 5 else a // 5
n -= b // 10 + 1 if b % 10 else b // 10
print('YES' if n >= 0 else 'NO')


from math import ceil
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
n = int(input())
suml1 = sum(l1)
suml2 = sum(l2)
a = ceil(suml1 / 5)
b = ceil(suml2 / 10)
if a + b <= n:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = [int(i) for i in input().split()]
(b1, b2, b3) = [int(i) for i in input().split()]
n = int(input())
cup = a1 + a2 + a3
if cup % 5 == 0:
	n -= cup // 5
else:
	n -= cup // 5 + 1
medal = b1 + b2 + b3
if medal % 10 == 0:
	n -= medal // 10
else:
	n -= medal // 10 + 1
print('YES' if n >= 0 else 'NO')


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	a = LI()
	b = LI()
	n = I()
	sma = sum(a)
	smb = sum(b)
	x = (sma + 4) // 5
	x += (smb + 9) // 10
	if n >= x:
		return 'YES'
	return 'NO'
print(main())


s1 = sum([int(x) for x in input().split()])
s2 = sum([int(y) for y in input().split()])
tot = int(input())
s = (s1 + 4) // 5 + (s2 + 9) // 10
if s <= tot:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = [int(k) for k in input().split(' ')]
(b1, b2, b3) = [int(k) for k in input().split(' ')]
n = int(input())
suma = a1 + a2 + a3
sumb = b1 + b2 + b3
if (suma + 4) // 5 + (sumb + 9) // 10 > n:
	print('NO')
else:
	print('YES')


i = lambda : sum(map(int, input().split()))
print('YNEOS'[(i() + 4) // 5 + (i() + 9) // 10 > i()::2])


A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
n = int(input())
if sum(A) % 5 != 0:
	n -= sum(A) // 5 + 1
else:
	n -= sum(A) // 5
if sum(B) % 10 != 0:
	n -= sum(B) // 10 + 1
else:
	n -= sum(B) // 10
if n >= 0:
	print('YES')
else:
	print('NO')


import math
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
x = int(input())
a = sum(s1)
b = sum(s2)
c = math.ceil(a / 5) + math.ceil(b / 10)
if c <= x:
	print('YES')
else:
	print('NO')


lk = list(map(int, input().split()))
lm = list(map(int, input().split()))
n = int(input())
k = sum(lk)
m = sum(lm)
if int(k / 5) != k / 5:
	k = k // 5 + 1
else:
	k = k // 5
if int(m / 10) != m / 10:
	m = m // 10 + 1
else:
	m = m // 10
if m + k > n:
	print('NO')
else:
	print('YES')


from math import ceil
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = int(input())
sa = sum(a)
sb = sum(b)
if c >= ceil(sa / 5) + ceil(sb / 10):
	print('YES')
else:
	print('NO')


cup = list(map(int, input().split()))
medal = list(map(int, input().split()))
shelf = int(input())
cupall = sum(cup)
medalall = sum(medal)
import math
if math.ceil(cupall / 5) + math.ceil(medalall / 10) <= shelf:
	print('YES')
else:
	print('NO')


l = [int(k) for k in input().split(' ')]
m = [int(k) for k in input().split(' ')]
n = int(input())
a = sum(l)
b = sum(m)
while n > 0:
	if a > 0:
		a -= 5
		n -= 1
	elif b > 0:
		b -= 10
		n -= 1
	else:
		break
if a <= 0 and b <= 0:
	print('YES')
else:
	print('NO')


from math import ceil as ce
p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
n = int(input())
a = ce(sum(p) / 5)
b = ce(sum(q) / 10)
if a + b <= n:
	print('YES')
else:
	print('NO')


import math
(a1, a2, a3) = [int(i) for i in input().split()]
(b1, b2, b3) = [int(i) for i in input().split()]
m = int(input())
n = 0
n += math.ceil((a1 + a2 + a3) / 5)
n += math.ceil((b1 + b2 + b3) / 10)
if n <= m:
	print('YES')
else:
	print('NO')


list1 = [int(i) for i in input().split()]
list2 = [int(i) for i in input().split()]
n = int(input())
a = sum(list1)
b = sum(list2)
if a % 5 == 0:
	a1 = a / 5
else:
	a1 = a // 5 + 1
if b % 10 == 0:
	b1 = b / 10
else:
	b1 = b // 10 + 1
if b1 + a1 <= n:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
s1 = sum(a)
s2 = sum(b)
x = 0
while s1 > 0:
	if s1 > 5:
		s1 -= 5
	else:
		s1 = 0
	x += 1
while s2 > 0:
	if s2 > 10:
		s2 -= 10
	else:
		s2 = 0
	x += 1
if x <= n:
	print('YES')
else:
	print('NO')


li = [int(i) for i in input().split()]
li1 = [int(i) for i in input().split()]
n = int(input())
m = sum(li)
c = sum(li1)
if m % 5 == 0:
	m = m // 5
else:
	m = m // 5 + 1
if c % 10 == 0:
	c = c // 10
else:
	c = c // 10 + 1
if m + c <= n:
	print('YES')
else:
	print('NO')


a = [int(x) for x in input().split(' ')]
b = [int(x) for x in input().split(' ')]
n = int(input())
(sa, sb) = (0, 0)
if sum(a) % 5 == 0:
	sa = sum(a) // 5
else:
	sa = sum(a) // 5 + 1
if sum(b) % 10 == 0:
	sb = sum(b) // 10
else:
	sb = sum(b) // 10 + 1
if sa + sb <= n:
	print('YES')
else:
	print('NO')


from math import ceil
a = [int(string) for string in input().split()]
b = [int(string) for string in input().split()]
n = int(input())
sa = sum(a)
sb = sum(b)
ca = int(ceil(sa / 5))
cb = int(ceil(sb / 10))
print('YES' if ca + cb <= n else 'NO')


import math
cups = [int(i) for i in input().split()]
medals = [int(i) for i in input().split()]
shelves = int(input())
need = math.ceil(sum(cups) / 5) + math.ceil(sum(medals) / 10)
print('YES' if need <= shelves else 'NO')


a = []
for i in range(0, 2):
	x = input().split()
	for j in x:
		a.append(int(j))
n = int(input())
s1 = int(a[0] + a[1] + a[2])
s2 = int(a[3] + a[4] + a[5])
if s1 % 5 == 0:
	s1 = int(s1 / 5)
else:
	s1 = int(s1 / 5)
	s1 += 1
if s2 % 10 == 0:
	s2 = int(s2 / 10)
else:
	s2 = int(s2 / 10)
	s2 += 1
if s1 + s2 <= n:
	print('YES')
else:
	print('NO')


s = input().split()
a1 = int(s[0])
a2 = int(s[1])
a3 = int(s[2])
s = input().split()
b1 = int(s[0])
b2 = int(s[1])
b3 = int(s[2])
n = int(input())
if (a1 + a2 + a3) % 5 == 0:
	aa = (a1 + a2 + a3) // 5
else:
	aa = (a1 + a2 + a3) // 5 + 1
if (b1 + b2 + b3) % 10 == 0:
	bb = (b1 + b2 + b3) // 10
else:
	bb = (b1 + b2 + b3) // 10 + 1
if aa + bb <= n:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
c1 = 0
c2 = 0
for i in range(300):
	if a1 + a2 + a3 > 5 * i:
		c1 = i + 1
for i in range(300):
	if b1 + b2 + b3 > 10 * i:
		c2 = i + 1
if c1 + c2 <= n:
	print('YES')
else:
	print('NO')


a0 = input()
a0 = [int(x) for x in a0.split()]
b0 = input()
b0 = [int(x) for x in b0.split()]
n = int(input())
na = sum(a0)
nb = sum(b0)
if na % 5 != 0:
	ka = na // 5 + 1
else:
	ka = na // 5
if nb % 10 != 0:
	kb = nb // 10 + 1
else:
	kb = nb // 10
if kb + ka <= n:
	print('YES')
else:
	print('NO')


print('YES' if (sum(map(int, input().split())) + 4) // 5 + (sum(map(int, input().split())) + 9) // 10 <= int(input()) else 'NO')


import sys
import math
import bisect
import itertools
import random

def main():
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	n = int(input())
	m = math.ceil(sum(A) / 5) + math.ceil(sum(B) / 10)
	if m <= n:
		print('YES')
	else:
		print('NO')
main()


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
nk = a1 + a2 + a3
nm = b1 + b2 + b3
sm = 0
while nm > 0:
	nm -= 10
	sm += 1
sk = 0
while nk > 0:
	nk -= 5
	sk += 1
if sm + sk <= n:
	print('YES')
else:
	print('NO')


import math
n1 = math.ceil(sum(list(map(int, input().split()))) / 5)
n2 = math.ceil(sum(list(map(int, input().split()))) / 10)
n3 = int(input())
if n1 + n2 <= n3:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = map(int, input().split())
a = a1 + a2 + a3
(b1, b2, b3) = map(int, input().split())
b = b1 + b2 + b3
n = int(input())
A = (a + 4) // 5
B = (b + 9) // 10
print('NO' if A + B > n else 'YES')


import math
cup = [int(x) for x in input().split()]
med = [int(x) for x in input().split()]
shel = int(input())
if math.ceil(sum(cup) / 5) + math.ceil(sum(med) / 10) > shel:
	print('NO')
else:
	print('YES')


cups = [int(i) for i in input().split()]
medals = [int(i) for i in input().split()]
n = int(input())
cup_sum = sum(cups)
medal_sum = sum(medals)
if cup_sum % 5 == 0:
	ncup = cup_sum / 5
else:
	ncup = cup_sum // 5 + 1
if medal_sum % 10 == 0:
	nmedal = medal_sum / 10
else:
	nmedal = medal_sum // 10 + 1
if ncup + nmedal <= n:
	print('YES')
else:
	print('NO')


from math import *
a = map(int, input().split())
b = map(int, input().split())
n = int(input())
a = sum(a)
b = sum(b)
c = ceil(a / 5.0)
d = ceil(b / 10.0)
if n >= c + d:
	print('YES')
else:
	print('NO')


from math import *
(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
t_c = a1 + a2 + a3
t_m = b1 + b2 + b3
if int(ceil(t_c / 5)) + int(ceil(t_m / 10)) > n:
	print('NO')
else:
	print('YES')


import math
(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
n_left = n
total_a = a1 + a2 + a3
total_b = b1 + b2 + b3
value_a = math.ceil(total_a / 5)
value_b = math.ceil(total_b / 10)
if value_a + value_b <= n:
	print('YES')
else:
	print('NO')


import math
t = 0
(a, b, c) = map(int, input().split())
t += math.ceil((a + b + c) / 5)
(a, b, c) = map(int, input().split())
t += math.ceil((a + b + c) / 10)
n = int(input())
if t > n:
	print('NO')
else:
	print('YES')


import math
cups = input().split()
medals = input().split()
shelfs = int(input())
cups = sum([int(x) for x in cups])
medals = sum([int(x) for x in medals])
if math.ceil(cups / 5) + math.ceil(medals / 10) > shelfs:
	print('NO')
else:
	print('YES')


x = [int(x) for x in input().split()]
y = [int(y) for y in input().split()]
n = int(input())
if sum(x) > 0 and sum(x) < 5:
	s = 1
elif sum(x) % 5 == 0:
	s = sum(x) // 5
else:
	s = sum(x) // 5 + 1
if sum(y) > 0 and sum(y) < 10:
	s = s + 1
elif sum(y) % 10 == 0:
	s = s + sum(y) // 10
else:
	s = s + 1 + sum(y) // 10
if s <= n:
	print('YES')
else:
	print('NO')


cups = sum([*map(int, input().split())])
medal = sum([*map(int, input().split())])
n = int(input())
Answer = 0
if cups % 5 != 0:
	Answer += cups // 5 + 1
else:
	Answer += cups // 5
if medal % 10 != 0:
	Answer += medal // 10 + 1
else:
	Answer += medal // 10
print('YES' if Answer <= n else 'NO')


s = input().split()
a = int(s[0])
b = int(s[1])
c = int(s[2])
s2 = input().split()
a2 = int(s2[0])
b2 = int(s2[1])
c2 = int(s2[2])
s3 = input().split()
n = int(s3[0])
n1 = 0
n2 = 0
aaa = a + b + c
bbb = a2 + b2 + c2
if aaa % 5 == 0:
	n1 += aaa // 5
else:
	n1 += aaa // 5 + 1
if bbb % 10 == 0:
	n2 += bbb // 10
else:
	n2 += bbb // 10 + 1
if n1 + n2 > n:
	print('NO')
else:
	print('YES')


(a, b, c) = map(int, input().split())
(a1, b1, c1) = map(int, input().split())
n = int(input())
k = 0
kub = a + b + c
med = a1 + b1 + c1
k = kub // 5
if kub % 5 != 0:
	k = k + 1
k1 = med // 10
if med % 10 != 0:
	k1 = k1 + 1
if k + k1 > n:
	print('NO')
else:
	print('YES')


import math
a = sum(map(int, input().split()))
b = sum(map(int, input().split()))
n = int(input())
sa = math.ceil(a / 5)
sb = math.ceil(b / 10)
if sa + sb > n:
	print('NO')
else:
	print('YES')


cups = input()
medals = input()
n = int(input())
cups_num = cups.split()
medals_num = medals.split()
sum_cup = 0
sum_medal = 0
for i in range(0, 3):
	sum_cup += int(cups_num[i])
	sum_medal += int(medals_num[i])
sum_cup = int((sum_cup + 4) / 5)
sum_medal = int((sum_medal + 9) / 10)
if sum_cup + sum_medal <= n:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
(x, y, z) = map(int, input().split())
n = int(input())
r = (a + b + c) / 5
if r % 1 != 0:
	r += 1
	r //= 1
s = (x + y + z) / 10
if s % 1 != 0:
	s += 1
	s //= 1
t = r + s
if t > n:
	print('NO')
else:
	print('YES')


import math
line1 = list(map(int, input().split()))
line2 = list(map(int, input().split()))
a = sum(line1)
b = sum(line2)
c = int(input())
if c >= math.ceil(a / 5) + math.ceil(b / 10):
	print('YES')
else:
	print('NO')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
var1 = a1 + a2 + a3
var2 = b1 + b2 + b3
a_shell = var1 // 5
b_shell = var2 // 10
if var1 % 5 != 0:
	a_shell += 1
if var2 % 10 != 0:
	b_shell += 1
if a_shell + b_shell > n:
	print('NO')
else:
	print('YES')


import math

def main():
	cup = sum(list(map(int, input().split())))
	medel = sum(list(map(int, input().split())))
	rack = int(input())
	cup_rack = math.ceil(cup / 5.0)
	medel_rack = math.ceil(medel / 10.0)
	if cup_rack + medel_rack <= rack:
		print('YES')
	else:
		print('NO')
main()


a = sum(list(map(int, input().split()))) + 4
b = sum(list(map(int, input().split()))) + 9
n = int(input())
print(['NO', 'YES'][a // 5 + b // 10 <= n])


(a, b, c) = map(int, input().split())
cups = a + b + c
(a, b, c) = map(int, input().split())
medals = a + b + c
n = int(input())
if cups % 5 == 0:
	cups = cups // 5
else:
	cups = cups // 5 + 1
if medals % 10 == 0:
	medals = medals // 10
else:
	medals = medals // 10 + 1
if medals + cups <= n:
	print('YES')
else:
	print('NO')


(a, b, c) = [int(i) for i in input().split()]
d = a + b + c
(e, f, g) = [int(i) for i in input().split()]
h = e + f + g
c = int(input())
if d % 5 == 0:
	x = d // 5
else:
	x = d // 5 + 1
if h % 10 == 0:
	y = h // 10
else:
	y = h // 10 + 1
if x + y <= c:
	print('YES')
else:
	print('NO')


import math
cups = [int(x) for x in input().split()]
medals = [int(x) for x in input().split()]
n = int(input())
cup = math.ceil(sum(cups) / 5)
medal = math.ceil(sum(medals) / 10)
if cup + medal <= n:
	print('YES')
else:
	print('NO')


(a, b, c) = input().split()
(d, e, f) = input().split()
cups = int(a) + int(b) + int(c)
medals = int(d) + int(e) + int(f)
shelves = int(input())
while shelves > 0:
	if cups > 0:
		cups = cups - 5
	elif cups <= 0 and medals > 0:
		medals = medals - 10
	shelves = shelves - 1
if cups <= 0 and medals <= 0:
	print('YES')
else:
	print('NO')


c = sum(list(map(int, input().split())))
m = sum(list(map(int, input().split())))
n = int(input())
if c // 5 + (c % 5 != 0) + (m // 10 + (m % 10 != 0)) <= n:
	print('YES')
else:
	print('NO')


x = [int(q) for q in input().split()]
y = [int(w) for w in input().split()]
n = int(input())
import math
a = math.ceil(sum(x) / 5) + math.ceil(sum(y) / 10)
if a > n:
	print('NO')
else:
	print('YES')


copas = [int(x) for x in input().split()]
medallas = [int(x) for x in input().split()]
total_copas = sum(copas)
total_medallas = sum(medallas)
if total_copas % 5 == 0:
	rep_copas = total_copas // 5
else:
	rep_copas = total_copas // 5 + 1
if total_medallas % 10 == 0:
	rep_medallas = total_medallas // 10
else:
	rep_medallas = total_medallas // 10 + 1
N = int(input())
if rep_copas + rep_medallas <= N:
	print('YES')
else:
	print('NO')


l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
n = int(input())
z1 = sum(l)
z2 = sum(l1)
if z1 % 5 == 0:
	s1 = z1 // 5
else:
	s1 = z1 // 5 + 1
if z2 % 10 == 0:
	s2 = z2 // 10
else:
	s2 = z2 // 10 + 1
if s2 + s1 > n:
	print('NO')
else:
	print('YES')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
flag = 0
for k in range(1, n + 1):
	if k * 5 >= sum(a) and (n - k) * 10 >= sum(b) and (sum(a) != 0):
		flag += 1
	if sum(a) == 0 and n * 10 >= sum(b):
		flag += 1
if flag == 0:
	print('NO')
else:
	print('YES')


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
n = int(input())
(aSum, bSum) = (0, 0)
for i in range(3):
	aSum += a[i]
	bSum += b[i]
print('YES' if int(aSum / 5 + 0.999) + int(bSum / 10 + 0.999) <= n else 'NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
ans = a[0] + a[1] + a[2]
n -= ans // 5 + (ans % 5 > 0)
ans = b[0] + b[1] + b[2]
n -= ans // 10 + (ans % 10 > 0)
print(['NO', 'YES'][n >= 0])


from math import ceil
cups = map(int, input().split())
medals = map(int, input().split())
shelves = int(input())
if ceil(sum(cups) / 5) + ceil(sum(medals) / 10) <= shelves:
	print('YES')
else:
	print('NO')


c_list = str(input()).split()
c_list = [int(it) for it in c_list]
c = sum(c_list)
m_list = str(input()).split()
m_list = [int(it) for it in m_list]
m = sum(m_list)
n = int(input())
if int((c + 4) / 5) + int((m + 9) / 10) > n:
	print('NO')
else:
	print('YES')


(c1, c2, c3) = map(int, input().split())
(m1, m2, m3) = map(int, input().split())
shelves = int(input())
medals = m1 + m2 + m3
cups = c1 + c2 + c3
cup = 0
medal = 0
if cups % 5 == 0:
	cup += cups // 5
else:
	cup += cups // 5 + 1
if medals % 10 == 0:
	medal += medals // 10
else:
	medal += medals // 10 + 1
if medal + cup <= shelves:
	print('YES')
else:
	print('NO')


a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
totalCup = sum(a)
totalMedal = sum(b)
x = int(totalCup / 5)
if x * 5 < totalCup and totalCup != 0:
	x += 1
y = int(totalMedal / 10)
if y * 10 < totalMedal and totalMedal != 0:
	y += 1
n = int(input())
if x + y > n:
	print('NO')
else:
	print('YES')


(a1, a2, a3) = [int(i) for i in input().split()]
(b1, b2, b3) = [int(i) for i in input().split()]
shelfs = int(input())
a = a1 + a2 + a3
b = b1 + b2 + b3
if a % 5 == 0:
	a_s = a // 5
else:
	a_s = a // 5 + 1
if b % 10 == 0:
	b_s = b // 10
else:
	b_s = b // 10 + 1
if a_s + b_s > shelfs:
	print('NO')
elif a_s + b_s < shelfs:
	print('YES')
elif a_s + b_s == shelfs:
	print('YES')


a = sum(list(map(int, input().split())))
b = sum(list(map(int, input().split())))
n = int(input())
a = -a // 5
b = -b // 10
if -a - b > n:
	print('NO')
else:
	print('YES')


import math
a = sum(list(map(int, input().split())))
b = sum(list(map(int, input().split())))
x = int(input())
y = math.ceil(a / 5)
z = math.ceil(b / 10)
if y + z > x:
	print('NO')
else:
	print('YES')


(a1, a2, a3) = [int(x) for x in input().split(' ')]
(b1, b2, b3) = [int(x) for x in input().split(' ')]
n = int(input())
at = (a1 + a2 + a3) // 5
ar = (a1 + a2 + a3) % 5
bt = (b1 + b2 + b3) // 10
br = (b1 + b2 + b3) % 10
if ar > 0:
	at = at + 1
if br > 0:
	bt = bt + 1
if at + bt <= n:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
n1 = a1 + a2 + a3
n2 = b1 + b2 + b3
c1 = 0
c2 = 0
while n1 > 0:
	n1 = n1 - 5
	c1 = c1 + 1
while n2 > 0:
	n2 = n2 - 10
	c2 = c2 + 1
if c1 + c2 <= n:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
n = a + b + c
(a, b, c) = map(int, input().split())
m = a + b + c
d = int(input())
if n % 5:
	n = int(n / 5)
	n += 1
else:
	n = n / 5
if m % 10:
	m = int(m / 10)
	m += 1
else:
	m = m / 10
if d >= n + m:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
c = 0
s = a1 + a2 + a3
s1 = b1 + b2 + b3
c = c + int(s // 5)
if s % 5 > 0:
	c = c + 1
c = c + int(s1 // 10)
if s1 % 10 > 0:
	c = c + 1
if c <= n:
	print('YES')
else:
	print('NO')


count = 0
lst1 = [int(x) for x in input().split()]
sum1 = sum(lst1)
if sum1 % 5 == 0:
	count += sum1 / 5
else:
	count += sum1 // 5 + 1
lst2 = [int(x) for x in input().split()]
sum2 = sum(lst2)
if sum2 % 10 == 0:
	count += sum2 / 10
else:
	count += sum2 // 10 + 1
n = int(input())
if count > n:
	print('NO')
else:
	print('YES')


import math
cups = [int(i) for i in input().split()]
medals = [int(i) for i in input().split()]
n = int(input())
c = sum(cups)
m = sum(medals)
shelves = math.ceil(c / 5) + math.ceil(m / 10)
if shelves <= n:
	print('YES')
else:
	print('NO')


def answer():
	a = sum([int(x) for x in input().split()])
	b = sum([int(x) for x in input().split()])
	c = int(input())
	s_cups = int(a / 5)
	if a % 5:
		s_cups += 1
	s_medals = int(b / 10)
	if b % 10:
		s_medals += 1
	if c >= s_medals + s_cups:
		ans = 'YES'
	else:
		ans = 'NO'
	return ans
print(answer())


a = sum(list(map(int, input().split())))
b = sum(list(map(int, input().split())))
print('NYOE S'[(int(a // 5) + 1, int(a // 5))[a % 5 == 0] + (int(b // 10) + 1, int(b // 10))[b % 10 == 0] <= int(input())::2])


(a, b, c) = map(int, input().split())
(p, q, r) = map(int, input().split())
count = 0
n = int(input())
a1 = a + b + c
p1 = p + q + r
(h, h1) = divmod(a1, 5)
if h1 == 0:
	count = h
else:
	count = h + 1
(g, g1) = divmod(p1, 10)
if g1 == 0:
	count += g
else:
	count = count + g + 1
if count <= n:
	print('YES')
else:
	print('NO')


a = map(int, input().split(' '))
b = map(int, input().split(' '))
n = int(input())
cups = 0
med = 0
for i in a:
	cups += i
for j in b:
	med += j
if cups % 5 == 0:
	cupsused = n - cups // 5
else:
	cupsused = n - cups // 5 - 1
if med % 10 == 0:
	medsuse = cupsused - med // 10
else:
	medsuse = cupsused - med // 10 - 1
if medsuse >= 0:
	print('YES')
else:
	print('NO')


cups = [int(x) for x in input().split()]
medals = [int(x) for x in input().split()]
n = int(input())
t_cups = sum(cups)
t_medals = sum(medals)
min_cups = (t_cups + 4) // 5
min_medals = (t_medals + 9) // 10
if min_medals + min_cups > n:
	print('NO')
else:
	print('YES')


a = list(map(int, input().rstrip().split()))
b = list(map(int, input().rstrip().split()))
c = int(input())
if sum(a) % 5 == 0:
	a1 = sum(a) / 5
else:
	a1 = sum(a) // 5 + 1
if sum(b) % 10 == 0:
	b1 = sum(b) / 10
else:
	b1 = sum(b) // 10 + 1
if c >= a1 + b1:
	print('YES')
else:
	print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	a = LI()
	b = LI()
	n = I()
	t = (sum(a) + 4) // 5
	t += (sum(b) + 9) // 10
	if n < t:
		return 'NO'
	return 'YES'
print(main())


l = list(map(int, input().split()))
a = sum(l)
p = list(map(int, input().split()))
b = sum(p)
n = int(input())
z = 0
if a % 5 == 0:
	q = a // 5
else:
	q = a // 5 + 1
if b % 10 == 0:
	w = b // 10
else:
	w = b // 10 + 1
if q + w > n:
	print('NO')
else:
	print('YES')


from sys import stdin
__author__ = 'artyom'

def read_next_line():
	return sum(list(map(int, stdin.readline().strip().split())))

def ceildiv(a, b):
	return -(-a // b)
a = read_next_line()
b = read_next_line()
n = read_next_line()
print('YES' if ceildiv(a, 5) + ceildiv(b, 10) <= n else 'NO')


i = lambda n: -(-sum(map(int, input().split())) // n)
print(['YES', 'NO'][i(5) + i(10) > i(1)])


a = sum(list(map(int, input().split())))
b = sum(list(map(int, input().split())))
n = int(input())
m = a // 5 + [0, 1][a % 5 != 0]
z = b // 10 + [0, 1][b % 10 != 0]
print(['NO', 'YES'][m + z <= n])


(a1, a2, a3) = [int(x) for x in input().split()]
(b1, b2, b3) = [int(x) for x in input().split()]
m = int(input())
if int((a1 + a2 + a3 + 4) / 5) + int((b1 + b2 + b3 + 9) / 10) > m:
	print('NO')
else:
	print('YES')


import math
sa = input().split(' ')
sa2 = input().split(' ')
sa3 = int(input())
cups = [int(x) for x in sa]
medals = [int(x) for x in sa2]
if math.ceil(sum(cups) / 5) + math.ceil(sum(medals) / 10) > sa3:
	print('NO')
else:
	print('YES')


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
x = math.ceil(sum(get_int_list()) / 5) + math.ceil(sum(get_int_list()) / 10)
if x > get_int():
	print('NO')
else:
	print('YES')


import math
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
a1 = sum(a)
b1 = sum(b)
m = 0
k = math.ceil(a1 / 5)
p = 0
p = math.ceil(b1 / 10)
m = k + p
if m <= n:
	print('YES')
else:
	print('NO')


cups = sum(list(map(int, input().split())))
medals = sum(list(map(int, input().split())))
x = int(input())
ans = int((cups + 4) / 5)
ans2 = int((medals + 9) / 10)
if ans + ans2 <= x:
	print('YES')
else:
	print('NO')


def solve(n, cups, medals):
	cupsum = sum(cups)
	medalsum = sum(medals)
	cupneed = int(cupsum / 5)
	medalneed = int(medalsum / 10)
	if cupsum % 5 != 0:
		cupneed += 1
	if medalsum % 10 != 0:
		medalneed += 1
	if cupneed + medalneed <= n:
		return 'YES'
	else:
		return 'NO'
cups = map(int, input().split(' '))
medals = list(map(int, input().split(' ')))
n = int(input())
print(solve(n, cups, medals))


import math
a = [int(i) for i in input().split(' ')]
b = [int(i) for i in input().split(' ')]
n = int(input())
sa = 0
sb = 0
na = 0
nb = 0
for i in range(3):
	sa = sa + a[i]
	sb = sb + b[i]
na = math.ceil(sa / 5)
nb = math.ceil(sb / 10)
if n >= nb + na:
	print('YES')
else:
	print('NO')


def check(sumA, sumB, num):
	numA = sumA // 5
	if sumA % 5 != 0:
		numA += 1
	numB = sumB // 10
	if sumB % 10 != 0:
		numB += 1
	if num < numA + numB:
		return False
	else:
		return True

def main():
	a = input().split(' ')
	b = input().split(' ')
	num = int(input())
	sumA = 0
	sumB = 0
	for i in range(0, 3):
		a[i] = int(a[i])
		b[i] = int(b[i])
		sumA += a[i]
		sumB += b[i]
	if check(sumA, sumB, num) == True:
		print('YES')
	else:
		print('NO')
main()


import math
import string
import functools
a = sum([int(x) for x in input().split()])
b = sum([int(x) for x in input().split()])
c = int(input())
d = math.ceil(a / 5) + math.ceil(b / 10)
print('YES' if d <= c else 'NO')


a = sum(map(int, input().split()))
b = sum(map(int, input().split()))
n = int(input())
k = (a + 4) // 5 + (b + 9) // 10
if n >= k:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
n1 = (sum(a) - 1) // 5 + 1
n2 = (sum(b) - 1) // 10 + 1
if n1 + n2 <= n:
	print('YES')
else:
	print('NO')


from sys import stdin
print(('YES', 'NO')[(sum(map(int, stdin.readline().split())) + 4) // 5 + (sum(map(int, stdin.readline().split())) + 9) // 10 - int(stdin.readline()) > 0])


(a1, a2, a3) = map(int, input().strip().split(' '))
(b1, b2, b3) = map(int, input().strip().split(' '))
n = int(input())
cub = a1 + a2 + a3
med = b1 + b2 + b3
res = cub // 5 + med // 10
if cub % 5:
	res += 1
if med % 10:
	res += 1
if res > n:
	print('NO')
else:
	print('YES')


import sys
in_str1 = sys.stdin.readline().split()
in_str2 = sys.stdin.readline().split()
n = int(sys.stdin.readline())
a1 = int(in_str1[0])
a2 = int(in_str1[1])
a3 = int(in_str1[2])
b1 = int(in_str2[0])
b2 = int(in_str2[1])
b3 = int(in_str2[2])
suma = a1 + a2 + a3
sumb = b1 + b2 + b3
ap = int(suma / 5)
if suma % 5 != 0:
	ap += 1
bp = int(sumb / 10)
if sumb % 10 != 0:
	bp += 1
if ap + bp <= n:
	print('YES')
else:
	print('NO')


def main():
	from sys import stdin, stdout
	from math import ceil
	a = sum(map(int, stdin.readline().split()))
	b = sum(map(int, stdin.readline().split()))
	c = int(stdin.readline())
	counter = 0
	if a:
		counter += 1
		counter += ceil(a / 5) - 1
	if b:
		counter += 1
		counter += ceil(b / 10) - 1
	if counter <= c:
		stdout.write('YES')
	else:
		stdout.write('NO')
main()


import sys
cups = sum(list(map(int, input().split())))
medals = sum(list(map(int, input().split())))
n = int(input())
answer = 'NO'
if cups % 5 == 0:
	cups_place = cups // 5
else:
	cups_place = cups // 5 + 1
if medals % 10 == 0:
	medals_place = medals // 10
else:
	medals_place = medals // 10 + 1
places = cups_place + medals_place
if n >= places:
	answer = 'YES'
print(answer)


k = sum(map(int, input().split()))
m = sum(map(int, input().split()))
polki = int(input())
kp = k // 5 + 1 if k % 5 else k // 5
mp = m // 10 + 1 if m % 10 else m // 10
if kp + mp <= polki:
	print('YES')
else:
	print('NO')


C = sum(list(map(int, input().split())))
M = sum(list(map(int, input().split())))
N = int(input())
print('YES' if C // 5 + (C % 5 > 0) + M // 10 + (M % 10 > 0) <= N else 'NO')


def main():
	flin = input().split()
	seclin = input().split()
	tline = input()
	s = int(tline)
	totalcups = 0
	totalmedals = 0
	for i in range(0, 3):
		totalcups = totalcups + int(flin[i])
		totalmedals = totalmedals + int(seclin[i])
	smedals = totalmedals / 10
	ismedals = int(smedals)
	if smedals > ismedals:
		ismedals = ismedals + 1
	scups = totalcups / 5
	iscups = int(scups)
	if scups > iscups:
		iscups = iscups + 1
	stotal = ismedals + iscups
	if stotal <= s:
		print('YES')
	else:
		print('NO')
main()


import math
inp = input().split()
cups = int(inp[0]) + int(inp[1]) + int(inp[2])
inp = input().split()
medals = int(inp[0]) + int(inp[1]) + int(inp[2])
n = int(input())
maxn = cups + medals
minn = math.ceil(cups / 5) + math.ceil(medals / 10)
if minn <= n:
	print('YES')
else:
	print('NO')


def shelves_fit(cups, medals, shelves):
	while shelves > 0 and cups > 0 or medals > 0:
		if shelves == 0:
			return 'NO'
		if cups > 0:
			cups -= 5
			shelves -= 1
		elif medals > 0:
			medals -= 10
			shelves -= 1
	if cups <= 0 and medals <= 0:
		return 'YES'
	else:
		return 'NO'

def main():
	cups = sum([int(i) for i in input().split()])
	medals = sum([int(i) for i in input().split()])
	shelves = int(input())
	print(shelves_fit(cups, medals, shelves))
main()


from math import ceil
a = input().split()
b = input().split()
n = int(input())
if ceil((int(a[0]) + int(a[1]) + int(a[2])) / 5) + ceil((int(b[0]) + int(b[1]) + int(b[2])) / 10) > n:
	print('NO')
else:
	print('YES')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
if sum(a) % 5 != 0:
	if sum(b) % 10 != 0:
		res = sum(a) // 5 + sum(b) // 10 + 2
	else:
		res = sum(a) // 5 + sum(b) // 10 + 1
elif sum(b) % 10 != 0:
	res = sum(a) // 5 + sum(b) // 10 + 1
else:
	res = sum(a) // 5 + sum(b) // 10
if res <= n:
	print('YES')
else:
	print('NO')


def check(var, div):
	if var and var <= div:
		new_var = 1
	elif var % div == 0:
		new_var = int(var / div)
	else:
		new_var = int(var / div) + 1
	return new_var
cups = sum([int(x) for x in input().split()])
medals = sum([int(x) for x in input().split()])
shelf = int(input())
shelfCups = check(cups, 5)
shelfMedals = check(medals, 10)
if shelfCups + shelfMedals > shelf:
	print('NO')
else:
	print('YES')


a = input().split()
b = input().split()
c = int(a[0]) + int(a[1]) + int(a[2])
d = int(b[0]) + int(b[1]) + int(b[2])
n = int(input())
e = 0
f = 0
if c >= 1:
	if c % 5 == 0:
		e = int(c / 5)
	else:
		e = int(c / 5) + 1
if d >= 1:
	if d % 10 == 0:
		f = int(d / 10)
	else:
		f = int(d / 10) + 1
if e + f <= n:
	print('YES')
else:
	print('NO')


import math
a = input().split()
b = input().split()
n = int(input())
c = int(a[0]) + int(a[1]) + int(a[2])
m = int(b[0]) + int(b[1]) + int(b[2])
numC = math.ceil(c / 5)
numM = math.ceil(m / 10)
if numC + numM <= n:
	print('YES')
else:
	print('NO')


s = list(map(int, input().split()))
c = list(map(int, input().split()))
a = int(input())
b = 0
d = 0
e = s[0] + s[1] + s[2]
y = c[0] + c[1] + c[2]
if e % 5 == 0:
	b = e // 5
else:
	b = e // 5 + 1
if y % 10 == 0:
	d = y // 10
else:
	d = y // 10 + 1
if b + d <= a:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
cups = a[0] + a[1] + a[2]
medals = b[0] + b[1] + b[2]
count = 0
while cups > 0:
	cups = cups - 5
	count = count + 1
while medals > 0:
	medals -= 10
	count = count + 1
if count <= n:
	print('YES')
else:
	print('NO')


def main():
	cNum = sum(list(map(int, input().split())))
	mNum = sum(list(map(int, input().split())))
	n = int(input())
	count = cNum // 5 + mNum // 10
	if cNum % 5 != 0:
		count += 1
	if mNum % 10 != 0:
		count += 1
	print('YES' if count <= n else 'NO')
main()


(a, b, c) = map(int, input().split(' '))
(a1, b1, c1) = map(int, input().split(' '))
d = int(input())
e = (a + b + c) // 5
if (a + b + c) % 5 != 0:
	e += 1
f = (a1 + b1 + c1) // 10
if (a1 + b1 + c1) % 10 != 0:
	f += 1
if e + f > d:
	print('NO')
else:
	print('YES')


from math import ceil

def solve():
	a = [int(s) for s in input().split()]
	b = [int(s) for s in input().split()]
	n = int(input())
	k = ceil(sum(a) / 5)
	m = ceil(sum(b) / 10)
	if k + m <= n:
		print('YES')
	else:
		print('NO')
solve()


(a, b, c) = map(int, input().split())
n = a + b + c
(a, b, c) = map(int, input().split())
m = a + b + c
s = int(input())
n = n // 5 + int(n % 5 != 0)
m = m // 10 + int(m % 10 != 0)
if n + m <= s:
	print('YES')
else:
	print('NO')


(a_1, a_2, a_3) = map(int, input().split())
(b_1, b_2, b_3) = map(int, input().split())
n = int(input())
a = a_1 + a_2 + a_3
b = b_1 + b_2 + b_3
if a % 5 == 0:
	x = a // 5
if a % 5 != 0:
	x = a // 5 + 1
if b % 10 == 0:
	y = b // 10
if b % 10 != 0:
	y = b // 10 + 1
s = x + y
if s > n:
	print('NO')
if s <= n:
	print('YES')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
a = a1 + a2 + a3
b = b1 + b2 + b3
ra = a // 5
rb = b // 10
if a % 5 != 0:
	ra = ra + 1
if b % 10 != 0:
	rb = rb + 1
total = ra + rb
if n >= total:
	print('YES')
else:
	print('NO')


s1 = input().split()
s1 = [int(i) for i in s1]
s2 = input().split()
s2 = [int(i) for i in s2]
n = int(input())
sum1 = sum(s1)
sum2 = sum(s2)
a = sum1 // 5
b = sum2 // 10
c = a + b
if sum1 % 5 > 0:
	c += 1
if sum2 % 10 > 0:
	c += 1
if n >= c:
	print('YES')
else:
	print('NO')


from math import ceil
is_debug = False
c = [int(x) for x in input().split()]
m = [int(x) for x in input().split()]
n = int(input())
t_c = sum(c, 0)
t_m = sum(m, 0)
print(f't_c={t_c}, t_m={t_m}') if is_debug else ''
v_c = ceil(t_c / 5)
v_m = ceil(t_m / 10)
v = v_c + v_m
print(f'v_c={v_c}, v_m={v_m}, v={v}') if is_debug else ''
print(f"{('YES' if v <= n else 'NO')}")


(a, a1, a2) = [int(i) for i in input().split()]
(b, b1, b2) = [int(x) for x in input().split()]
c = int(input())
x = a + a1 + a2
m = b + b1 + b2
l = x // 5
o = m // 10
if x % 5 != 0:
	l += 1
if m % 10 != 0:
	o += 1
if l + o > c:
	print('NO')
else:
	print('YES')


import math
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
n = int(input())
nk = 0
nm = 0
c = 0
for i in range(3):
	nk += a[i]
	nm += b[i]
if math.ceil(nk / 5) + math.ceil(nm / 10) <= n:
	print('YES')
else:
	print('NO')


import math as m
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
sum1 = m.ceil(sum(a) / 5)
sum2 = m.ceil(sum(b) / 10)
n -= sum1
if n - sum2 >= 0:
	print('YES')
else:
	print('NO')


from math import ceil
cubes = map(int, input().split())
medals = map(int, input().split())
n = int(input())
cont_cubes = sum(cubes)
cont_medals = sum(medals)
n_for_cubes = ceil(cont_cubes / 5)
n_for_medals = ceil(cont_medals / 10)
n_need = n_for_cubes + n_for_medals
if n_need <= n:
	print('YES')
else:
	print('NO')


def ceil(m, n):
	if m / n == m // n:
		return m // n
	else:
		return m // n + 1
l1 = input().split()
a = int(l1[0]) + int(l1[1]) + int(l1[2])
l2 = input().split()
b = int(l2[0]) + int(l2[1]) + int(l2[2])
n = int(input())
if ceil(a, 5) + ceil(b, 10) <= n:
	print('YES')
else:
	print('NO')


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
N = int(input())
medal = sum(b)
cups = sum(a)
for i in range(N):
	if medal:
		if medal > 10:
			medal -= 10
		else:
			medal = 0
	elif cups:
		if cups > 5:
			cups -= 5
		else:
			cups = 0
if medal > 0 or cups > 0:
	print('NO')
else:
	print('YES')


a = input().split()
a1 = int(a[0])
a2 = int(a[1])
a3 = int(a[2])
b = input().split()
b1 = int(b[0])
b2 = int(b[1])
b3 = int(b[2])
n = int(input())
x = 0
y = 0
if 0 <= a1 <= 100 and 0 <= a2 <= 100 and (0 <= a3 <= 100):
	x = a1 + a2 + a3
	if x % 5 == 0:
		y = x / 5
	else:
		y = x // 5 + 1
q = 0
w = 0
if 0 <= b1 <= 100 and 0 <= b2 <= 100 and (0 <= b3 <= 100):
	q = b1 + b2 + b3
	if q % 10 == 0:
		w = q / 10
	else:
		w = q // 10 + 1
if int(y + w) <= n and 1 <= n <= 100:
	print('YES')
else:
	print('NO')


import math
cups = list(map(int, input().split()))
medals = list(map(int, input().split()))
n = int(input())
number_cups = sum(cups)
number_medals = sum(medals)
shelves_cups = math.ceil(number_cups / 5)
shelves_medals = math.ceil(number_medals / 10)
if shelves_cups + shelves_medals <= n:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
suma = a1 + a2 + a3
sumb = b1 + b2 + b3
if suma <= 5:
	if suma == 0:
		shelvesa = 0
	else:
		shelvesa = 1
if sumb <= 10:
	if sumb == 0:
		shelvesb = 0
	else:
		shelvesb = 1
if suma > 5:
	if suma % 5 == 0:
		shelvesa = suma // 5
	else:
		shelvesa = suma // 5 + 1
if sumb > 10:
	if sumb % 10 == 0:
		shelvesb = sumb // 10
	else:
		shelvesb = sumb // 10 + 1
if shelvesa + shelvesb > n:
	print('NO')
else:
	print('YES')


li_c = list(map(int, input().split()))
li_m = list(map(int, input().split()))
n = int(input())
a = 0
(a_c, a_m) = (0, 0)
for i in range(3):
	a_c = a_c + li_c[i]
	a_m = a_m + li_m[i]
c1 = a_c / 5
if c1.is_integer():
	c1 = int(c1)
else:
	c1 = int(c1) + 1
n -= c1
c2 = a_m / 10
if c2.is_integer():
	c2 = int(c2)
else:
	c2 = int(c2) + 1
if n >= c2:
	print('YES')
else:
	print('NO')


def fu():
	v = sum(map(int, input().split()))
	return v
a = fu()
b = fu()
n = int(input())
for i in range(n):
	if a > 0:
		a -= 5
	else:
		b -= 10
print('YES') if a <= 0 and b <= 0 else print('NO')


import math
(a, b, c) = map(int, input().split())
(d, e, f) = map(int, input().split())
n = int(input())
q = a + b + c
w = d + e + f
print('YES' if math.ceil(q / 5) + math.ceil(w / 10) <= n else 'NO')


i = lambda : map(int, input().split())
(a, b, n) = (sum(i()), sum(i()), *i())
print('YNEOS'[-(-a // 5) - -b // 10 > n::2])


arr1 = sum(list(map(int, input().split())))
arr2 = sum(list(map(int, input().split())))
n = int(input())
(x, y) = (arr1 // 5, arr2 // 10)
if arr1 % 5:
	x += 1
if arr2 % 10:
	y += 1
print('YES' if x + y <= n else 'NO')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
m = a1 + a2 + a3
p = b1 + b2 + b3
if m % 5 == 0:
	s = m // 5
else:
	s = m // 5 + 1
if p % 10 == 0:
	d = p // 10
else:
	d = p // 10 + 1
r = d + s
if r <= n:
	print('YES')
else:
	print('NO')


import math
try:
	c = list(map(int, input().split()))
	m = list(map(int, input().split()))
	ans = int(input())
	a = sum(c)
	b = sum(m)
	d = math.ceil(a / 5)
	e = math.ceil(b / 10)
	if ans >= d + e:
		print('YES')
	else:
		print('NO')
except:
	pass


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
cup = a1 + a2 + a3
medals = b1 + b2 + b3
n -= cup // 5
n -= medals // 10
if cup < 5 and cup != 0:
	n -= 1
if medals < 10 and medals != 0:
	n -= 1
if cup > 5 and cup % 5 > 0:
	n -= 1
if medals > 10 and medals % 10 > 0:
	n -= 1
print('NO') if n < 0 else print('YES')


(a1, a2, a3) = map(int, input().split(' '))
(b1, b2, b3) = map(int, input().split(' '))
n = int(input())
s1 = a1 + a2 + a3
s2 = b1 + b2 + b3
if n == 1 and s1 != 0 and (s2 != 0):
	print('NO')
else:
	i = s1 // 5
	j = s2 // 10
	if s1 % 5 != 0:
		i += 1
	if s2 % 10 != 0:
		j += 1
	if i + j <= n:
		print('YES')
	else:
		print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
req_a = (sum(a) + 4) // 5
req_b = (sum(b) + 9) // 10
if req_a + req_b <= n:
	print('YES')
else:
	print('NO')


copas = [int(x) for x in input().split()]
medallas = [int(x) for x in input().split()]
shelves = int(input())
if abs(-sum(copas) // 5) + abs(-sum(medallas) // 10) <= shelves:
	print('YES')
else:
	print('NO')


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
n = int(input())
sk = sum(a)
sm = sum(b)
k = sk // 5 + (1 if sk % 5 > 0 else 0) + sm // 10 + (1 if sm % 10 > 0 else 0)
if k > n:
	print('NO')
else:
	print('YES')


import math
cups = input('')
medals = input('')
shelves = int(input(''))
cupsList = []
medalsList = []
somaMedals = 0
somaCups = 0
cups = cups.split(' ')
medals = medals.split(' ')
for item in cups:
	cupsList.append(int(item))
	somaCups += int(item)
for item in medals:
	medalsList.append(int(item))
	somaMedals += int(item)

def isTrue(lista):
	for i in lista:
		cont = 0
		if i < 0 and i > 100:
			cont += 1
	if cont == 0:
		return True
qtdShelves = math.ceil(somaCups / 5) + math.ceil(somaMedals / 10)
if isTrue(cupsList) == True and isTrue(medalsList) == True and (shelves >= 0 and shelves <= 100):
	if (somaCups, somaMedals > 1 and shelves > 1):
		if shelves >= qtdShelves:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
else:
	print('NO')


from math import *
cup = list(map(int, input().split()))
medal = list(map(int, input().split()))
t = int(input())
ct = sum(cup)
mt = sum(medal)
scup = ceil(ct / 5)
smed = ceil(mt / 10)
rt = scup + smed
if rt <= t:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
coupes = 1 + (a1 + a2 + a3 - 1) // 5
med = 1 + (b1 + b2 + b3 - 1) // 10
if coupes + med <= n:
	print('YES')
else:
	print('NO')


import sys
import math
a = sum(map(int, input().split()))
b = sum(map(int, input().split()))
n = int(input())
print(['NO', 'YES'][(a + 4) // 5 + (b + 9) // 10 <= n])


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
cups = a1 + a2 + a3
medals = b1 + b2 + b3
shelf = 0
shelf += cups // 5
shelf += 0 if cups % 5 == 0 else 1
shelf += medals // 10
shelf += 0 if medals % 10 == 0 else 1
print('YES' if n >= shelf else 'NO')


def cups_and_medals_can_be_put_on_shelves(c, m, s):
	while s > 0 and c > 0 or m > 0:
		if s == 0:
			return 'NO'
		if c > 0:
			c -= 5
			s -= 1
		elif m > 0:
			m -= 10
			s -= 1
	if c <= 0 and m <= 0:
		return 'YES'
	return 'NO'

def main():
	cups = list(map(int, input().split()))
	medals = list(map(int, input().split()))
	shelves = int(input())
	output = cups_and_medals_can_be_put_on_shelves(sum(cups), sum(medals), shelves)
	print(output)
main()


import math
cups = 0
temp = input().split()
for val in temp:
	cups += int(val)
medals = 0
temp = input().split()
for val in temp:
	medals += int(val)
n = input()
n = int(n)
req = math.ceil(cups / 5) + math.ceil(medals / 10)
if req > n:
	print('NO')
else:
	print('YES')


(m1, k1) = (0, 0)
m = list(map(int, input().split()))
k = list(map(int, input().split()))
n = int(input())
for i in range(len(m)):
	m1 += m[i]
	k1 += k[i]
if (m1 + 4) // 5 + (k1 + 9) // 10 <= n:
	print('YES')
else:
	print('NO')


sum1 = sum([int(n) for n in input().split()])
sum2 = sum([int(n) for n in input().split()])
shelves = int(input())
while shelves > 0:
	if sum1 > 0:
		sum1 -= 5
	elif sum2 > 0:
		sum2 -= 10
	shelves -= 1
if sum1 > 0 or sum2 > 0:
	print('NO')
else:
	print('YES')


(a, b, c) = map(int, input().split())
(p, q, r) = map(int, input().split())
n = int(input())
x = a + b + c
y = p + q + r
if x % 5 == 0:
	xx = x // 5
else:
	xx = x // 5 + 1
if y % 10 == 0:
	yy = y // 10
else:
	yy = y // 10 + 1
if xx + yy <= n:
	print('YES')
else:
	print('NO')


from math import ceil
k = sum(map(int, input().split()))
m = sum(map(int, input().split()))
p = int(input())
k = ceil(k / 5.0)
m = ceil(m / 10.0)
if p - m - k >= 0:
	print('YES')
else:
	print('NO')


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
n = int(input())
print('NO' if (a[0] + a[1] + a[2] + 4) // 5 + (b[0] + b[1] + b[2] + 9) // 10 > n else 'YES')


cups = [int(x) for x in input().split()]
medals = [int(x) for x in input().split()]
n = int(input())
totalc = sum(cups)
totalm = sum(medals)
a = 0
count1 = totalc // 5 + (a if totalc % 5 == 0 else 1)
count2 = totalm // 10 + (a if totalm % 10 == 0 else 1)
if count1 + count2 <= n:
	print('YES')
else:
	print('NO')


string = input()
a = string.split(' ')
string = input()
b = string.split(' ')
n = int(input())
for i in range(3):
	a[i] = int(a[i])
	b[i] = int(b[i])
n_a = sum(a)
n_b = sum(b)
while n >= 0:
	if n_a > 0:
		n_a -= 5
		n -= 1
	elif n_b > 0:
		n_b -= 10
		n -= 1
	else:
		break
if n >= 0:
	print('YES')
else:
	print('NO')


(a1, b1, c1) = list(map(int, input().strip().split()[:3]))
(a2, b2, c2) = list(map(int, input().strip().split()[:3]))
n = int(input())
k1 = a1 + b1 + c1
k2 = a2 + b2 + c2
if k1 > 5:
	if k1 % 5 == 0:
		s1 = int(k1 / 5)
	else:
		s1 = int(k1 / 5) + 1
elif k1 == 0:
	s1 = 0
else:
	s1 = 1
if k2 > 10:
	if k2 % 10 == 0:
		s2 = int(k2 / 10)
	else:
		s2 = int(k2 / 10) + 1
elif k2 == 0:
	s2 = 0
else:
	s2 = 1
if s1 + s2 <= n:
	print('YES')
else:
	print('NO')


total_cups = 0
total_medals = 0
enter = 0
for i in range(0, 2):
	ch = input()
	liste = ch.split(' ')
	liste2 = [int(l) for l in liste]
	if enter == 0:
		total_cups = sum(liste2)
	else:
		total_medals = sum(liste2)
	enter = 1
n = input()
last_shelves = 0
if total_cups % 5 > 0:
	last_shelves = last_shelves + 1
if total_medals % 10 > 0:
	last_shelves = last_shelves + 1
shelves_needed = int(total_cups / 5) + int(total_medals / 10) + last_shelves
if int(n) >= shelves_needed:
	print('YES')
else:
	print('NO')


ar = map(int, input().split())
br = map(int, input().split())
n = int(input())
print('YES' if (sum(ar) + 4) // 5 + (sum(br) + 9) // 10 <= n else 'NO')


from math import ceil
(a, b, c) = map(int, input().split())
(x, y, z) = map(int, input().split())
n = int(input())
cup = ceil((a + b + c) / 5)
medal = ceil((x + y + z) / 10)
if cup + medal <= n:
	print('YES')
else:
	print('NO')


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
cups = sum(read_ints())
medal = sum(read_ints())
shelves = read_int()
need = cups // 5 + (1 if cups % 5 > 0 else 0)
need += medal // 10 + (1 if medal % 10 > 0 else 0)
if shelves >= need:
	print('YES')
else:
	print('NO')


l1 = [int(x) for x in input().split()]
l2 = [int(x) for x in input().split()]
n = int(input())
(a, b) = (sum(l1), sum(l2))
c = 0
if a % 5 == 0:
	c += a // 5
else:
	c += a // 5 + 1
if b % 10 == 0:
	c += b // 10
else:
	c += b // 10 + 1
print(['YES', 'NO'][c > n])


(a, b, c) = map(int, input().split())
(d, e, f) = map(int, input().split())
g = int(input())
print('YES' if -(-(a + b + c) // 5 + -(d + e + f) // 10) <= g else 'NO')


A = list(map(int, input().split()))
B = list(map(int, input().split()))
n = int(input())
(sum, sum1) = (0, 0)
for i in range(len(A)):
	sum += A[i]
for j in range(len(B)):
	sum1 += B[j]
if sum % 5 == 0:
	sum = sum // 5
else:
	sum = sum // 5 + 1
if sum1 % 10 == 0:
	sum1 = sum1 // 10
else:
	sum1 = sum1 // 10 + 1
if sum + sum1 <= n:
	print('YES')
else:
	print('NO')


from sys import stdin
(a1, a2, a3) = map(int, stdin.readline().rstrip().split(' '))
cups = a1 + a2 + a3
(b1, b2, b3) = map(int, stdin.readline().rstrip().split(' '))
medals = b1 + b2 + b3
n = int(stdin.readline())
while True:
	if n == 0 and (cups > 0 or medals > 0):
		print('NO')
		exit()
	if cups == 0 and medals == 0:
		print('YES')
		exit()
	cups_to_remove = min(5, cups)
	if cups_to_remove > 0:
		cups -= cups_to_remove
		n -= 1
	else:
		medals_to_remove = min(10, medals)
		medals -= medals_to_remove
		n -= 1


a1 = input().split()
b1 = input().split()
n = int(input())
(a, b) = (0, 0)
for i in range(3):
	a += int(a1[i])
	b += int(b1[i])
a2 = a // 5
a3 = a % 5
b2 = b // 10
b3 = b % 10
if a3 == 0 and b3 == 0:
	if a2 + b2 <= n:
		k = 1
	else:
		k = 0
elif a3 != 0 and b3 == 0 or (a3 == 0 and b3 != 0):
	if a2 + 1 + b2 <= n:
		k = 1
	else:
		k = 0
elif a2 + 2 + b2 <= n:
	k = 1
else:
	k = 0
if k == 1:
	print('YES')
if k == 0:
	print('NO')


def main():
	x = input().split()
	y = input().split()
	z = int(input())
	cups = []
	medals = []
	for i in range(len(x)):
		cups.append(int(x[i]))
		medals.append(int(y[i]))
	if sum(cups) % 5 == 0:
		a = sum(cups) // 5
	elif sum(cups) % 5 != 0:
		a = sum(cups) // 5 + 1
	if sum(medals) % 10 == 0:
		b = sum(medals) // 10
	elif sum(medals) % 10 != 0:
		b = sum(medals) // 10 + 1
	if a + b > z:
		print('NO')
	else:
		print('YES')
main()


import math
(c, m) = ((int(num) for num in input().split()) for _ in range(2))
(a, b) = (math.ceil(sum(c) / 5), math.ceil(sum(m) / 10))
print('YES' if a + b <= int(input()) else 'NO')


(a1, a2, a3) = map(int, input().strip().split())
(b1, b2, b3) = map(int, input().strip().split())
n = int(input())
x = a1 + a2 + a3
y = b1 + b2 + b3
if x % 5 == 0:
	x = x / 5
else:
	x = x // 5 + 1
if y % 10 == 0:
	y = y / 10
else:
	y = y // 10 + 1
if x + y <= n:
	print('YES')
else:
	print('NO')


cups = [int(x) for x in input().split(' ')]
medals = [int(x) for x in input().split(' ')]
n = int(input())
sum_cups = sum(cups)
sum_medals = sum(medals)
if int((sum_cups + 4) / 5) + int((sum_medals + 9) / 10) <= n:
	print('YES')
else:
	print('NO')


from math import ceil
a = input().split()
b = input().split()
c = int(input())
d = int(a[0]) + int(a[1]) + int(a[2])
e = int(b[0]) + int(b[1]) + int(b[2])
d = ceil(d / 5)
e = ceil(e / 10)
f = d + e
if c >= f:
	print('YES')
else:
	print('NO')


import math
cups = list(map(int, input().split()))
medals = list(map(int, input().split()))
n = int(input())
n1 = math.ceil(sum(cups) / 5)
n2 = math.ceil(sum(medals) / 10)
if n1 + n2 > n:
	print('NO')
else:
	print('YES')


from sys import stdin
inFile = stdin
tokens = []
tokens_next = 0

def next_str():
	global tokens, tokens_next
	while tokens_next >= len(tokens):
		tokens = inFile.readline().split()
		tokens_next = 0
	tokens_next += 1
	return tokens[tokens_next - 1]

def nextInt():
	return int(next_str())
a = [nextInt() for i in range(3)]
a = sum(a)
b = [nextInt() for i in range(3)]
b = sum(b)
n = nextInt()
from math import ceil
if n >= ceil(a / 5) + ceil(b / 10):
	print('YES')
else:
	print('NO')


from functools import reduce
from math import ceil
cups = input().strip().split(' ')
cups = [int(x) for x in cups]
medals = input().strip().split(' ')
medals = [int(x) for x in medals]
n = int(input())
f = lambda x, y: x + y
totalCups = reduce(f, cups)
totalMedals = reduce(f, medals)
nCups = ceil(totalCups / 5)
nMedals = ceil(totalMedals / 10)
if nCups + nMedals <= n:
	print('YES')
else:
	print('NO')


l = list(map(int, input().split()))
d = list(map(int, input().split()))
n = int(input())
x = sum(l)
y = sum(d)
if x % 5 != 0:
	x = x // 5 + 1
else:
	x = x // 5
if y % 10 != 0:
	y = y // 10 + 1
else:
	y = y // 10
s = x + y
if s <= n:
	print('YES')
else:
	print('NO')


CUPS = sum([int(s) for s in input().split()])
MEDALS = sum([int(s) for s in input().split()])
shelf = int(input())
if CUPS % 5 != 0:
	n1 = CUPS // 5 + 1
else:
	n1 = CUPS // 5
if MEDALS % 10 != 0:
	n2 = MEDALS // 10 + 1
else:
	n2 = MEDALS // 10
if n1 + n2 <= shelf:
	print('YES')
else:
	print('NO')


import math as m
(a, b, c) = (sum(map(int, input().split())), sum(map(int, input().split())), int(input()))
print(['YES', 'NO'][m.ceil(a / 5) + m.ceil(b / 10) > c])


a = input()
b = eval(a.replace(' ', '+'))
c = input()
d = eval(c.replace(' ', '+'))
z = -(b // -5) + -(d // -10)
x = int(input())
print('YES' if z <= x else 'NO')


def main():
	from math import ceil
	n_cups = sum([int(_) for _ in input().split()])
	n_medals = sum([int(_) for _ in input().split()])
	n_shelves = int(input())
	n_must_have_shelves = ceil(n_cups / 5) + ceil(n_medals / 10)
	print('YES' if n_shelves >= n_must_have_shelves else 'NO')
main()


cups = list(map(int, input().split()))
medals = list(map(int, input().split()))
n = int(input())
if sum(medals) >= 10:
	if sum(medals) % 10 == 0:
		medalgroup = sum(medals) // 10
	else:
		medalgroup = sum(medals) // 10 + 1
elif sum(medals) != 0 and sum(medals) < 10:
	medalgroup = 1
elif sum(medals) == 0:
	medalgroup = 0
if sum(cups) >= 5:
	if sum(cups) % 5 == 0:
		cupgroup = sum(cups) // 5
	else:
		cupgroup = sum(cups) // 5 + 1
elif sum(cups) != 0 and sum(cups) < 5:
	cupgroup = 1
elif sum(cups) == 0:
	cupgroup = 0
if medalgroup + cupgroup <= n:
	print('YES')
else:
	print('NO')


import math
cupstr = input().split(' ')
medstr = input().split(' ')
n = int(input())
medcount = 0
cupcount = 0
for s in medstr:
	medcount += int(s)
for s in cupstr:
	cupcount += int(s)
n -= math.ceil(medcount / 10)
n -= math.ceil(cupcount / 5)
if n < 0:
	print('NO')
else:
	print('YES')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
a = a1 + a2 + a3
b = b1 + b2 + b3
while (a > 0 or b > 0) and n > 0:
	if b == 0:
		if a >= 5:
			a -= 5
		else:
			a = 0
	elif b >= 10:
		b -= 10
	else:
		b = 0
	n -= 1
if a == 0 and b == 0:
	print('YES')
else:
	print('NO')


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
n = int(input())
at = a[0] + a[1] + a[2]
bt = b[0] + b[1] + b[2]
s = 0
for i in range(1000):
	if at > 0:
		if at >= 5:
			at -= 5
			s += 1
		else:
			at -= at
			s += 1
	elif bt > 0:
		if bt >= 10:
			bt -= 10
			s += 1
		else:
			bt -= bt
			s += 1
	else:
		break
else:
	print('1000')
if n - s >= 0:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
n = int(input())
a_s = sum(a)
b_s = sum(b)
kub = a_s // 5
if kub < 0 and a_s != 0:
	kub = 1
elif a_s % 5 > 0:
	kub += 1
med = b_s // 10
if med < 0 and b_s != 0:
	med = 1
elif b_s % 10 > 0:
	med += 1
if med + kub <= n:
	print('YES')
else:
	print('NO')


def rewards(a, b, n):
	sum_a = sum(a)
	sum_b = sum(b)
	if sum_a > 5:
		p1 = sum_a // 5
		p2 = sum_a % 5
		if p2 > 0:
			p = p1 + 1
		else:
			p = p1
	elif sum_a == 0:
		p = 0
	else:
		p = 1
	if sum_b > 10:
		q1 = sum_b // 10
		q2 = sum_b % 10
		if q2 > 0:
			q = q1 + 1
		else:
			q = q1
	elif sum_b == 0:
		q = 0
	else:
		q = 1
	if p + q <= n:
		print('YES')
	else:
		print('NO')
a = list(map(int, input('').split()))
b = list(map(int, input('').split()))
n = int(input(''))
rewards(a, b, n)


cup = sum((int(x) for x in input().split()))
medal = sum((int(x) for x in input().split()))
shelf = int(input())
shelf1 = cup // 5 + (cup % 5 != 0)
shelf2 = medal // 10 + (medal % 10 != 0)
print('YES' if shelf1 + shelf2 <= shelf else 'NO')


import math
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
n = int(input())
sum1 = sum2 = 0
for i in arr1:
	sum1 += i
for i in arr2:
	sum2 += i
num = int(math.ceil(sum1 / 5)) + int(math.ceil(sum2 / 10))
if num <= n:
	print('YES')
else:
	print('NO')


import math
cups = input()
medals = input()
n = int(input())
cups = cups.split(' ')
medals = medals.split(' ')
total_cups = 0
total_medals = 0
for i in cups:
	total_cups += int(i)
total_cups = total_cups * 2
for y in medals:
	total_medals += int(y)
m = 0
if total_cups % 10 != 0:
	m += math.floor(total_cups / 10) + 1
else:
	m += total_cups / 10
if total_medals % 10 != 0:
	m += math.floor(total_medals / 10) + 1
else:
	m += total_medals / 10
if n >= m:
	print('YES')
else:
	print('NO')


import math
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
cups = sum(a)
medals = sum(b)
k = math.ceil(cups / 5)
l = math.ceil(medals / 10)
n = int(input())
if k + l > n:
	print('NO')
else:
	print('YES')


n = list(map(int, input().split()))
p = list(map(int, input().split()))
x = int(input())
i = 0
s = 0
e = 0
while i < len(n):
	s += n[i]
	i += 1
i = 0
while i < len(p):
	e += p[i]
	i += 1
a = s // 5
if s % 5 != 0:
	a += 1
w = e // 10
if e % 10 != 0:
	w += 1
if x >= w + a:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
(d, e, f) = map(int, input().split())
n = int(input())
x = (a + b + c) // 5
y = (d + e + f) // 10
if (a + b + c) % 5 != 0:
	x += 1
if (d + e + f) % 10 != 0:
	y += 1
if x + y <= n:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
if (a[0] + a[1] + a[2]) % 5 == 0:
	cup_shelfs = int((a[0] + a[1] + a[2]) // 5)
elif a[0] + a[1] + a[2] > 0:
	cup_shelfs = int((a[0] + a[1] + a[2]) // 5 + 1)
if (b[0] + b[1] + b[2]) % 10 == 0:
	medal_shelfs = int((b[0] + b[1] + b[2]) // 10)
elif b[0] + b[1] + b[2] > 0:
	medal_shelfs = int((b[0] + b[1] + b[2]) // 10 + 1)
if medal_shelfs + cup_shelfs > n:
	print('NO')
else:
	print('YES')


from math import ceil
medals = map(int, input().split(' '))
cups = map(int, input().split(' '))
shelfs = int(input())
count = 0
medals_shelfs = sum(medals) / 5
cups_shelfs = sum(cups) / 10
if ceil(medals_shelfs) + ceil(cups_shelfs) <= shelfs:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = [int(x) for x in input().split(' ')]
(b1, b2, b3) = [int(y) for y in input().split(' ')]
n = int(input())
if (a1 + a2 + a3) % 5 == 0:
	cup_shelves = int((a1 + a2 + a3) / 5)
else:
	cup_shelves = int((a1 + a2 + a3) / 5) + 1
if (b1 + b2 + b3) % 10 == 0:
	medal_shelves = int((b1 + b2 + b3) / 10)
else:
	medal_shelves = int((b1 + b2 + b3) / 10) + 1
if cup_shelves + medal_shelves <= n:
	print('YES')
else:
	print('NO')


(A1, A2, A3) = map(int, input().split())
(B1, B2, B3) = map(int, input().split())
N = int(input())
X = A1 + A2 + A3
Y = B1 + B2 + B3
N = N - (int(X / 5) + bool(X % 5) + (int(Y / 10) + bool(Y % 10)))
if N >= 0:
	print('YES')
else:
	print('NO')


k = sum(list(map(int, input().split())))
l = sum(list(map(int, input().split())))
n = int(input())
if (k - 1) // 5 + 2 + (l - 1) // 10 <= n:
	print('YES')
else:
	print('NO')


a = sum(map(int, input().split()))
b = sum(map(int, input().split()))
c = int(input())
print('YES' if (a + 4) // 5 + (b + 9) // 10 <= c else 'NO')


import math
ins = input().strip().split(' ')
a = [int(i) for i in ins]
ins = input().strip().split(' ')
b = [int(i) for i in ins]
n = int(input().strip())
if n >= math.ceil(sum(a) / 5) + math.ceil(sum(b) / 10):
	print('YES')
else:
	print('NO')


import math
al = [int(i) for i in input().split()]
bl = [int(i) for i in input().split()]
n = int(input())
a = sum(al)
b = sum(bl)
a2 = math.ceil(a / 5)
b2 = math.ceil(b / 10)
if int(a2 + b2) <= n:
	print('YES')
else:
	print('NO')


from collections import Counter
import math
import sys
from bisect import bisect, bisect_left, bisect_right

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def mod():
	return 10 ** 9 + 7
(a1, a2, a3) = MAP()
(b1, b2, b3) = MAP()
n = INT()
x = a1 + a2 + a3
y = b1 + b2 + b3
req = math.ceil(x / 5) + math.ceil(y / 10)
if req <= n:
	print('YES')
else:
	print('NO')


from math import ceil
l_cup = list(map(int, input().split()))
l_medals = list(map(int, input().split()))
n = int(input())
if sum(l_cup) >= 5:
	a = ceil(sum(l_cup) / 5)
elif sum(l_cup) == 0:
	a = 0
else:
	a = 1
if sum(l_medals) >= 10:
	b = ceil(sum(l_medals) / 10)
elif sum(l_medals) == 0:
	b = 0
else:
	b = 1
if a + b <= n:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
na = -(-(a[0] + a[1] + a[2]) // 5)
nb = -(-(b[0] + b[1] + b[2]) // 10)
if na + nb <= n:
	print('YES')
else:
	print('NO')


import math
copos = [int(i) for i in input().split()]
medalhas = [int(i) for i in input().split()]
n = int(input())
somaCopo = copos[0] + copos[1] + copos[2]
somaMedalhas = medalhas[0] + medalhas[1] + medalhas[2]
total = math.ceil(somaCopo / 5) + math.ceil(somaMedalhas / 10)
if total <= n:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
r = int((a + b + c) / 5)
if (a + b + c) % 5 != 0:
	r += 1
(a, b, c) = map(int, input().split())
r2 = int((a + b + c) / 10)
if (a + b + c) % 10 != 0:
	r2 += 1
r += r2
n = int(input())
if r > n:
	print('NO')
else:
	print('YES')


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = int(input())
ans = ('NO', 'YES')
print(ans[int(sum(a) // 5 + int(sum(a) % 5 > 0) + sum(b) // 10 + int(sum(b) % 10 > 0) <= c)])


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
x = a1 + a2 + a3
y = b1 + b2 + b3
c = 0
if (x <= 5 and y <= 10) and n >= 2:
	print('YES')
else:
	if x % 5 == 0:
		m = x // 5
		c = c + m
	if x % 5 != 0:
		d = x // 5
		c = c + d + 1
	if y % 10 == 0:
		e = y // 10
		c = c + e
	if y % 10 != 0:
		z = y // 10
		c = c + z + 1
	if c > n:
		print('NO')
	if c <= n:
		print('YES')


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
a = sum(I())
b = sum(I())
(n,) = I()
ans = 'YES'
if (a + 5 - 1) // 5 + (b + 10 - 1) // 10 > n:
	ans = 'NO'
print(ans)


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
(h, k) = (0, 0)
for i in range(3):
	h += a[i]
	k += b[i]
n = int(input())
m = 0
if h % 5:
	m += (h - h % 5) / 5 + 1
else:
	m += h / 5
if k % 10:
	m += (k - k % 10) / 10 + 1
else:
	m += k / 10
if m > n:
	print('NO')
else:
	print('YES')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
total_medals = b1 + b2 + b3
total_cups = a1 + a2 + a3
if total_medals % 10 == 0:
	x = total_medals / 10
	n = n - x
else:
	n -= total_medals // 10 + 1
if total_cups % 5 == 0:
	x = total_cups / 5
	n = n - x
else:
	n -= total_cups // 5 + 1
if n >= 0:
	print('YES')
else:
	print('NO')


from math import ceil
total = [sum([int(i) for i in input().split()]) for j in range(2)]
shelf = int(input())
if ceil(total[0] / 5) + ceil(total[1] / 10) <= shelf:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
a1 = a[0]
a2 = a[1]
a3 = a[2]
b = list(map(int, input().split()))
b1 = b[0]
b2 = b[1]
b3 = b[2]
n = int(input())
c = a1 + a2 + a3
d = b1 + b2 + b3
if c == 0:
	if d == 0:
		z = 0
	elif d <= 10:
		z = 1
	elif d % 10 == 0:
		z = d / 10
	else:
		z = int(d / 10) + 1
elif c > 0 and c <= 5:
	if d == 0:
		z = 1
	elif d < 11:
		z = 2
	elif d % 10 == 0:
		z = d / 10 + 1
	else:
		z = int(d / 10) + 2
elif c > 5 and c % 5 == 0:
	if d == 0:
		z = c / 5
	elif d <= 10:
		z = c / 5 + 1
	elif d % 10 == 0:
		z = d / 10 + c / 5
	else:
		z = int(d / 10) + 1 + c / 5
elif c > 5 and c % 5 != 0:
	if d == 0:
		z = c / 5 + 1
	elif d <= 10:
		z = c / 5 + 2
	elif d % 10 == 0:
		z = d / 10 + int(c / 5) + 1
	else:
		z = int(d / 10) + 2 + int(c / 5)
if z <= n:
	print('YES')
elif z > n:
	print('NO')


from math import ceil
(m, o, c) = [int(i) for i in input().split()]
(s, a, b) = [int(i) for i in input().split()]
n = int(input())
g = m + o + c
h = s + a + b
x = ceil(g / 5)
y = ceil(h / 10)
j = x + y
if j > n:
	print('NO')
else:
	print('YES')


cups = input().split(' ')
medals = input().split(' ')
number_of_shelves_we_have = int(input())
number_of_shelves_we_need = 0
sum_of_cups = 0
sum_of_medals = 0
for i in range(3):
	sum_of_cups += int(cups[i])
	sum_of_medals += int(medals[i])
if sum_of_medals > 0:
	number_of_shelves_we_need += 1
if sum_of_cups > 0:
	number_of_shelves_we_need += 1
while sum_of_medals > 10 or sum_of_cups > 5:
	if sum_of_medals > 10:
		number_of_shelves_we_need += 1
		sum_of_medals -= 10
	if sum_of_cups > 5:
		number_of_shelves_we_need += 1
		sum_of_cups -= 5
if number_of_shelves_we_need <= number_of_shelves_we_have:
	print('YES')
else:
	print('NO')


import math

def canStoreRewards(a, b, n):
	return math.ceil(sum(a) / 5) + math.ceil(sum(b) / 10) <= n
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
print('YES' if canStoreRewards(a, b, n) else 'NO')


import math
n = [int(s) for s in input().split()]
m = [int(s) for s in input().split()]
k = int(input())
k = math.floor(k - sum(n) / 5)
if k * 10 >= sum(m):
	print('YES')
else:
	print('NO')


res = 0
res1 = 0
lis1 = input().split()
lis2 = input().split()
p = int(input())
for i in lis1:
	res += int(i)
for i in lis2:
	res1 += int(i)
if res % 5 != 0:
	res = res // 5 + 1
else:
	res = res // 5
if res1 % 10 != 0:
	res1 = res1 // 10 + 1
else:
	res1 = res1 // 10
if res1 + res <= p:
	print('YES')
else:
	print('NO')


from math import ceil
cup = [int(i) for i in input().split()]
medal = [int(j) for j in input().split()]
n = int(input())
ncup = cup[0] + cup[1] + cup[2]
nmed = medal[0] + medal[1] + medal[2]
num = ceil(ncup / 5) + ceil(nmed / 10)
if num <= n:
	print('YES')
else:
	print('NO')


import math
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
n = int(input())
if math.ceil(sum(a) / 5) + math.ceil(sum(b) / 10) > n or (sum(a) > 0 and sum(b) > 0 and (n < 2)):
	print('NO')
else:
	print('YES')


(a, b, c) = map(int, input().split())
(d, e, f) = map(int, input().split())
n = int(input())
if (a + b + c) % 5 == 0:
	v1 = (a + b + c) // 5
else:
	v1 = (a + b + c) // 5 + 1
if (d + e + f) % 10 == 0:
	v2 = (d + e + f) // 10
else:
	v2 = (d + e + f) // 10 + 1
if v1 + v2 <= n:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
z = int(input())
if sum(a) == 0:
	cup = 0
elif sum(a) % 5 == 0:
	cup = sum(a) // 5
else:
	cup = sum(a) // 5 + 1
if sum(b) == 0:
	med = 0
elif sum(b) % 10 == 0:
	med = sum(b) // 10
else:
	med = sum(b) // 10 + 1
if cup + med <= z:
	print('YES')
else:
	print('NO')


import math
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
num_cups = sum(a)
num_medels = sum(b)
shelves_for_cups = math.ceil(num_cups / 5)
shelves_for_medels = math.ceil(num_medels / 10)
if shelves_for_medels + shelves_for_cups > n:
	print('NO')
else:
	print('YES')


from sys import *

def main():
	(a1, a2, a3) = map(int, stdin.readline().split())
	(b1, b2, b3) = map(int, stdin.readline().split())
	n = int(stdin.readline())
	a = a1 + a2 + a3
	b = b1 + b2 + b3
	while b > 0:
		b -= 10
		n -= 1
	while a > 0:
		a -= 5
		n -= 1
	if a <= 0 and b <= 0 and (n >= 0):
		print('YES')
	else:
		print('NO')
main()


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
n = int(input())
s = 0
for i in a:
	s += i
s1 = 0
for i in b:
	s1 += i
x = s // 5
y = s1 // 10
if s % 5 != 0:
	x += 1
if s1 % 10 != 0:
	y += 1
if x + y <= n:
	print('YES')
else:
	print('NO')


list1 = [int(x) for x in input('').split()]
list2 = [int(x) for x in input('').split()]
n = int(input(''))
n1 = 0
n2 = 0
for x in list1:
	n1 += x
for x in list2:
	n2 += x
if n1 % 5 != 0:
	n1 = int(n1 / 5) + 1
else:
	n1 = n1 / 5
if n2 % 10 != 0:
	n2 = int(n2 / 10) + 1
else:
	n2 = n2 / 10
if n1 + n2 <= n:
	print('YES')
else:
	print('NO')


line1 = input().split()
line2 = input().split()
line3 = int(input())
m = []
n = []
for x in line1:
	m.append(int(x))
for y in line2:
	n.append(int(y))
a = m[0] + m[1] + m[2]
b = n[0] + n[1] + n[2]
if a % 5 == 0:
	p = a // 5
if a % 5 != 0:
	p = a // 5 + 1
if b % 10 == 0:
	q = b // 10
if b % 10 != 0:
	q = b // 10 + 1
if p + q > line3:
	print('NO')
else:
	print('YES')


import math
arr = [0] * 99
arr = list(map(int, input().split()))
a1 = arr[0]
a2 = arr[1]
a3 = arr[2]
arr = list(map(int, input().split()))
b1 = arr[0]
b2 = arr[1]
b3 = arr[2]
n = float(input())
slv_a = math.ceil((a1 + a2 + a3) / 5)
slv_b = math.ceil((b1 + b2 + b3) / 10)
if slv_a + slv_b <= n:
	print('YES')
else:
	print('NO')


from math import ceil
(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
a = a1 + a2 + a3
na = ceil(a / 5)
b = b1 + b2 + b3
nb = ceil(b / 10)
if n >= na + nb:
	print('YES')
else:
	print('NO')


import sys, math
(a1, a2, a3) = map(int, sys.stdin.readline().split())
(b1, b2, b3) = map(int, sys.stdin.readline().split())
n = int(input())
sum_a = a1 + a2 + a3
sum_b = b1 + b2 + b3
shef_a_num = math.ceil(sum_a / 5)
shef_b_num = math.ceil(sum_b / 10)
if shef_a_num + shef_b_num <= n:
	print('YES')
else:
	print('NO')


import math
(s1, s2) = (sum(list(map(int, input().split()))), sum(list(map(int, input().split()))))
n = int(input())
n -= math.ceil(s1 / 5) + math.ceil(s2 / 10)
if n < 0:
	print('NO')
else:
	print('YES')


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def find_parent(parent, i, cnt):
	cnt += 1
	if parent[i - 1] == i:
		return cnt
	if parent[i - 1] != i:
		find_parent(parent, parent[i - 1], cnt)
from collections import Counter
(c1, c2, c3) = map(int, input().split())
(m1, m2, m3) = map(int, input().split())
n = int(input())
m = m1 + m2 + m3
c = c1 + c2 + c3
t = 0
t += c // 5
if c % 5 != 0:
	t += 1
t += m // 10
if m % 10 != 0:
	t += 1
if t <= n:
	print('YES')
else:
	print('NO')


from __future__ import print_function
max_medals_per_shelf = 10
max_cups_per_shelf = 5
min_shelves_needed = 10 + 5
(cup_1, cup_2, cup_3) = list(map(int, input().split()))
(med_3, med_2, med_1) = list(map(int, input().split()))
total_cups = cup_1 + cup_2 + cup_3
total_medals = med_3 + med_2 + med_1
n = list(map(int, input().strip().split()))[0]
n -= total_cups // 5
n -= total_medals // 10
if total_cups < max_cups_per_shelf and total_cups != 0:
	n -= 1
if total_medals < max_medals_per_shelf and total_medals != 0:
	n -= 1
if total_cups > max_cups_per_shelf and total_cups % max_cups_per_shelf > 0:
	n -= 1
if total_medals > max_medals_per_shelf and total_medals % max_medals_per_shelf > 0:
	n -= 1
if n < 0:
	print('NO')
else:
	print('YES')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
(a1, a2, a3) = sp()
(b1, b2, b3) = sp()
n = int(data())
(cups, medals) = (a1 + a2 + a3, b1 + b2 + b3)
if ceil(cups / 5) + ceil(medals / 10) <= n:
	out('YES')
	exit()
out('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
cups = (sum(a) + 4) // 5
medals = (sum(b) + 9) // 10
if cups + medals <= n:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
s1 = sum(a)
s2 = sum(b)
if s1 % 5 == 0:
	c1 = int(s1 / 5)
else:
	c1 = int(s1 / 5) + 1
if s2 % 10 == 0:
	c2 = int(s2 / 10)
else:
	c2 = int(s2 / 10) + 1
if c1 + c2 <= n:
	print('YES')
else:
	print('NO')


import math
a = list(map(int, input().split()))
b = list(map(int, input().split()))
suma = sum(a)
sumb = sum(b)
n = int(input())
x = math.ceil(suma / 5)
y = math.ceil(sumb / 10)
shel = x + y
if n >= shel:
	print('YES')
else:
	print('NO')


s = list(map(int, input().split()))
d = [int(i) for i in input().split()]
n = int(input())
n -= sum(s) // 5
n -= sum(d) // 10
if sum(s) % 5 != 0:
	n -= 1
if sum(d) % 10 != 0:
	n -= 1
if n >= 0:
	print('YES')
else:
	print('NO')


import math
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
n = int(input())
c = sum(a)
m = sum(b)
c_s = math.ceil(c / 5)
m_s = math.ceil(m / 10)
if c_s + m_s <= n:
	print('YES')
else:
	print('NO')


cups = [int(i) for i in input().split(' ')]
medals = [int(i) for i in input().split(' ')]
shelves = int(input())
sCups = sum(cups)
sMedals = sum(medals)
k = 0
l = 0
if sCups % 5 != 0:
	k = 1
if sMedals % 10 != 0:
	l = 1
minShelvesRequired = int(sCups / 5) + k + int(sMedals / 10) + l
if minShelvesRequired <= shelves:
	print('YES')
else:
	print('NO')


from math import ceil
(a, b, c) = map(int, input().split())
(d, e, f) = map(int, input().split())
n = int(input())
k = a + b + c
l = d + e + f
if ceil(k / 5) + ceil(l / 10) <= n:
	print('YES')
else:
	print('NO')


from math import ceil

def Sum(lst):
	all1 = 0
	for i in lst:
		all1 += int(i)
	return all1
list1 = input().split()
list2 = input().split()
summ = int(input())
kubok = Sum(list1)
medal = Sum(list2)
all1 = 0
if kubok % 5 == 0:
	all1 += kubok / 5
else:
	all1 += int(kubok / 5 + 1)
if medal % 10 == 0:
	all1 += medal / 10
else:
	all1 += int(medal / 10 + 1)
if all1 <= summ:
	print('YES')
else:
	print('NO')


nn = input()
nn = nn.split()
a1 = int(nn[0])
a2 = int(nn[1])
a3 = int(nn[2])
nn = input()
nn = nn.split()
b1 = int(nn[0])
b2 = int(nn[1])
b3 = int(nn[2])
n = int(input())
s = 0
tc = a1 + a2 + a3
tm = b1 + b2 + b3
if tc % 5 == 0:
	s += tc / 5
else:
	s = s + (int(tc / 5) + 1)
if tm % 10 == 0:
	s += tm / 10
else:
	s = s + (int(tm / 10) + 1)
if s > n:
	print('NO')
else:
	print('YES')


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
a = (sum(get_list()) + 4) // 5
b = (sum(get_list()) + 9) // 10
n = int(input())
print('YES' if a + b <= n else 'NO')


x = [int(x) for x in input().split()]
y = [int(y) for y in input().split()]
n = int(input())
sum1 = 0
sum2 = 0
for i in range(len(x)):
	sum1 += x[i]
	sum2 += y[i]
if sum1 % 5 == 0 and sum2 % 10 == 0:
	a = sum1 // 5 + sum2 // 10
elif sum1 % 5 and sum2 % 10 == 0:
	a = sum1 // 5 + sum2 // 10 + 1
elif sum1 % 5 == 0 and sum2 % 10:
	a = sum1 // 5 + sum2 // 10 + 1
else:
	a = sum1 // 5 + sum2 // 10 + 2
if a <= n:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
x = sum(a)
y = sum(b)
z = 0
if x % 5 == 0:
	z += int(x / 5)
else:
	z += int(x / 5) + 1
if y % 10 == 0:
	z += int(y / 10)
else:
	z += int(y / 10) + 1
if z <= n:
	print('YES')
else:
	print('NO')


def gif(a):
	if a > int(a):
		return int(a) + 1
	else:
		return int(a)
b = list((int(x) for x in input().split()))
c = list((int(x) for x in input().split()))
a = int(input())
cups = 0
medals = 0
for i in b:
	cups += i
for i in c:
	medals += i
if gif(cups / 5) + gif(medals / 10) <= a:
	print('YES')
else:
	print('NO')


l = list(map(int, input().split()))
p = list(map(int, input().split()))
k = int(input().strip())
m = 0
if sum(l) % 5 != 0:
	m += 1
if sum(p) % 10 != 0:
	m += 1
m = m + sum(l) // 5 + sum(p) // 10
if m <= k:
	print('YES')
if m > k:
	print('NO')


(cup1, cup2, cup3) = map(int, input('').split(' '))
(medal1, medal2, medal3) = map(int, input('').split(' '))
shelves = int(input(''))
nbcup = cup1 + cup2 + cup3
nbmedal = medal1 + medal2 + medal3
shelvesneeded = 0
if nbcup % 5 == 0:
	shelvesneeded += nbcup // 5
else:
	shelvesneeded += nbcup // 5 + 1
if nbmedal % 10 == 0:
	shelvesneeded += nbmedal // 10
else:
	shelvesneeded += nbmedal // 10 + 1
if shelvesneeded <= shelves:
	print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
(x, y, z) = map(int, input().split())
n = int(input())
k = 0
if a + b + c > 0:
	k += 1
if x + y + z > 0:
	k += 1
p = (a + b + c - 1) // 5
q = (x + y + z - 1) // 10
if q < 0:
	q = 0
if p < 0:
	p = 0
if k + p + q > n:
	print('NO')
else:
	print('YES')


cup = [int(x) for x in input().split(' ')]
medal = [int(x) for x in input().split(' ')]
n = int(input())
tc = int(sum(cup) / 5) + (1 if sum(cup) % 5 != 0 else 0)
tm = int(sum(medal) / 10) + (1 if sum(medal) % 10 != 0 else 0)
if tc + tm > n:
	print('NO')
else:
	print('YES')


cup = list(map(int, input().split()))
medals = list(map(int, input().split()))
n = int(input())
tcups = sum(cup)
tmedals = sum(medals)
if tcups % 5 == 0:
	numcups = tcups // 5
else:
	numcups = tcups // 5 + 1
if tmedals % 10 == 0:
	nummedal = tmedals // 10
else:
	nummedal = tmedals // 10 + 1
if numcups + nummedal <= n:
	print('YES')
else:
	print('NO')


from sys import stdin
from math import ceil
i = [[int(y) for y in x.rstrip().split()] for x in stdin.readlines()]
n = i[2][0]
print(('NO', 'YES')[ceil(sum(i[0]) / 5) + ceil(sum(i[1]) / 10) <= n])


u = sum([int(x) for x in input().split()])
v = sum([int(x) for x in input().split()])
n = int(input())
print('YES' if n >= (u + 4) // 5 + (v + 9) // 10 else 'NO')


str1 = input().split()
a = list(map(int, str1))
str2 = input().split()
b = list(map(int, str2))
n = int(input())
asum = sum(a)
bsum = sum(b)
areq = asum // 5
if asum % 5 != 0:
	areq += 1
breq = bsum // 10
if bsum % 10 != 0:
	breq += 1
if areq + breq <= n:
	print('YES')
else:
	print('NO')


__author__ = 'Dilshod'
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
a = sum(a)
b = sum(b)
c = a // 5
if a % 5 != 0:
	c += 1
d = b // 10
if b % 10 != 0:
	d += 1
if d + c > n:
	print('NO')
else:
	print('YES')


l = list(map(int, input().split()))
l2 = list(map(int, input().split()))
n = int(input())
x = sum(l)
y = sum(l2)
while n >= 0 and x > 0:
	x -= 5
	n -= 1
while n >= 0 and y > 0:
	y -= 10
	n -= 1
if n >= 0:
	print('YES')
else:
	print('NO')


a = sum(list(map(int, input().split()))) * 2
b = sum(list(map(int, input().split())))
x = int(input()) * 10
print('YES' if b <= x - a - (x - a) % 10 else 'NO')


import math
(a, b, c) = (int(i) for i in input().split())
(a1, b1, c1) = (int(i) for i in input().split())
n = int(input())
s1 = a + b + c
s2 = a1 + b1 + c1
s1 = math.ceil(s1 / 5)
s2 = math.ceil(s2 / 10)
if s1 + s2 > n:
	print('NO')
else:
	print('YES')


import math
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
cup_sh = math.ceil(sum(a) / 5)
madel_sh = math.ceil(sum(b) / 10)
if sum(a) == 0 or sum(b) == 0:
	if n < cup_sh + madel_sh:
		print('NO')
	else:
		print('YES')
else:
	if cup_sh == 0:
		cup_sh = 1
	if madel_sh == 0:
		madel_sh = 1
	if cup_sh + madel_sh > n:
		print('NO')
	else:
		print('YES')


import sys
import math
try:
	f = open('input.txt')
except IOError:
	f = sys.stdin
a = [int(x) for x in f.readline().split()]
b = [int(x) for x in f.readline().split()]
n = int(f.readline().split()[0])
suma = 0
for x in a:
	suma += x
sumb = 0
for x in b:
	sumb += x
cntCub = math.ceil(suma / 5)
cntMed = math.ceil(sumb / 10)
if cntCub + cntMed <= n:
	print('YES')
else:
	print('NO')


l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
n = int(input())
suma = sum(l1)
sumb = sum(l2)
s = 0
if suma % 5 == 0:
	s += suma // 5
else:
	s += 1 + suma // 5
if sumb % 10 == 0:
	s += sumb // 10
else:
	s += 1 + sumb // 10
if s <= n:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = [int(i) for i in input().split()]
(b1, b2, b3) = [int(i) for i in input().split()]
n = int(input())
a = a1 + a2 + a3
b = b1 + b2 + b3
n1 = a // 5
n2 = b // 10
if a % 5 != 0:
	n1 = n1 + 1
if b % 10 != 0:
	n2 = n2 + 1
n3 = n1 + n2
if n >= n3:
	print('YES')
else:
	print('NO')


sx = 0
sy = 0
x = input().split(' ')
y = input().split(' ')
z = int(input())
for i in x:
	sx = int(i) + sx
for i in y:
	sy = int(i) + sy
for i in range(z):
	if sx > 0:
		sx -= 5
	else:
		sy -= 10
if sx <= 0 and sy <= 0:
	print('YES')
else:
	print('NO')


import math
(a, b, c) = map(int, input().split())
(x, y, z) = map(int, input().split())
t = int(input())
q = math.ceil((a + b + c) / 5)
q = int(q)
r = math.ceil((x + y + z) / 10)
r = int(r)
if q + r <= t:
	print('YES')
else:
	print('NO')


l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
n = int(input())
(l, l1) = (sum(l), sum(l1))
if l == 0 and l1 == 0:
	print('YES')
	exit()
n -= l // 5 + l1 // 10
if l % 5 != 0:
	n -= 1
if l1 % 10 != 0:
	n -= 1
if n >= 0:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
k1 = sum(a) / 5
if k1 > int(k1):
	k1 = int(k1) + 1
else:
	k1 = int(k1)
k2 = sum(b) / 10
if k2 > int(k2):
	k2 = int(k2) + 1
else:
	k2 = int(k2)
if k1 + k2 > n:
	print('NO')
else:
	print('YES')


def main():
	a = sum((int(i) for i in input().split()))
	b = sum((int(i) for i in input().split()))
	n = int(input())
	if (a + 4) // 5 + (b + 9) // 10 > n:
		print('NO')
	else:
		print('YES')
main()


import math
cups = [int(i) for i in input().split()]
medals = [int(i) for i in input().split()]
shelves = int(input())
number_of_cups = 0
number_of_medals = 0
shelves_with_cups = 0
shelves_with_medals = 0
for i in range(3):
	number_of_cups += cups[i]
	number_of_medals += medals[i]
shelves_with_cups = math.ceil(number_of_cups / 5)
shelves_with_medals = math.ceil(number_of_medals / 10)
if shelves_with_medals + shelves_with_cups > shelves:
	print('NO')
else:
	print('YES')


import math
l = list(map(int, input().split()))
m = list(map(int, input().split()))
n = int(input())
s = sum(l)
p = sum(m)
x = math.ceil(s / 5)
y = math.ceil(p / 10)
if n < x + y:
	print('NO')
else:
	print('YES')


s1 = 0
s2 = 0
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
for i in x:
	s1 = s1 + i
for i in y:
	s2 = s2 + i
n = int(input())
p = 0
while s1 > 0:
	s1 = s1 - 5
	p = p + 1
while s2 > 0:
	s2 = s2 - 10
	p = p + 1
if p <= n:
	print('YES')
else:
	print('NO')


Cups = input().split()
Medals = input().split()
shelves = int(input())
cups = int(Cups[0]) + int(Cups[1]) + int(Cups[2])
medals = int(Medals[0]) + int(Medals[1]) + int(Medals[2])
cup_spaces = cups // 5
medal_spaces = medals // 10
if cups % 5 != 0:
	cup_spaces += 1
if medals % 10 != 0:
	medal_spaces += 1
if shelves < cup_spaces + medal_spaces:
	print('NO')
else:
	print('YES')


import math
s1 = str(input()).split()
s2 = str(input()).split()
n = int(input())
cup = int(s1[0]) + int(s1[1]) + int(s1[2])
med = int(s2[0]) + int(s2[1]) + int(s2[2])
tmp = cup // 5
if cup % 5 != 0:
	tmp += 1
tmp += med // 10
if med % 10 != 0:
	tmp += 1
if tmp <= n:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
c = sum(a)
m = sum(b)

def fn(c, m, n):
	if m != 0:
		if m % 10 == 0:
			ms = m // 10
		else:
			ms = m // 10 + 1
	else:
		ms = 0
	if c != 0:
		if c % 5 == 0:
			cs = c // 5
		else:
			cs = c // 5 + 1
	else:
		cs = 0
	ntotal = ms + cs
	if ntotal > n:
		return 'NO'
	else:
		return 'YES'
print(fn(c, m, n))


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
n = int(input())
cnt = (sum(a) + 5 - 1) // 5 + (sum(b) + 10 - 1) // 10
if cnt <= n:
	print('YES')
else:
	print('NO')


inp1 = input()
inp1 = inp1.split(' ')
inp2 = input()
inp2 = inp2.split(' ')
num_shelves = int(input())
(cups, medals) = (0, 0)
for current_num in inp1:
	cups += int(current_num)
for current_num in inp2:
	medals += int(current_num)
shelves_needed = 0

def find_num_shelves(num_items, max_items):
	local_shelf = 0
	local_shelf += num_items // max_items
	if num_items % max_items > 0:
		local_shelf += 1
	return local_shelf
shelves_needed += find_num_shelves(cups, 5)
shelves_needed += find_num_shelves(medals, 10)
if shelves_needed <= num_shelves:
	print('YES')
else:
	print('NO')


import math
n = [int(i) for i in input().split()]
m = [int(i) for i in input().split()]
x = int(input())
if math.ceil(sum(n) / 5) + math.ceil(sum(m) / 10) <= x:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = input().split()
(a1, a2, a3) = (int(a1), int(a2), int(a3))
(b1, b2, b3) = input().split()
(b1, b2, b3) = (int(b1), int(b2), int(b3))
n = int(input())
sumA = a1 + a2 + a3
sumB = b1 + b2 + b3
if int((sumA + 5 - 1) / 5) + int((sumB + 10 - 1) / 10) > n:
	print('NO')
else:
	print('YES')


import sys, math as mt
import heapq as hp
import collections as cc
import bisect as bi
import math as mt
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(a, b, c) = I()
(aa, bb, cc) = I()
(n,) = I()
temp = a + b + c
tem = aa + bb + cc
ans = 0
ans += temp // 5
if temp % 5:
	ans += 1
ans += tem // 10
if tem % 10:
	ans += 1
if ans <= n:
	print('YES')
else:
	print('NO')


a = b = 0
for i in list((int(z) for z in input().split())):
	a += i
for i in list((int(z) for z in input().split())):
	b += i
print(['YES', 'NO'][(a // 5 + 1 if a % 5 else a // 5) + (b // 10 + 1 if b % 10 else b // 10) > int(input())])


import math
(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
a = a1 + a2 + a3
b = b1 + b2 + b3
a = math.ceil(a / 5)
b = math.ceil(b / 10)
if a + b <= int(input()):
	print('YES')
else:
	print('NO')


import math
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
counta = 0
countb = 0
for i in range(len(a)):
	counta += a[i]
for j in range(len(b)):
	countb += b[j]
ares = math.ceil(counta / 5)
bres = math.ceil(countb / 10)
if ares + bres <= n:
	print('YES')
else:
	print('NO')


import sys
readSum = lambda : sum(map(int, sys.stdin.readline().split()))
a = -(readSum() // -5)
b = -(readSum() // -10)
n = int(input())
print('NO' if n - (a + b) < 0 else 'YES')


t = [int(x) for x in input().split()]
m = [int(y) for y in input().split()]
s = 2
T = sum(t)
M = sum(m)
if T == 0:
	s -= 1
if M == 0:
	s -= 1
while T > 5:
	s += 1
	T -= 5
while M > 10:
	s += 1
	M -= 10
N = int(input())
if s <= N and N != 0:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
c = sum(a)
d = sum(b)
if c % 5 != 0:
	if d % 10 != 0:
		e = c // 5 + 1 + d // 10 + 1
	else:
		e = c // 5 + 1 + d // 10
elif d % 10 != 0:
	e = c // 5 + d // 10 + 1
else:
	e = c // 5 + d // 10
if n < e:
	print('NO')
else:
	print('YES')


from math import ceil as gh
a = lambda : sum(map(int, input().split()))
print('YES' if gh(a() / 5) + gh(a() / 10) <= int(input()) else 'NO')


x = lambda : sum(map(int, input().split()))
print('NYOE S'[(x() + 4) // 5 + (x() + 9) // 10 <= int(input())::2])


m = list(map(int, input().split()))
n = list(map(int, input().split()))
z = int(input())
print('YNEOS'[(sum(n) + 9) // 10 + (sum(m) + 4) // 5 > z::2])


import math
num_cups = sum([int(x) for x in input().split()])
num_medals = sum([int(x) for x in input().split()])
n = int(input())
print('YES') if math.ceil(num_cups / 5) + math.ceil(num_medals / 10) <= n else print('NO')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
shelf = int(input())
a = a1 + a2 + a3
b = b1 + b2 + b3
if a % 5 == 0:
	aShelf = a // 5
else:
	aShelf = a // 5 + 1
if b % 10 == 0:
	bShelf = b // 10
else:
	bShelf = b // 10 + 1
if aShelf + bShelf <= shelf:
	print('YES')
else:
	print('NO')


counter = 0
cups = sum([int(i) for i in input().split()])
medals = sum([int(i) for i in input().split()])
n = int(input())
if cups > 0:
	while cups > 0:
		cups -= 1
		counter += 1
		if counter % 5 == 0:
			n -= 1
	if counter % 5 != 0 or counter < 5:
		n -= 1
counter = 0
if medals > 0:
	while medals > 0:
		medals -= 1
		counter += 1
		if counter % 10 == 0:
			n -= 1
	if counter % 10 != 0 or counter < 10:
		n -= 1
print('YES' if n >= 0 else 'NO')


from math import ceil

def main():
	if ceil(sum([int(i) for i in input().split()]) / 5) + ceil(sum([int(i) for i in input().split()]) / 10) <= int(input()):
		print('YES')
	else:
		print('NO')
main()


import math
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
n = int(input())
numn = 0
numm = 0
for i in range(3):
	numn += a[i]
for j in range(3):
	numm += b[j]
p = math.ceil(numn / 5)
q = math.ceil(numm / 10)
if p + q > n:
	print('NO')
else:
	print('YES')


(a1, a2, a3) = input().split()
(a1, a2, a3) = (int(a1), int(a2), int(a3))
(b1, b2, b3) = input().split()
(b1, b2, b3) = (int(b1), int(b2), int(b3))
n = int(input())
total_cups = a1 + a2 + a3
shelves = total_cups // 5
if total_cups % 5 != 0:
	shelves = shelves + 1
total_medal = b1 + b2 + b3
shelves = shelves + total_medal // 10
if total_medal % 10 != 0:
	shelves = shelves + 1
if shelves <= n:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = [int(i) for i in input().split()]
(b1, b2, b3) = [int(i) for i in input().split()]
n = int(input())
c = 0
d = 0
e = a1 + a2 + a3
f = b1 + b2 + b3
if e > 5:
	while e > 5:
		e -= 5
		c += 1
	c += 1
elif e <= 5 and e > 0:
	c += 1
if f > 10:
	while f > 10:
		f -= 10
		d += 1
	d += 1
elif f <= 10 and f > 0:
	d += 1
if c + d > n:
	print('NO')
else:
	print('YES')


na = sum(map(int, input().split()))
nb = sum(map(int, input().split()))
n = int(input())
if na:
	n1 = (na - 1) // 5 + 1
else:
	n1 = 0
if nb:
	n2 = (nb - 1) // 10 + 1
else:
	n2 = 0
print(('NO', 'YES')[n1 + n2 <= n])


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
s1 = s2 = 0
for i in range(3):
	s1 = s1 + a[i]
	s2 = s2 + b[i]
if s1 / 5 == int(s1 / 5):
	n = n - s1 / 5
else:
	n = n - s1 // 5 - 1
if s2 / 10 == int(s2 / 10):
	n = n - s2 / 10
else:
	n = n - s2 // 10 - 1
if n >= 0:
	print('YES')
else:
	print('NO')


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
k = int(input())
kubk = sum(a)
medal = sum(b)
count = 0
while kubk > 0:
	count += 1
	kubk -= 5
while medal > 0:
	count += 1
	medal -= 10
if k >= count:
	print('YES')
else:
	print('NO')


a = sum(list(map(int, input().split())))
b = sum(list(map(int, input().split())))
(A, B) = (0, 0)
t = int(input())
if 0 < a < 5:
	A = 1
elif a >= 5:
	A = a // 5
	if a % 5 > 0:
		A += 1
if 0 < b < 10:
	B = 1
elif b >= 10:
	B = b // 10
	if b % 10 > 0:
		B += 1
if A + B <= t:
	print('YES')
else:
	print('NO')


import math
sum1 = 0
a = list(map(int, input().strip().split()))
for i in range(0, 3):
	sum1 += a[i]
sum2 = 0
b = list(map(int, input().strip().split()))
for i in range(0, 3):
	sum2 += b[i]
n = int(input())
k = math.ceil(sum1 / 5)
j = math.ceil(sum2 / 10)
if k + j <= n:
	print('YES')
else:
	print('NO')


import math
trofeji_na_policu = 5
medajli_na_policu = 10
trofeji = sum(map(int, input().split()))
medajli = sum(map(int, input().split()))
polic = int(input())
treba = math.ceil(trofeji / trofeji_na_policu) + math.ceil(medajli / medajli_na_policu)
if treba <= polic:
	print('YES')
else:
	print('NO')


import math

def func(cups, medals, n):
	a = math.ceil(sum(cups) / 5)
	b = math.ceil(sum(medals) / 10)
	if a + b <= n:
		return 'YES'
	return 'NO'
cups = list(map(int, input().split()))
medals = list(map(int, input().split()))
n = int(input())
print(func(cups, medals, n))


(a, b, c) = input().split()
(x, y, z) = input().split()
(a, b, c, x, y, z) = (int(a), int(b), int(c), int(x), int(y), int(z))
n = int(input())
m = a + b + c
p = x + z + y
k = (m - 1) // 5 + 1 + ((p - 1) // 10 + 1)
if k <= n:
	print('YES')
else:
	print('NO')


a = -(-sum(map(int, input().split())) // 5)
b = -(-sum(map(int, input().split())) // 10)
n = int(input())
print(('NO', 'YES')[a + b <= n])


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = input()
aa = sum(a)
bb = sum(b)
nn = int(n)
for i in range(int(n)):
	if aa != 0:
		if aa < 5:
			aa = 0
		else:
			aa -= 5
		nn -= 1
	else:
		break
for i in range(int(n)):
	if bb != 0:
		if bb < 10:
			bb = 0
		else:
			bb -= 10
		nn -= 1
	else:
		break
if nn < 0 or bb != 0 or aa != 0:
	print('NO')
else:
	print('YES')


from operator import itemgetter
(a, a2, a3) = map(int, input().split())
(b, b2, b3) = map(int, input().split())
n = int(input())
a += a2 + a3
b += b2 + b3
ans = a // 5 + (a % 5 != 0)
ans += b // 10 + (b % 10 != 0)
ans = int(ans <= n)
print('YES' * ans + 'NO' * (1 - ans))


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
sa = 0
sb = 0
for i in range(3):
	sa += a[i]
	sb += b[i]
sea = 0
seb = 0
if sa % 5 > 0:
	sea = sa // 5 + 1
else:
	sea = sa // 5
if sb % 10 > 0:
	seb = sb // 10 + 1
else:
	seb = sb // 10
if sea + seb <= n:
	print('YES')
else:
	print('NO')


c = sum((int(x) for x in input().split()))
m = sum((int(x) for x in input().split()))
n = int(input())
print('YES' if (c + 4) // 5 + (m + 9) // 10 <= n else 'NO')


from math import ceil
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
n = int(input())
a = sum(l1)
b = sum(l2)
e1 = ceil(n / 2)
e2 = n // 2
w = ceil(a / 5)
q = ceil(b / 10)
if e1 + e2 < w + q:
	print('NO')
else:
	print('YES')


from math import ceil
cups = [int(i) for i in input().split(' ')]
medals = [int(i) for i in input().split(' ')]
shelves = int(input())
neededCupsShelves = ceil(sum(cups) / 5)
neededMedalsShelves = ceil(sum(medals) / 10)
if neededCupsShelves + neededMedalsShelves <= shelves:
	print('YES')
else:
	print('NO')


s1 = input().split()
s2 = input().split()
a = int(input())
sok = 0
som = 0
n = 0
for i in range(3):
	sok += int(s1[i])
	som += int(s2[i])
while True:
	n += 1
	if sok > 0:
		sok -= 5
	elif som > 0:
		som -= 10
	if sok <= 0 and som <= 0:
		break
if n > a:
	print('NO')
else:
	print('YES')


x = sum(list(map(int, input().split())))
y = sum(list(map(int, input().split())))
n = int(input())
if x % 5 == 0:
	j = x // 5
else:
	j = x // 5 + 1
if y % 10 == 0:
	t = y // 10
else:
	t = y // 10 + 1
if j + t <= n:
	print('YES')
else:
	print('NO')


import math
(a1, a2, a3) = map(int, input().strip().split())
(b1, b2, b3) = map(int, input().strip().split())
n = int(input())
count = 0
sa = a1 + a2 + a3
sb = b1 + b2 + b3
count = count + math.ceil(sa / 5)
count = count + math.ceil(sb / 10)
if count <= n:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = map(int, input().split())
total_cup = a1 + a2 + a3
(b1, b2, b3) = map(int, input().split())
total_medal = b1 + b2 + b3
n = int(input())
for i in range(n):
	if total_cup > 0:
		total_cup -= 5
	else:
		total_medal -= 10
if total_cup > 0 or total_medal > 0:
	print('NO')
else:
	print('YES')


a = input().split()
b = input().split()
n = eval(input())
suma = int(a[0]) + int(a[1]) + int(a[2])
sumb = int(b[0]) + int(b[1]) + int(b[2])
shelfa = 0
shelfb = 0
if suma % 5 == 0:
	shelfa = suma // 5
else:
	shelfa = suma // 5 + 1
if sumb % 10 == 0:
	shelfb = sumb // 10
else:
	shelfb = sumb // 10 + 1
shelves = shelfa + shelfb
if shelves <= n:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = input().split()
a1 = int(a1)
a2 = int(a2)
a3 = int(a3)
(b1, b2, b3) = input().split()
b1 = int(b1)
b2 = int(b2)
b3 = int(b3)
n = int(input())
a5 = 0
b5 = 0
a4 = a1 + a2 + a3
b4 = b1 + b2 + b3
a5 = a4 / 5
if a5 * 10 % 10 != 0:
	a5 = int(a5)
	a5 += 1
else:
	a5 = int(a5)
b5 = b4 / 10
if b5 * 10 % 10 != 0:
	b5 = int(b5)
	b5 += 1
else:
	b5 = int(b5)
if b5 + a5 <= n:
	print('YES')
else:
	print('NO')


print('YNEOS'[-(-sum((int(i) for i in input().split())) // 5) - -sum((int(i) for i in input().split())) // 10 > int(input())::2])


first = sum(map(int, input().split()))
second = sum(map(int, input().split()))
number = int(input())
if (first - 1) // 5 + 1 + (second - 1) // 10 + 1 > number:
	print('NO')
else:
	print('YES')


p = input()
p = p.split()
m = 0
for i in range(len(p)):
	m += int(p[i])
q = input()
q = q.split()
w = 0
for i in range(len(q)):
	w += int(q[i])
n = int(input())
c = m // 5 + w // 10
if m % 5 != 0:
	c += 1
if w % 10 != 0:
	c += 1
if c <= n:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout
input = stdin.readline
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
a = sum(a)
b = sum(b)
n -= a // 5
n -= a % 5 > 0
n -= b // 10
n -= b % 10 > 0
stdout.write('YES' if n >= 0 else 'NO')


(a1, a2, a3) = input().split()
(b1, b2, b3) = input().split()
n = int(input())
a = int(a1) + int(a2) + int(a3)
b = int(b1) + int(b2) + int(b3)
c = 0
for x in range(1, a + 1, 5):
	c += 1
for x in range(1, b + 1, 10):
	c += 1
if c <= n:
	print('YES')
else:
	print('NO')


from math import ceil
(a, b, c) = list(map(int, input().split()))
(d, e, f) = list(map(int, input().split()))
n = int(input())
cups = a + b + c
medals = d + e + f
cupsLines = ceil(cups / 5)
medalsLines = ceil(medals / 10)
if cupsLines + medalsLines <= n:
	print('YES')
else:
	print('NO')


import math
num1 = input()
num2 = input()
a = []
b = []

def get_the_data(count, num, arr):
	for i in range(0, len(num)):
		if num[i] == ' ':
			arr.append(int(num[count:i]))
			count = i + 1
		elif i == len(num) - 1:
			arr.append(int(num[count:len(num)]))
	return arr
arr1 = get_the_data(0, num1, a)
arr2 = get_the_data(0, num2, b)
n = int(input())
sum_of_cups = 0
for i in arr1:
	sum_of_cups += i
sum_of_medals = 0
for i in arr2:
	sum_of_medals += i
shell_for_cups = math.ceil(sum_of_cups / 5)
shell_for_medals = math.ceil(sum_of_medals / 10)
if shell_for_cups + shell_for_medals <= n:
	print('YES')
else:
	print('NO')


cups_count = sum(map(int, input().split()))
medals_count = sum(map(int, input().split()))
shelves_count = int(input())
required_shelves = cups_count // 5 + (1 if cups_count % 5 != 0 else 0)
required_shelves += medals_count // 10 + (1 if medals_count % 10 != 0 else 0)
print('YES' if required_shelves <= shelves_count else 'NO')


import math
k = list(map(int, input().split()))
m = list(map(int, input().split()))
n = int(input())
if math.ceil(sum(k) / 5) + math.ceil(sum(m) / 10) > n:
	print('NO')
	exit(0)
print('YES')


c = [int(a) for a in input().split()]
m = [int(b) for b in input().split()]
n = int(input())
cnt = 0
cc = sum(c)
mm = sum(m)
if cc % 5 == 0:
	cnt = cnt + cc // 5
else:
	cnt = cnt + cc // 5 + 1
if mm % 10 == 0:
	cnt = cnt + mm // 10
else:
	cnt = cnt + mm // 10 + 1
if n >= cnt:
	print('YES')
else:
	print('NO')


(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
n = int(input())
a = a1 + a2 + a3
b = b1 + b2 + b3
a = a // 5 + bool(a % 5)
b = b // 10 + bool(b % 10)
if n >= a + b:
	print('YES')
else:
	print('NO')


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
n = int(input())
sum_a = sum(a)
sum_b = sum(b)
sum_a_1 = 0
sum_b_1 = 0
if sum_a % 5:
	sum_a_1 = 1
if sum_b % 10:
	sum_b_1 = 1
if sum_a // 5 + sum_b // 10 + sum_a_1 + sum_b_1 <= n:
	print('YES')
else:
	print('NO')


import sys
import math
inp = sys.stdin.read()
lines = inp.splitlines()
a = list(map(int, lines[0].split()))
b = list(map(int, lines[1].split()))
n = int(lines[2])
cups = sum(a)
medals = sum(b)
if math.ceil(cups / 5) + math.ceil(medals / 10) > n:
	print('NO')
else:
	print('YES')


import math
(a1, a2, a3) = map(int, input().split())
(b1, b2, b3) = map(int, input().split())
s = int(input())
sa = math.ceil(sum([a1, a2, a3]) / 5)
sb = math.ceil(sum([b1, b2, b3]) / 10)
if sa + sb > s:
	print('NO')
else:
	print('YES')


from math import ceil
num_cups = sum(map(int, input().split()))
num_medals = sum(map(int, input().split()))
num_shelves = int(input())
print('YES') if ceil(num_cups / 5) + ceil(num_medals / 10) <= num_shelves else print('NO')


cups = sum([int(x) for x in input().split()])
medals = sum([int(x) for x in input().split()])
n = int(input())
used = 0

def get_used(items, limit):
	used = 0
	while items > limit:
		items -= limit
		used += 1
	if items > 0:
		used += 1
	return used
used += get_used(cups, 5)
used += get_used(medals, 10)
if used <= n:
	print('YES')
else:
	print('NO')


import math
cups = sum(map(int, input().split()))
medals = sum(map(int, input().split()))
shelves = int(input())
if cups > 0 and medals > 0 and (shelves < 2):
	print('NO')
elif math.ceil(cups / 5) + math.ceil(medals / 10) > shelves:
	print('NO')
else:
	print('YES')


l1 = input().split()
l2 = input().split()
n = int(input())
a = 0
c = sum((int(x) for x in l1))
m = sum((int(x) for x in l2))
a += c // 5 + m // 10
while True:
	if c % 5 == 0 and m % 10 == 0:
		if a <= n:
			print('YES')
		else:
			print('NO')
		break
	elif c % 5 != 0 and m % 10 != 0:
		a += 2
		if a <= n:
			print('YES')
		else:
			print('NO')
		break
	else:
		a += 1
		if a <= n:
			print('YES')
		else:
			print('NO')
		break


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = int(input())
sum = 0
d = 0
for i in range(len(a)):
	sum = sum + a[i]
for j in range(len(b)):
	d = d + b[j]
if sum % 5 == 0:
	z = sum // 5
else:
	z = sum // 5 + 1
if d % 10 == 0:
	x = d // 10
else:
	x = d // 10 + 1
if z + x <= c:
	print('YES')
else:
	print('NO')


arr = sum(list(map(int, input().split())))
brr = sum(list(map(int, input().split())))
n = int(input())
a = arr // 5
a1 = arr % 5
b = brr // 10
b1 = brr % 10
if a1 == 0 and b1 == 0:
	if a + b <= n:
		print('YES')
	else:
		print('NO')
elif a1 != 0 and b1 != 0:
	if a + b + 2 <= n:
		print('YES')
	else:
		print('NO')
elif a + b + 1 <= n:
	print('YES')
else:
	print('NO')


l = list(map(int, input().split()))
cup = sum(l)
li = list(map(int, input().split()))
med = sum(li)
n = int(input())
res = cup // 5 + med // 10
if cup % 5 != 0:
	res = res + 1
if med % 10 != 0:
	res = res + 1
if n >= res:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
print(['YES', 'NO'][(sum((i for i in a)) + 4) // 5 + (sum((i for i in b)) + 9) // 10 > n])


cups_list = input().split()
medals_list = input().split()
shelves = int(input())
cups = int(cups_list[0]) + int(cups_list[1]) + int(cups_list[2])
medals = int(medals_list[0]) + int(medals_list[1]) + int(medals_list[2])
cup_shelves = cups // 5
if cups % 5 != 0:
	cup_shelves += 1
medal_shelves = medals // 10
if medals % 10 != 0:
	medal_shelves += 1
if cup_shelves + medal_shelves > shelves:
	print('NO')
else:
	print('YES')


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
n = int(input())
a_sum = 0
b_sum = 0
used = 0
for i in a:
	a_sum += i
for i in b:
	b_sum += i
while a_sum > 0:
	a_sum -= 5
	used += 1
while b_sum > 0:
	b_sum -= 10
	used += 1
print('NO' if used > n else 'YES')


import math
cups = input('')
medals = input('')
(cup1, cup2, cup3) = cups.split()
a1 = int(cup1)
a2 = int(cup2)
a3 = int(cup3)
(med1, med2, med3) = medals.split()
b1 = int(med1)
b2 = int(med2)
b3 = int(med3)
shelves = input('')
n = int(shelves)
a = a1 + a2 + a3
b = b1 + b2 + b3
x1 = math.ceil(a / 5)
x2 = math.ceil(b / 10)
if n >= x1 + x2:
	print('YES')
else:
	print('NO')


sum1 = sum(map(int, input().split(' ')))
x = 0
if not sum1 % 5:
	if sum1 == 0:
		x += 0
	else:
		x += sum1 // 5
else:
	x += sum1 // 5 + 1
sum2 = sum(map(int, input().split(' ')))
if not sum2 % 10:
	if sum2 == 0:
		x += 0
	else:
		x += sum2 // 10
else:
	x += sum2 // 10 + 1
if x <= int(input()):
	print('YES')
else:
	print('NO')


r = list(map(int, input().split()))
m = list(map(int, input().split()))
n = int(input())
rs = sum(r) // 5
if sum(r) % 5 != 0:
	rs += 1
ms = sum(m) // 10
if sum(m) % 10 != 0:
	ms += 1
if rs + ms <= n:
	print('YES')
else:
	print('NO')


import math
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = int(input())
s1 = sum(a)
s2 = sum(b)
c = d = 0
if s1 == 0:
	c = 0
if s2 == 0:
	d = 0
if s1 != 0 or s2 != 0:
	if s1 >= 5:
		c = math.ceil(s1 / 5)
	elif 0 < s1 < 5:
		c += 1
	if s2 >= 10:
		d = math.ceil(s2 / 10)
	elif 0 < s2 < 5:
		d += 1
if c + d > n:
	print('NO')
else:
	print('YES')


c = list(map(int, input().split()))
m = list(map(int, input().split()))
s = int(input())
if sum(c) % 5 == 0:
	s -= sum(c) // 5
else:
	s -= sum(c) // 5 + 1
if sum(m) % 10 == 0:
	s -= sum(m) // 10
else:
	s -= sum(m) // 10 + 1
if s < 0:
	print('NO')
else:
	print('YES')


cups = input().split()
medals = input().split()
n = int(input())
sumc = 0
summ = 0
for i in range(len(cups)):
	sumc += int(cups[i])
	summ += int(medals[i])
if sumc % 5 == 0:
	n -= sumc // 5
else:
	n -= sumc // 5
	n -= 1
if summ % 10 == 0:
	n -= summ // 10
else:
	n -= summ // 10
	n -= 1
if n < 0:
	print('NO')
else:
	print('YES')


total_cups = sum(map(int, input().split()))
total_medals = sum(map(int, input().split()))
num_shelves = int(input())
MEDAL_SHELF_MAX = 10
MEDAL_CUP_MAX = 5
remaining_cups = total_cups
remaining_medals = total_medals
for i in range(num_shelves):
	if remaining_cups > 0:
		remaining_cups -= min(remaining_cups, MEDAL_CUP_MAX)
	elif remaining_medals > 0:
		remaining_medals -= min(remaining_medals, MEDAL_SHELF_MAX)
	else:
		break
print('YES' if remaining_cups == 0 and remaining_medals == 0 else 'NO')


a_total = sum(map(int, input().split()))
b_total = sum(map(int, input().split()))
n = int(input())

def solve(a_total, b_total):
	(a_need, a_left) = divmod(a_total, 5)
	(b_need, b_left) = divmod(b_total, 10)
	a_left = min(1, a_left)
	b_left = min(1, b_left)
	res = a_need + a_left + b_need + b_left
	check = res <= n
	return 'YES' if check else 'NO'
print(solve(a_total, b_total))


c = [int(p) for p in input().split(' ')]
m = [int(p) for p in input().split(' ')]
n = int(input())
import math
c_sum = sum(c)
m_sum = sum(m)
if n >= 1:
	if math.ceil(c_sum / 5) + math.ceil(m_sum / 10) <= n:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


s1 = [int(i) for i in input().split()]
if (s1[0] + s1[1] + s1[2]) % 5 != 0:
	s1 = (s1[0] + s1[1] + s1[2]) // 5 + 1
else:
	s1 = (s1[0] + s1[1] + s1[2]) // 5
s2 = [int(i) for i in input().split()]
if (s2[0] + s2[1] + s2[2]) % 10 != 0:
	s2 = (s2[0] + s2[1] + s2[2]) // 10 + 1
else:
	s2 = (s2[0] + s2[1] + s2[2]) // 10
n = int(input())
if s1 + s2 <= n:
	print('YES')
else:
	print('NO')


tac = input()
med = input()
prat = int(input())
nmed = 0
ntac = 0
org = ''
aux = ''
for q in med:
	if q != ' ':
		aux += q
	else:
		nmed += int(aux)
		aux = ''
nmed += int(aux)
aux = ''
for w in tac:
	if w != ' ':
		aux += w
	else:
		ntac += int(aux)
		aux = ''
ntac += int(aux)
aux = ''
while prat > 0:
	if nmed > 0 and prat > 0:
		nmed -= 10
		prat -= 1
	if ntac > 0 and prat > 0:
		ntac -= 5
		prat -= 1
	if nmed <= 0 and ntac <= 0:
		prat = 0
if prat <= 0 and nmed >= 1 or ntac >= 1:
	org = 'NO'
else:
	org = 'YES'
print(org)


cups = list(map(int, input().split()))
medals = list(map(int, input().split()))
n_shelves = int(input())
c_c = sum(cups)
c_medals = sum(medals)
c = 0
while c_c > 0:
	c += 1
	c_c -= 5
while c_medals > 0:
	c += 1
	c_medals -= 10
if c <= n_shelves:
	print('YES')
else:
	print('NO')