AtCoder Beginner Contest 123 - Five Antennas

In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.

Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.

Determine if there exists a pair of antennas that cannot communicate directly.

Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.  

-----Constraints-----
 - a, b, c, d, e and k are integers between 0 and 123 (inclusive).
 - a < b < c < d < e

-----Input-----
Input is given from Standard Input in the following format:
a
b
c
d
e
k

-----Output-----
Print :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.

-----Sample Input-----
1
2
4
8
9
15

-----Sample Output-----
Yay!

In this case, there is no pair of antennas that cannot communicate directly, because:
 - the distance between A and B is 2 - 1 = 1
 - the distance between A and C is 4 - 1 = 3
 - the distance between A and D is 8 - 1 = 7
 - the distance between A and E is 9 - 1 = 8
 - the distance between B and C is 4 - 2 = 2
 - the distance between B and D is 8 - 2 = 6
 - the distance between B and E is 9 - 2 = 7
 - the distance between C and D is 8 - 4 = 4
 - the distance between C and E is 9 - 4 = 5
 - the distance between D and E is 9 - 8 = 1
and none of them is greater than 15. Thus, the correct output is Yay!.

Difficulty: EASY

Starter code:

Solutions:
(a, *_, e, k) = map(int, open(0))
print('Y:a(y !'[e - a > k::2])


(*a, k) = map(int, open(0))
print('Y:a(y !'[max(a) - min(a) > k::2])


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e - a > k:
	print(':(')
else:
	print('Yay!')


import itertools
L = [int(input()) for _ in range(5)]
K = int(input())
Lcombi = itertools.combinations(L, 2)
for lc in Lcombi:
	if abs(lc[0] - lc[1]) > K:
		print(':(')
		return
print('Yay!')


(a, b, c, d, e, k) = [int(input()) for i in range(6)]
print('Yay!' if e - a <= k else ':(')


(a, b, c, d, e, k) = map(int, open(0).read().split())
if e - a <= k:
	print('Yay!')
else:
	print(':(')


l = [int(input()) for _ in range(6)]
print(':(' if l[4] - l[0] > l[5] else 'Yay!')


(a, *_, e, k) = (int(input()) for _ in [0] * 6)
print(':(' if k < e - a else 'Yay!')


s = [int(input()) for i in range(6)]
if s[4] - s[0] > s[5]:
	print(':(')
else:
	print('Yay!')


A = [int(input()) for _ in range(5)]
print('Yay!' if A[4] - A[0] <= int(input()) else ':(')


a = [int(input()) for _ in range(5)]
k = int(input())
print('Yay!' if a[-1] - a[0] <= k else ':(')


a = [int(input()) for _ in range(5)]
k = int(input())
print('Yay!' if max(a) - min(a) <= k else ':(')


ans = [int(input()) for _ in range(6)]
print(':(' if abs(ans[0] - ans[4]) > ans[-1] else 'Yay!')


ans = 0
position = []
for i in range(5):
	x = int(input())
	position.append(x)
k = int(input())
distance_list = []
for i in range(5):
	for j in range(5):
		if i != j:
			distance = abs(position[i] - position[j])
			distance_list.append(distance)
y = max(distance_list)
if y <= k:
	print('Yay!')
else:
	print(':(')


x = [int(input()) for _ in range(6)]
if x[4] - x[0] > x[-1]:
	print(':(')
else:
	print('Yay!')


a = [int(input()) for i in range(6)]
print('Yay!') if abs(a[4] - a[0]) <= a[5] else print(':(')


(a, *_, e, k) = [int(input()) for x in ' ' * 6]
print(['Yay!', ':('][e - a > k])


a = [int(input()) for i in range(5)]
print(':(' if max(a) - min(a) > int(input()) else 'Yay!')


(a, _, _, _, e, k) = [int(input()) for i in range(6)]
print(':(' if e - a > k else 'Yay!')


A = [int(input()) for i in range(5)]
k = int(input())
for i in range(5):
	for j in range(i + 1, 5):
		if A[j] - A[i] > k:
			print(':(')
			return
print('Yay!')


def main():
	antenna = [int(input()) for i in range(5)]
	k = int(input())
	print(':(' if max(antenna) - min(antenna) > k else 'Yay!')

def __starting_point():
	main()
__starting_point()


li = [0] * 5
ans = 'Yay!'
for i in range(5):
	li[i] = int(input())
k = int(input())
for j in range(5):
	for l in range(5):
		if j < l:
			if k - (li[l] - li[j]) < 0:
				ans = ':('
print(ans)


a = []
for i in range(6):
	temp = int(input())
	a.append(temp)
for i in range(4):
	for j in range(1, 5):
		if a[j] - a[i] > a[5]:
			print(':(')
			return
print('Yay!')


a = list(map(int, open(0)))
print(['Yay!', ':('][max(a[:5]) - min(a[:5]) > a[5]])


A = [int(input()) for i in range(5)]
k = int(input())
for j in range(4):
	for h in range(j + 1, 5):
		if k < abs(A[j] - A[h]):
			print(':(')
			return
print('Yay!')


a = list((int(input()) for i in range(5)))
k = int(input())
if a[4] - a[0] <= k:
	print('Yay!')
else:
	print(':(')


antennas = []
for i in range(5):
	antennas.append(int(input('')))
limit = int(input(''))
if antennas[4] - antennas[0] > limit:
	print(':(')
else:
	print('Yay!')


l = [int(input()) for _ in range(5)]
print('Yay!' if max(l) - min(l) <= int(input()) else ':(')


L = [int(input()) for k in range(5)]
k = int(input())
print('Yay!' if max(L) - min(L) <= k else ':(')


lst = list((int(input()) for _ in range(6)))
print('Yay!' if lst[4] - lst[0] <= lst[5] else ':(')


(a, _, _, _, e, k) = [int(input()) for _ in range(6)]
print(['Yay!', ':('][e - a > k])


n = []
for i in range(6):
	n.append(int(input()))
print('Yay!' if n[4] - n[0] <= n[5] else ':(')


a = [int(input()) for i in range(5)]
k = int(input())
for i in range(4):
	for j in range(i + 1, 5):
		if a[j] - a[i] > k:
			print(':(')
			return
print('Yay!')


a = int(input())
for i in range(3):
	input()
e = int(input())
print('Yay!' if e - a <= int(input()) else ':(')


antenna = [int(input()) for _ in range(5)]
k = int(input())
ans = 'Yay!'
for i in range(5):
	for j in range(5):
		if i < j:
			if antenna[j] - antenna[i] > k:
				ans = ':('
				break
	else:
		continue
	break
print(ans)


import sys
import math
a = [int(input()) for i in range(5)]
k = int(input())
for i in range(5):
	for j in range(5):
		if a[i] - a[j] > k:
			print(':(')
			return
print('Yay!')


a = [int(input()) for x in range(6)]
if a[4] - a[0] > a[5]:
	print(':(')
else:
	print('Yay!')


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
nums = [a, b, c, d, e]
for i in nums:
	for j in nums:
		if abs(i - j) > k:
			print(':(')
			return
print('Yay!')


a = [int(input()) for i in range(5)]
k = int(input())
if a[4] - a[0] > k:
	print(':(')
	return
print('Yay!')


A = []
for i in range(5):
	A.append(int(input()))
k = int(input())
ans = False
for i in range(5):
	for j in range(i + 1, 5):
		if abs(A[i] - A[j]) > k:
			ans = True
			break
if ans == False:
	print('Yay!')
else:
	print(':(')


l = [int(input()) for i in range(6)]
k = l[-1]
sub = l[-2] - l[0]
if sub <= k:
	print('Yay!')
else:
	print(':(')


(a, b, c, d, e, f) = [int(input()) for i in range(6)]
print('Yay!' if abs(a - e) <= f else ':(')


A = [int(input()) for i in range(5)]
K = int(input())
print(':(' if K < A[-1] - A[0] else 'Yay!')


(*Pos, K) = [int(input()) for _ in range(6)]
print('Yay!' if Pos[4] - Pos[0] <= K else ':(')


from itertools import combinations

def test():
	num_list = [int(input()) for _ in range(5)]
	k = int(input())
	l = list(combinations(num_list, 2))
	for (i, j) in l:
		if abs(i - j) > k:
			print(':(')
			return
	print('Yay!')
test()


A = [int(input()) for _ in [0] * 6]
print('Yay!' if A[-2] - A[0] <= A[-1] else ':(')


(*ant, k) = [int(input()) for _ in range(6)]
print(':(' if ant[-1] - ant[0] > k else 'Yay!')


a = [int(input()) for _ in range(5)]
k = int(input())
flag = False
for i in range(5):
	for j in range(i + 1, 5):
		tmp = abs(a[i] - a[j])
		if tmp > k:
			flag = True
			break
	if flag:
		break
if flag:
	print(':(')
else:
	print('Yay!')


i = [int(input()) for _ in range(6)]
o = ':(' if i[4] - i[0] > i[5] else 'Yay!'
print(o)


(a, b, c, d, e, k) = [int(input()) for _ in range(6)]
ans = 'Yay!'
if e - a > k:
	ans = ':('
print(ans)


a = int(input())
input()
input()
input()
print(':(' if int(input()) - a > int(input()) else 'Yay!')


a = [int(input()) for i in range(5)]
f = a[-1] - a[0] <= int(input())
print('Yay!' if f else ':(')


(a, b, c, d, e, k) = [int(input()) for _ in range(6)]
result = 'Yay!' if e - a <= k else ':('
print(result)


details = []
for i in range(6):
	details.append(int(input()))
checker = []
for i in details[:len(details) - 1]:
	for j in details[:len(details) - 1]:
		checker.append(j - i)
if max(checker) > details[-1]:
	print(':(')
else:
	print('Yay!')


import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
lst = [a, b, c, d, e]
c = list(itertools.combinations(lst, 2))
for (i, j) in c:
	if j - i > k:
		print(':(')
		break
else:
	print('Yay!')


l = [int(input()) for i in range(6)]
k = l[5]
if l[4] - l[0] > k:
	print(':(')
else:
	print('Yay!')


(a, b, c, d, e, f) = list((int(input()) for _ in range(6)))
print('Yay!' if e - a <= f else ':(')


dis = []
for i in range(5):
	dis.append(int(input()))
k = int(input())
if dis[4] - dis[0] <= k:
	print('Yay!')
else:
	print(':(')


L = [int(input()) for _ in range(6)]
print(['Yay!', ':('][L[4] - L[0] > L[5]])


l = [int(input()) for i in range(6)]
print(['Yay!', ':('][l[4] - l[0] > l[5]])


a = []
for i in range(5):
	a.append(int(input()))
b = int(input())
if a[4] - a[0] > b:
	print(':(')
else:
	print('Yay!')


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
d1 = b - a
d2 = c - a
d3 = d - a
d4 = e - a
d5 = c - b
d6 = d - b
d7 = e - b
d8 = d - c
d9 = e - c
d10 = e - d
if d1 > k or d2 > k or d3 > k or (d4 > k) or (d5 > k) or (d6 > k) or (d7 > k) or (d8 > k) or (d9 > k) or (d10 > k):
	print(':(')
else:
	print('Yay!')


a = [0] * 5
for i in range(5):
	a[i] = int(input())
k = int(input())
if a[-1] - a[0] > k:
	s = 0
else:
	s = 1
print([':(', 'Yay!'][s])


l = []
flg = False
for i in range(5):
	l.append(int(input()))
k = int(input())
l.sort(reverse=True)
for i in range(len(l)):
	for j in range(len(l) - i):
		if l[i] - l[j] > k:
			flg = True
print(':(' if flg else 'Yay!')


num = [int(input()) for i in range(5)]
k = int(input())
x = 'Yay!'
for h in num:
	for j in num:
		if k < j - h:
			x = ':('
print(x)


import itertools
L = []
for i in range(5):
	L.append(int(input()))
k = int(input())
M = []
for v in itertools.combinations(L, 2):
	M.append(list(v))
dist = []
for m in M:
	dist.append(abs(m[0] - m[1]))
if max(dist) > k:
	print(':(')
else:
	print('Yay!')


import itertools
a = []
for i in range(5):
	a.append(int(input()))
k = int(input())
cnt = 0
l = list(itertools.combinations(a, 2))
for i in range(len(l)):
	if abs(l[i][0] - l[i][1]) > k:
		cnt += 1
if cnt >= 1:
	print(':(')
else:
	print('Yay!')


t = []
for i in range(5):
	t.append(int(input()))
k = int(input())
t.sort()
if t[4] - t[0] > k:
	print(':(')
else:
	print('Yay!')


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def main():
	(*A,) = list(map(int, read().split()))
	k = A[-1]
	for i in range(5):
		for j in range(i + 1, 5):
			if A[j] - A[i] > k:
				print(':(')
				return
	print('Yay!')
	return

def __starting_point():
	main()
__starting_point()


(a, b, c, d, e, k) = [int(input()) for _ in range(6)]
print('Yay!' * (e - a <= k) or ':(')


v = [int(input()) for _ in range(6)]
a = v[0]
e = v[-2]
k = v[-1]
print(':(' if e - a > k else 'Yay!')


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
x = int(input())
ls = [a, b, c, d, e]
if e - a <= x:
	print('Yay!')
else:
	print(':(')


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
K = int(input())
LIST = [a, b, c, d, e]
LIST = sorted(LIST)
if LIST[-1] - LIST[0] <= K:
	print('Yay!')
else:
	print(':(')


l = list((int(input()) for _ in range(5)))
m = int(input())
print([':(', 'Yay!'][l[4] - l[0] <= m])


I = [int(input()) for i in range(6)]
print('Yay!' if I[-2] - I[0] <= I[-1] else ':(')


(a, *_, e, k) = map(int, open(0))
print(('Yay!', ':(')[e - a > k])


(a, b, c, d, e, f) = map(int, open(0).readlines())
print(':(' if e - a > f else 'Yay!')


s = []
for i in range(5):
	s.append(int(input()))
k = int(input())
for i in range(4):
	if s[i + 1] - s[0] > k:
		print(':(')
		break
else:
	print('Yay!')


num_list = []
count_cant_go = 0
for i in range(5):
	num_list.append(int(input()))
num_list.append(int(input()))
if max(num_list) - min(num_list) <= num_list[-1]:
	print('Yay!')
else:
	print(':(')


l = [int(input()) for _ in range(5)]
k = int(input())
for i in range(5):
	for j in range(i + 1, 5):
		if l[j] - l[i] > k:
			print(':(')
			return
print('Yay!')


a = []
for i in range(5):
	a.append(int(input()))
k = int(input())
isOK = True
for i in range(5):
	for j in range(i + 1, 5):
		if abs(a[i] - a[j]) > k:
			isOK = False
			break
if isOK:
	print('Yay!')
else:
	print(':(')


s = [int(input()) for i in range(5)]
k = int(input())
print('Yay!' if abs(max(s) - min(s)) <= k else ':(')


(a, *_, e, k) = (int(input()) for _ in [0] * 6)
print('Y:a(y !'[e - a > k::2])


abcde = [input() for i in range(5)]
k = int(input())
for ii in range(5):
	for jj in range(ii, 5):
		if int(abcde[jj]) - int(abcde[ii]) > k:
			print(':(')
			return
print('Yay!')


(*a, k) = map(int, open(0))
print(('Yay!', ':(')[a[4] - a[0] > k])


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def main():
	(a, b, c, d, e, k) = list(map(int, read().split()))
	if e - a > k:
		print(':(')
	else:
		print('Yay!')
	return

def __starting_point():
	main()
__starting_point()


(a, b, c, d, e) = [int(input()) for i in range(5)]
print('Yay!' if e - a <= int(input()) else ':(')


(*a, k) = map(int, open(0))
print('Y:a(y !'[a[4] - a[0] > k::2])


antenna = [input() for _ in range(5)]
k = int(input())
check = True
for i in range(4):
	for j in range(i + 1, 5):
		if int(antenna[j]) - int(antenna[i]) > k:
			check = False
print('Yay!' if check else ':(')


(a, b, c, d, e, k) = (int(input()) for _ in range(6))
print('Y:a(y !'[e - a > k::2])


abcde = [int(input()) for _ in range(5)]
k = int(input())
for i in range(4):
	for j in range(i, 5):
		if abcde[j] - abcde[i] > k:
			print(':(')
			return
print('Yay!')


hs = [int(input()) for i in range(5)]
k = int(input())
print(':(' if hs[-1] - hs[0] > k else 'Yay!')


a = int(input())
_ = int(input())
_ = int(input())
_ = int(input())
e = int(input())
k = int(input())
print('Yay!' if e - a <= k else ':(')


w = int(input())
for i in range(3):
	input()
e = int(input())
k = int(input())
if e - w <= k:
	print('Yay!')
else:
	print(':(')


s = [int(input()) for _ in range(5)]
s.sort()
print('Yay!' if s[-1] - s[0] <= int(input()) else ':(')


from itertools import combinations
s = [int(input()) for _ in [0] * 6]
k = s.pop()
r = 'Yay!'
for (i, j) in combinations(s, 2):
	if j - i > k:
		r = ':('
		break
print(r)


(a, b, c, d, e) = [int(input()) for _ in range(5)]
k = int(input())
print(':(' if e - a > k else 'Yay!')


x = [int(input()) for i in range(5)]
k = int(input())
if x[4] - x[0] <= k:
	print('Yay!')
else:
	print(':(')


(*l, k) = map(int, open(0))
print('Yay!' if max(l) - min(l) <= k else ':(')


v = list(map(int, open(0).read().split()))
print(':(' if v[5] < v[4] - v[0] else 'Yay!')


x = [int(input()) for i in range(5)]
k = int(input())
print('Yay!' if max(x) - min(x) <= k else ':(')


x = [int(input()) for _ in range(5)]
k = int(input())
M = max(x)
m = min(x)
if M - m > k:
	print(':(')
else:
	print('Yay!')


a = [int(input()) for _ in range(6)]
print('Yay!') if a[-2] - a[0] < a[-1] + 1 else print(':(')


def f():
	x = [int(input()) for _ in range(5)]
	k = int(input())
	for i in range(5):
		for j in range(5):
			if abs(x[i] - x[j]) > k:
				return ':('
	return 'Yay!'
print(f())


a = [int(input()) for _ in range(5)]
print([':(', 'Yay!'][a[-1] - a[0] <= int(input())])


(a, b, c, d, e) = [int(input()) for _ in range(5)]
k = int(input())
d1 = b - a
d2 = c - a
d3 = d - a
d4 = e - a
d5 = c - b
d6 = d - b
d7 = e - b
d8 = d - c
d9 = e - c
d10 = e - d
if d1 > k or d2 > k or d3 > k or (d4 > k) or (d5 > k) or (d6 > k) or (d7 > k) or (d8 > k) or (d9 > k) or (d10 > k):
	print(':(')
else:
	print('Yay!')


n = [int(input()) for _ in range(6)]
print([':(', 'Yay!'][max(n[:5]) - min(n[:5]) <= n[5]])


(a, *_, e, k) = eval('int(input()),' * 6)
print('Y:a(y !'[e - a > k::2])


(a, b, c, d, e, k) = map(int, open(0))
print((':(', 'Yay!')[e - a <= k])


a = []
for i in range(5):
	a.append(int(input()))
a.sort()
j = int(input())
k = a[4] - a[0]
if k <= j:
	print('Yay!')
else:
	print(':(')


lists = []
for _ in range(5):
	lists.append(int(input()))
k = int(input())
lists.sort()
maximum = lists[-1]
minimum = lists[0]
if k < maximum - minimum:
	ans = ':('
else:
	ans = 'Yay!'
print(ans)


(a, *_, e, k) = eval('int(input()),' * 6)
print(':(' * (e - a > k) or 'Yay!')


arr = [int(input()) for _ in range(6)]
d = arr[4] - arr[0]
print('Yay!' if d <= arr[5] else ':(')


cor = [0 for i in range(5)]
for i in range(5):
	cor[i] = int(input())
k = int(input())
flag = True
for i in range(5):
	for j in range(i, 5):
		if abs(cor[i] - cor[j]) > k:
			flag = False
if flag:
	print('Yay!')
else:
	print(':(')


a = [int(input()) for x in range(5)]
k = int(input())
flg = False
for (i, x) in enumerate(a):
	for (j, y) in enumerate(a):
		if i == j:
			continue
		flg = flg or abs(y - x) > k
print(':(' if flg else 'Yay!')


a = []
for i in range(5):
	a.append(int(input()))
b = int(input())
for i in range(4):
	if abs(a[0] - a[i + 1]) > b:
		print(':(')
		return
for i in range(3):
	if abs(a[1] - a[i + 2]) > b:
		print(':(')
		return
for i in range(2):
	if abs(a[2] - a[i + 3]) > b:
		print(':(')
		return
for i in range(1):
	if abs(a[3] - a[i + 4]) > b:
		print(':(')
		return
print('Yay!')


import sys
inp = lambda : sys.stdin.readline()
mi = lambda : map(int, inp().split())
li = lambda : list(map(int, inp().split()))
mf = lambda : map(float, inp().split())
lf = lambda : list(map(float, inp().split()))
A = int(inp())
B = int(inp())
C = int(inp())
D = int(inp())
E = int(inp())
K = int(inp())
print('Yay!' if E - A <= K else ':(')


antennas = []
for i in range(5):
	antennas.append(int(input()))
k = int(input())
for e in antennas[:0:-1]:
	if e - antennas[0] > k:
		print(':(')
		break
else:
	print('Yay!')


ls = [int(input()) for i in range(5)]
print('Yay!' if ls[4] - ls[0] <= int(input()) else ':(')


ls = []
ans = 'Yay!'
for i in range(5):
	ls.append(int(input()))
k = int(input())
for i in range(5):
	for j in range(5):
		if abs(ls[i] - ls[j]) > k:
			ans = ':('
			break
print(ans)


import math
s = [int(input()) for i in range(5)]
k = int(input())
q = 0
if abs(s[4] - s[0]) <= k:
	q = 1
if q == 1:
	print('Yay!')
if q == 0:
	print(':(')


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
l = []
l.append(a)
l.append(b)
l.append(c)
l.append(d)
l.append(e)
ans = 0
for i in range(5):
	for j in range(i + 1, 5):
		if l[j] - l[i] > k:
			ans += 1
if ans == 0:
	print('Yay!')
else:
	print(':(')


import numpy as np

def solve(a, b, c, d, e, k):
	arr = np.array([a, b, c, d, e])
	(arr, arr2) = [a.flatten() for a in np.meshgrid(arr, arr)]
	arr = np.c_[arr, arr2]
	arr = np.array(list([abs(x[0] - x[1]) for x in arr]))
	print(':(' if arr.max() > k else 'Yay!')

def __starting_point():
	(a, b, c, d, e, k) = [int(input()) for _ in range(6)]
	solve(a, b, c, d, e, k)
__starting_point()


A = [int(input()) for _ in range(5)]
K = int(input())
print('Yay!' if max(A) - min(A) <= K else ':(')


a = []
for i in range(5):
	a.append(int(input()))
k = int(input())
for i in range(5):
	for j in range(i, 5):
		if a[j] - a[i] > k:
			print(':(')
			return
print('Yay!')


a = sorted([int(input()) for _ in range(5)])
print('Yay!' if a[4] - a[0] <= int(input()) else ':(')


(a, *_, e, k) = map(int, open(0).read().split())
print(':(' * (e - a > k) or 'Yay!')


import sys

def solve(a: int, b: int, c: int, d: int, e: int, k: int):
	print('Yay!' if e - a <= k else ':(')

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	a = int(next(tokens))
	b = int(next(tokens))
	c = int(next(tokens))
	d = int(next(tokens))
	e = int(next(tokens))
	k = int(next(tokens))
	solve(a, b, c, d, e, k)

def __starting_point():
	main()
__starting_point()


(a, *_, e, k) = map(int, open(0).read().split())
print(':(' if k < e - a else 'Yay!')


l = [int(input()) for _ in range(5)]
k = int(input())
print([':(', 'Yay!'][k >= l[4] - l[0]])


def Input():
	return mapt(int, input().split(' '))

def calc(i, h):
	return all((h[i] >= h[j] for j in range(i)))

def main():
	data = [int(input()) for _ in range(5)]
	k = int(input())
	print('Yay!' if k >= data[-1] - data[0] else ':(')
main()