Harryxun/stf_run huggingface dataset:
h, w = map(int, input().split())
ls = [input().rstrip() for _ in range(h)]
ds = [[float('inf') for _ in range(w)] for _ in range(h)]
ds[0][0] = 1

dxdy = [(-1, 0), (1, 0), (0, -1), (0, 1)]


def bfs(x, y):
    for i in range(4):
        dx, dy = dxdy[i]
        nx = x + dx
        ny = y + dy
        if 0 <= nx < w and 0 <= ny < h and ls[ny][nx] == '.':
            if ds[ny][nx] > ds[y][x] + 1:
                ds[ny][nx] = ds[y][x] + 1
                bfs(nx, ny)


bfs(0, 0)
d = ds[h - 1][w - 1]
if d < float('inf'):
    s = sum([l.count('.') for l in ls])
    print(s - d)
else:
    print(-1)

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**6)

h, w = map(int, input().split())
ls = [input().rstrip() for _ in range(h)]
ds = [[float('inf') for _ in range(w)] for _ in range(h)]
ds[0][0] = 1

dxdy = [(-1, 0), (1, 0), (0, -1), (0, 1)]


def dfs(x, y):
    for i in range(4):
        dx, dy = dxdy[i]
        nx = x + dx
        ny = y + dy
        if 0 <= nx < w and 0 <= ny < h and ls[ny][nx] == '.':
            if ds[ny][nx] > ds[y][x] + 1:
                ds[ny][nx] = ds[y][x] + 1
                dfs(nx, ny)


dfs(0, 0)
d = ds[h - 1][w - 1]
if d < float('inf'):
    s = sum([l.count('.') for l in ls])
    print(s - d)
else:
    print(-1)
from numpy import lcm
a, b = map(int, input().split())
print(lcm(a, b))

### FIXED CODE ###

from fractions import gcd
a, b = map(int, input().split())
print(int(a*b/gcd(a, b)))
s = [0] * 13
h = [0] * 13
c = [0] * 13
d = [0] * 13

num = int(input())
for i in range(num):
    m, n = input().split()
    x = int(n)
    if m == "S":
        s[x] = 1
    elif m == "H":
        h[x] = 1
    elif m == "C":
        c[x] = 1
    elif m == "D":
        d[x] = 1
    else:
        break

for i in range(1,13):
    if s[i] == 0:
        print("S %d" % i)

for i in range(1,13):
    if h[i] == 0:
        print("H %d" % i)

for i in range(1,13):
    if c[i] == 0:
        print("C %d" % i)

for i in range(1,13):
    if d[i] == 0:
        print("D %d" % i)






### FIXED CODE ###

#
# 6b
#

def main():
    n = int(input())
    c = []
    for i in range(n):
        m, r = input().split()
        r = int(r)
        c.append([m, r])
    for M in ["S", "H", "C", "D"]:
        for R in range(1, 14):
            for i in range(n):
                if c[i] == [M, R]:
                    break
            else:
                print(*[M, R])


if __name__ == '__main__':
    main()
h,w = map(int,input().split())

for i in range(h):
  	c = input()
    print(c)
    print(c)

### FIXED CODE ###

H, W = map(int, input().split())
for _ in range(H):
    s = input()
    print(s)
    print(s)
A, B = map(int, input().split())
print('Alice' if A>B or A==1 and B==2 else 'Draw' if A==B 'Bob')

### FIXED CODE ###

A, B = map(int, input().split()) 
if A==B:
    print('Draw')
elif A==1:
    print('Alice')
elif B==1:
    print('Bob')
elif A>B:
    print('Alice')
else:
    print('Bob')
A = list(input().split(" "))
N = int(A[0])
K = int(A[1])
H = list(input().split(" "))
sum = 0
H.sort()
for i in range(K):
    H[N-1-i] = 0
for i in range(N):
    sum += int(H[i])
print(sum)


### FIXED CODE ###

n,k = map(int,input().split())
H = list(map(int,input().split()))
H.sort(reverse = True)
H = H[k:]
print(sum(H))
n, A, B = map(int, input().split())
a, b = 0
s = input()
for i in range(n):
    s_i = s[i]
    if s_i == 'a':
        if (a + b) < (A + B):
            a += 1
            print('Yes')
        else:
            print('No')
    elif s_i == 'b':
        if ((a + b) < (A + B)) & (b < B):
            b += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')
    


### FIXED CODE ###

n, A, B = map(int, input().split())
a, b = 0, 0
s = input()
for i in range(n):
    s_i = s[i]
    if s_i == 'a':
        if (a + b) < (A + B):
            a += 1
            print('Yes')
        else:
            print('No')
    elif s_i == 'b':
        if ((a + b) < (A + B)) & (b < B):
            b += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')
n = read()

arr = list(n)
output = ""
for e in arr
  if e == '1':
    output += '9'
  else:
    output += '1'

print(output)

### FIXED CODE ###

n = input()
 
arr = list(n)
output = ""
for e in arr:
  if e == '1':
    output += '9'
  else:
    output += '1'
 
print(output)
a,b,c,d=map(int,input().split())

print("Yes" if ((abs(a-b)=<d and (abs(c-b)=<d or (abs(c-a)=<d) else "No") 

### FIXED CODE ###

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

print("Yes" if ((abs(a-b)<=d and (abs(c-b)<=d)) or abs(c-a)<=d) else "No")
n,k = map(int,input().split())
v = list(map(int,input().split()))
ansl = []
p = 1
for i in range(min(k+1,n+1)):
    for j in range(i+1):
        v1 = v[0:j]
        v2 = v[n-(i-j):n]    
        v1.extend(v2)
        v1.sort()
        for x in range(k-i):
            if len(v1) != 0:
                del v1[0]
        if len(v1) != 0:
            ansl.append(sum(v1))
        elif len(v1) == 0 and k%2 == 0:
            ansl.append(0)
ans = max(ansl)
print(ans)

### FIXED CODE ###

n,k = map(int,input().split())
v = list(map(int,input().split()))
ansl = []
for i in range(min(k+1,n+1)):
    for j in range(i+1):
        v1 = v[0:j]
        v2 = v[n-(i-j):n]    
        v1.extend(v2)
        v1.sort()
        for x in range(k-i):
            if len(v1) != 0 and v1[0] < 0:
                del v1[0]
            else:
                break
        if len(v1) != 0:
            ansl.append(sum(v1))
        else:
            ansl.append(0)
ans = max(ansl)
print(ans)
A=int(input())
B=int(input())

print((A-1)*(B-1))

### FIXED CODE ###

A,B=map(int,input().split())

print((A-1)*(B-1))
items,select = input().split()
x = [int(items) for x in input().split()]
for u in x:
    if u > (1 / (4 * int(select))*sum(x)):
        print("No")
        break
    else:
        print("Yes")
        break


### FIXED CODE ###

A,B,C= map(int,input().split())
print(C,A,B)
Q = int(input())
l = [0]*Q
for i in range(Q):
    l[i] = list(map(int,input().split()))

def is_prime(n):
    for i in range(2,int(math.sqrt(n))+1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1

for i in range(Q):
    sum = 0
    for j in range(l[i][0],l[i][1]+1):
        if is_prime(j) and is_prime((j+1)//2):
            sum +=1
        else:
            continue
    print(sum)

### FIXED CODE ###

import itertools
import math
from collections import deque
from collections import defaultdict
from itertools import permutations
import heapq
import bisect
INF = float("inf")

Q = int(input())
l = [0]*Q
Sum = [0]*(10**5+1)
for i in range(Q):
    l[i] = list(map(int,input().split()))

def is_prime(n):
    for i in range(2,int(math.sqrt(n))+1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1
for i in range(3,10**5+1,2):
    if is_prime(i) and is_prime((i+1)//2):
        Sum[i] = Sum[i-2]+1
    else:
        Sum[i] = Sum[i-2]

for i in range(Q):
    if l[i][1] ==1:
        print(0)
    elif l[i][0] == 1:
        print(Sum[l[i][1]])
    else:
        print(Sum[l[i][1]]-Sum[l[i][0]-2])
import sys

Num = int(sys.stdin.readline().rstrip())
list_stu_Num = list(sys.stdin.readline().rstrip().split())
list_stu_Num_int = [int(s) for s in list_stu_Num]
list_attend_stu = None
for i in range(1, Num + 1):
    for l in range(0, Num):
        if list_stu_Num_int[l] == i:
            if not list_attend_stu:
                list_attend_stu = list(str(l + 1))
            else:
                list_attend_stu.append(l + 1)
print(*list_attend_stu)

### FIXED CODE ###

import sys

a = sys.stdin.readline().rstrip()
a_int = int(a)

if a_int%2==0:
    print("0.5")
elif a_int == 1:
    print("1.0000000000")
else:
    b = ((a_int - 1)/2 + 1) / a_int
    print('{:.10f}'.format(b))
S = "".join([i if i in 'ACGT' else ' ' for i in input()])
print(max([len(i) for i in S.split()]))

### FIXED CODE ###

S = "".join([i if i in 'ACGT' else ' ' for i in input()])
print(max([len(i) for i in S.split()]+[0]))
s = input()

if s = 'ABC':
  print('ARC')
elif s = 'ARC':
  print('ABC')

### FIXED CODE ###

s = input()
if s == 'ABC':
  print('ARC')
elif s == 'ARC':
  print('ABC')
r,d,x=int(input().split())

for i in range(11):
  x= x*r-d
  print(x)

### FIXED CODE ###

r,d,x=map(int,input().split())

for i in range(10):
  x= x*r-d
  print(x)
import numpy as np

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

e = c * d // np.gcd(c,d)
c_count = b // c - a // c
if a % c == 0:
    c_count += 1
d_count = b // d - a // d
if a % d == 0:
    d_count += 1
e_count = b // e - a // e
if a % e == 0:
    e_count += 1

ans = b - a + 1 - (c_count + d_count - e_count)

print(ans)

### FIXED CODE ###

import fractions

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

e = c * d // fractions.gcd(c,d)
c_count = b // c - a // c
if a % c == 0:
    c_count += 1
d_count = b // d - a // d
if a % d == 0:
    d_count += 1
e_count = b // e - a // e
if a % e == 0:
    e_count += 1

ans = b - a + 1 - (c_count + d_count - e_count)

print(ans)
def main() :
    lst = input().split()
    stack = []
    for i in lst :
        if i == ""+"" :
            x = stack.pop()
            y = stack.pop()
            stack.append(x + y)

        elif i == "-" :
            x = stack.pop()
            y = stack.pop()
            stack.append(y - x)

        elif i == "*" :
            x = stack.pop()
            y = stack.pop()
            stack.append(x * y)

        else :
            stack.append(int(i))

    print(stack.pop())


if __name__ == "__main__" :
    main()

    

### FIXED CODE ###

def main() :
    lst = input().split()
    stack = []
    for i in lst :
        if i == "+" :
            x = stack.pop()
            y = stack.pop()
            stack.append(x + y)

        elif i == "-" :
            x = stack.pop()
            y = stack.pop()
            stack.append(y - x)

        elif i == "*" :
            x = stack.pop()
            y = stack.pop()
            stack.append(x * y)

        else :
            stack.append(int(i))

    print(stack.pop())


if __name__ == "__main__" :
    main()
import math
n=int(input())
for _ in range(n):
    a,b,c,d=map(int,input().split())
    if d<b:
        print("No")
        continue
    elif a<b:
        print("No")
        continue
    g=math.gcd(b,d)
    h=1
    if 1+h>c:
        print("No")
        continue
    print("Yes")

### FIXED CODE ###

import fractions 
n=int(input())
for _ in range(n):
    a,b,c,d=map(int,input().split())
    if d<b:
        print("No")
        continue
    elif a<b:
        print("No")
        continue
    elif c>=b:
        print("Yes")
        continue
    g=fractions.gcd(b,d)
    h=((b-1-a%b)//g)*g
    if a%b+h>c:
        print("No")
        continue
    print("Yes")
t = int(input())
x = int(input())
ans = 0.0

if 1 <= t and t <= 100:
  if 1 <= x and x <= 100:
    answer = t / x
    print(ans)


### FIXED CODE ###

i = list(map(int, input().split()))
ans = 0.0

if 1 <= i[0] and i[0] <= 100:
  if 1 <= i[1] and i[1] <= 100:
    ans = i[0] / i[1]
    print(ans)
#!/usr/bin/python3
# -*- coding: utf-8 -*-

# scipy version

import sys
from collections import deque
from array import array

import numpy

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components

def input():
    return sys.stdin.readline().rstrip('\n')

##### main

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

#C = [[0]*N for _ in range(N)]
#
#for i in range(M):
#    a,b,c = list(map(int, input().split()))
#    C[a-1][b-1] = c

R = numpy.full(N, 0, dtype=numpy.int32)
C = numpy.full(N, 0, dtype=numpy.int32)
V = numpy.full(N, 0, dtype=numpy.int32)

for i in range(M):
    r,c,v = list(map(int, input().split()))
    R[i] = r-1
    C[i] = c-1
    V[i] = v

matrix = csr_matrix((V,(R,C)), shape=(N,N))

n = connected_components(matrix, directed=False, return_labels=False)

print(n)


### FIXED CODE ###

#!/usr/bin/python3
# -*- coding: utf-8 -*-

# scipy version

import sys
from collections import deque
from array import array

import numpy

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components

def input():
    return sys.stdin.readline().rstrip('\n')

##### main

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

#C = [[0]*N for _ in range(N)]
#
#for i in range(M):
#    a,b,c = list(map(int, input().split()))
#    C[a-1][b-1] = c

R = numpy.full(M, 0, dtype=numpy.int32)
C = numpy.full(M, 0, dtype=numpy.int32)
V = numpy.full(M, 0, dtype=numpy.int32)

for i in range(M):
    r,c,v = list(map(int, input().split()))
    R[i] = r-1
    C[i] = c-1
    V[i] = v

matrix = csr_matrix((V,(R,C)), shape=(N,N))

n = connected_components(matrix, directed=False, return_labels=False)

print(n)
n = int(input())
dic_items = {0:'a',1:'b',2:'c',3:'d',4:'e',5:'f',6:'g',7:'h',8:'i',9:'j',10:'k'\
             ,11:'l',12:'m',13:'n',14:'o',15:'p',16:'q',17:'r',18:'s'
             ,19:'t',20:'u',21:'v',22:'w',23:'x',24:'y',25:'z'}
ans = []
while n != 0:
  ans.append(n%26)
  n = n//26
for i in range(len(ans)):
  print(dic_items[ans[len(ans)-1-i]-1],end='')

### FIXED CODE ###

n = int(input())
dic_items = {0:'a',1:'b',2:'c',3:'d',4:'e',5:'f',6:'g',7:'h',8:'i',9:'j',10:'k'\
             ,11:'l',12:'m',13:'n',14:'o',15:'p',16:'q',17:'r',18:'s'
             ,19:'t',20:'u',21:'v',22:'w',23:'x',24:'y',25:'z'}
ans = []
while n != 0:
  n -= 1
  ans.append(n%26)
  n = n//26
for i in range(len(ans)):
  print(dic_items[ans[len(ans)-1-i]],end='')
do_list = []
x=0
N = int(input())
s = input()
for i in range(N):
  if s[i]=="I":
    x+=1
  if S[i]=="D":
    x-=1
  do_list.append(x)
print(max(do_list))

### FIXED CODE ###

do_list = [0]
x=0
N = int(input())
s = input()
for i in range(N):
  if s[i]=="I":
    x+=1
  if s[i]=="D":
    x-=1
  do_list.append(x)
print(max(do_list))
N = int(input())
points = [list(map(int, input().split(" "))) for _ in range(point_count)]
points.insert(0, [0, 0, 0])

can = True
for i in range(N):
    dt = points[i + 1][0] - points[i][0]
    dist = abs(x[i + 1][0] - x[i][0]) + abs(y[i + 1][0] - y[i][0])
    if dt < dist:
        can = False
    if dist % 2 != dt % 2:
        can =False
if can:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

N = int(input())
points = [list(map(int, input().split(" "))) for _ in range(N)]
points.insert(0, [0, 0, 0])

can = True
for i in range(N):
    dt, dist = 0, 0
    dt = points[i + 1][0] - points[i][0]
    dist = abs(points[i + 1][1] - points[i][1]) + abs(points[i + 1][2] - points[i][2])
    if dt < dist:
        can = False
    if dist % 2 != dt % 2:
        can = False

if can:
    print("Yes")
else:
    print("No")
#ABC061C
import sys
N, K = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
now = 0
ans = ""
for a, b in ab:
    for i in range(b):
        now += 1
        if now == K:
            print(a)
            sys.exit(0)

### FIXED CODE ###

#ABC061A
A,B,C = map(int,input().split())
if C >= A and C <= B:
    print("Yes")
else:
    print("No")
A = list(int(input()) for _ in range(5))
B = []
for i in range(5):
    if A[i] % 10 != 0:
        
        B.append(10 - A[i] % 10)
B.remove(max(B))
print(sum(A) + sum(B))


### FIXED CODE ###

A = list(int(input()) for _ in range(5))
B = [0]
for i in range(5):
    if A[i] % 10 != 0:
        
        B.append(10 - A[i] % 10)
B.remove(max(B))
print(sum(A) + sum(B))
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop,heapify
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

from itertools import accumulate
from functools import lru_cache

M = mod = 10 ** 9 + 7
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)
 
def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n')]
def li3():return [int(i) for i in input().rstrip('\n')]
 



sys.setrecursionlimit(10 ** 5 + 10)

g = 0
@lru_cache(None)
def dp(i, par = -1, black = 0):
    global g
    ans = 1
    nokids = 1
    if black:
        for j in g[i]:
            if j != par:
                nokids = 0
                ans = ans * dp(j, i, 0) % mod
    else:
        for j in g[i]:
            if j != par:
                nokids = 0
                ans = ( ans * (dp(j, i, 0) + dp(j, i, 1)) ) % mod

    if nokids:ans = 1
    return ans



n = val()
g = [set() for i in range(n + 1)]

l = []
for _ in range(n - 1):
    a, b = li()
    g[a].add(b)
    g[b].add(a)


root = 1    
ans = dp(root, -1, 0) + dp(root, -1, 1)

print(ans % mod)

### FIXED CODE ###

from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop,heapify
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

from itertools import accumulate
from functools import lru_cache

M = mod = 10 ** 9 + 7
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)
 
def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n')]
def li3():return [int(i) for i in input().rstrip('\n')]
 



sys.setrecursionlimit(10 ** 6)

g = 0
@lru_cache(None)
def dp(i, par = -1, black = 0):
    global g
    ans = 1
    nokids = 1
    if black:
        for j in g[i]:
            if j != par:
                nokids = 0
                ans = ans * dp(j, i, 0) % mod
    else:
        for j in g[i]:
            if j != par:
                nokids = 0
                ans = ( ans * (dp(j, i, 0) + dp(j, i, 1)) ) % mod

    if nokids:ans = 1
    return ans



n = val()
g = [[] for i in range(n + 1)]

l = []
for _ in range(n - 1):
    a, b = li()
    g[a].append(b)
    g[b].append(a)


root = 1    
ans = dp(root, -1, 0) + dp(root, -1, 1)

print(ans % mod)
a, b, c = map(int, input().split())
A = []
A.append(a)
A.append(b)
A.append(c)
A = A.sort()
sum = 0
for i in range(4):
	sum += int(A[i]) - int(A[i-1])
print(sum)

### FIXED CODE ###

from sys import stdin
A = [int(x) for x in stdin.readline().rstrip().split()]

print(max(A)-min(A))
N = int(input())
job = [[0] * N for _ in range(N)]
for i in range(N):
    job[i] = list(map(int, input().split()))

job.sort(key = lambda x: x[1])
#print(job)
for i in range(1, N):
    job[i][0] += job[i - 1][0]
for i in range(N):
    if job[i][0] > job[i][1]:
        print("No")
        break
else:
    print("Yes")

### FIXED CODE ###


N = int(input())
job = []
for i in range(N):
    a, b = map(int, input().split())
    job.append([a, b])
#print(job)
job.sort(key=lambda x: x[1])
#print(job)
for i in range(1, N):
    job[i][0] += job[i - 1][0]
for i in range(N):
    if job[i][0] > job[i][1]:
        print("No")
        break
else:
    print("Yes")
import numpy as np
h,w,m = map(int,input().split())
bomb = list(tuple(map(lambda x: int(x)-1,input().split())) for i in range(m))
Map= np.zeros((h,w))
for i in bomb:
    Map[i] = 1
bombx = np.count_nonzero(Map,axis=1)
bomby = np.count_nonzero(Map,axis=0)
maxx = max(bombx)
maxy = max(bomby)
maxx_index = list(i for i in range(h) if bombx[i] == maxx)
maxy_index = list(i for i in range(w) if bomby[i] == maxy)
flag = 0
for i in maxx_index:
    for j in maxy_index:
        if (i,j) not in bomb:
            print(maxx+maxy)
            exit()
print(maxx+maxy-1)


### FIXED CODE ###

h,w,m = map(int,input().split())
bombX = [0]*h
bombY = [0]*w
bomb = set()
maxX = maxY = 0
for i in range(m):
    i,j = map(lambda x:int(x)-1, input().split())
    bomb.add((i,j))
    bombX[i] += 1
    bombY[j] += 1
    maxX = max(maxX,bombX[i])
    maxY = max(maxY,bombY[j])
maxX_index = list(i for i in range(h) if bombX[i] == maxX)
maxY_index = list(i for i in range(w) if bombY[i] == maxY)
for i in maxX_index:
    for j in maxY_index:
        if (i,j) in bomb: continue
        print(maxX+maxY)
        exit()
print(maxX+maxY-1)
s=input() ; n=len(s)
for i in range(10000):
    s=s.replace("ST","")
    if a==s:
      print(len(s));exit()
    a=s
print(len(s))


### FIXED CODE ###

s=input() ; n=len(s)
ss=n//2; tt=n//2
ans=0
for i in range(n):
    if s[i]=="S":
        ans=max(ans, ss-tt)
        ss-=1
    else:
        tt-=1
print(ans*2)
import numpy as np
from collections import Counter
import collections
round = lambda x:(x*2+1)//2
a = list(map(float,input().split()))
a = np.array(a)
X = a[0]
Y = a[1]
i = 0
while(X=<Y):
  X * = 2
  i++
print(i)

### FIXED CODE ###

import math
x,y=map(int,input().split())
i=0
while(x<=y):
  x*=2
  i+=1
print(i)
n = list(map(int, input().split()))
if n[0] !== n[1]:
    print("Yes")
    exit(0)
if n[0] !== n[2]:
    print("Yes")
    exit(0)
print("No")

### FIXED CODE ###

n = list(map(int, input().split()))
if n[0] != n[1]:
    if n[1] == n[2]:
        print("Yes")
        exit()
    if n[0] == n[2]:
        print("Yes")
        exit()
    if n[0] != n[2]:
        print("No")
        exit()
if n[0] == n[1]:
    if n[0] != n[2]:
        print("Yes")
        exit()
print("No")
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N, *A = map(int, open(0))
    A.sort()
    ans = 0
    if N % 2 == 1:
        ans += sum(A[N//2:])*2 - sum(A[:N//2])*2
        ans -= A[N//2]+A[N//2+1]
    else:
        ans += sum(A[N//2:])*2 - sum(A[:N//2])*2
        ans -= A[N//2]-A[N//2-1]
    

    ans2 = 0
    if N % 2 == 1:
        ans2 += sum(A[N//2+1:])*2 - sum(A[:N//2+1])*2
        ans2 += A[N//2]+A[N//2-1]
    else:
        ans2 += sum(A[N//2+1:])*2 - sum(A[:N//2+1])*2
        ans2 += A[N//2]-A[N//2+1]

    print(max(ans,ans2))

if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N, *A = map(int, open(0))
    A.sort()
    ans = 0
    if N % 2 == 1:
        ans += sum(A[N//2:])*2 - sum(A[:N//2])*2
        ans -= A[N//2]+A[N//2+1]
    else:
        ans += sum(A[N//2:])*2 - sum(A[:N//2])*2
        ans -= A[N//2]-A[N//2-1]
    

    ans2 = 0
    if N % 2 == 1:
        ans2 += sum(A[N//2+1:])*2 - sum(A[:N//2+1])*2
        ans2 += A[N//2]+A[N//2-1]
    else:
        ans2 += sum(A[N//2:])*2 - sum(A[:N//2])*2
        ans2 += A[N//2-1]-A[N//2]

    print(max(ans,ans2))

if __name__ == "__main__":
    main()
import numpy as np
# points = np.array([0, 1, 2, 3, 4])
points = np.array([input() for _ in range(5)])
thr = input()
diff = max(points[1:] - points[:4])
if diff <= thr:
    print('Yay!')
else:
    print(':(')

### FIXED CODE ###

import numpy as np
# points = np.array([0, 1, 2, 3, 4])
points = np.array([int(input()) for _ in range(5)])
thr = int(input())
diff = (points[4] - points[0])
if diff <= thr:
    print('Yay!')
else:
    print(':(')