Harryxun/stf_run huggingface dataset:
#ABC119 D - Lazy Faith
from bisect import bisect_left,bisect_right
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a,b,q = map(int, input().split())
INF = 10**11
S = [-INF]+[int(input()) for _ in range(a)]+[INF]
T = [-INF]+[int(input()) for _ in range(b)]+[INF]
X = [int(input()) for _ in range(q)]

for i in range(q):
    idx_s = bisect_left(S,X[i])
    idx_t = bisect_left(T,X[i])
    ans = INF
    for s in [S[idx_s-1],S[idx_s]]:
        for t in [T[idx_s-1],T[idx_s]]:
            d1,d2 = abs(s-X[i])+abs(s-t),abs(t-X[i])+abs(t-s)
            ans = min(ans,d1,d2)
    print(ans)


### FIXED CODE ###

#ABC119 D - Lazy Faith
from bisect import bisect_left,bisect_right
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a,b,q = map(int, input().split())
INF = 10**11
S = [-INF]+[int(input()) for _ in range(a)]+[INF]
T = [-INF]+[int(input()) for _ in range(b)]+[INF]
X = [int(input()) for _ in range(q)]

for i in range(q):
    idx_s = bisect_right(S,X[i])
    idx_t = bisect_right(T,X[i])
    ans = INF
    for s in [S[idx_s-1],S[idx_s]]:
        for t in [T[idx_t-1],T[idx_t]]:
            d1,d2 = abs(s-X[i])+abs(s-t),abs(t-X[i])+abs(t-s)
            ans = min(ans,d1,d2)
    print(ans)
a,b=map(int,input().sprit())
if a<=b:print('unsafe')
else:print('safe')

### FIXED CODE ###

a,b=map(int,input().split())
if a<=b: print('unsafe')
else: print('safe')
import math
a, b, c, d = map(int, input().split())
ac = a * c
ad = a * d
bc = b * c
bd = b * d
ans_1 = math.max(ac,ad)
ans_2 = math.max(bc, bd)
ans = math.max(ans1_, ans2)
print(ans)

### FIXED CODE ###

a, b, c, d = map(int, input().split())
ac = a * c
ad = a * d
bc = b * c
bd = b * d
ans_1 = max(ac,ad)
ans_2 = max(bc, bd)
ans = max(ans_1, ans_2)
print(ans)
n,*h=map(int,open(0).read().split())
dp=[0]*(n+1)
dp[0]=h[0]
for i in range(n):
  dp[i+1]=min(dp[i+1],dp[i]+abs(h[i+1]-h[i]))
  dp[i+2]=min(dp[i+2],dp[i]+abs(h[i+2]-h[i]))
print(dp[n-1])

### FIXED CODE ###

n,*h=map(int,open(0).read().split())
dp=[10**18]*(n+1)
dp[0]=0
h=h+[0]
for i in range(n-1):
  dp[i+1]=min(dp[i+1],dp[i]+abs(h[i+1]-h[i]))
  dp[i+2]=min(dp[i+2],dp[i]+abs(h[i+2]-h[i]))
print(dp[n-1])
s=input()
print("No" if s=="AAA" or s="BBB" else "Yes")

### FIXED CODE ###

s=input()
print("No" if s=="AAA" or s=="BBB" else "Yes")
n, m = list(map(int, input().split()))
root_list = []
for _ in range(m):
    root_list.append(list(map(int, input().split())))

answer_list = [0] * (n-1)
done_list = [1]
already_list = [1]
while len(root_list) > 0 and 0 in answer_list:
    tmp_list = []
    copy_root_list = root_list.copy()
    for num in done_list:
        for l in root_list:
            if l[1] == num:
                if answer_list[int(l[0]-2)] == 0:
                    answer_list[int(l[0]-2)] = num
                    tmp_list.append(l[0])
                    already_list.append(l[1])
                    copy_root_list.remove(l)
                else:
                    copy_root_list.remove(l)
            elif  l[0] == num:
                if answer_list[int(l[1]-2)] == 0:
                    answer_list[int(l[1]-2)] = num
                    tmp_list.append(l[1])
                    already_list.append(l[1])
                    if l in copy_root_list:
                        copy_root_list.remove(l)
                else:
                    if l in copy_root_list:
                        copy_root_list.remove(l)
    copy_root_list = [i for i in copy_root_list if (i[0] not in already_list or i[1] not in already_list)]
    root_list = copy_root_list
    done_list = tmp_list

if 0 not in answer_list:
    print("Yes")
    for i in answer_list:
        print(int(i))
else:
    print("No")
    

### FIXED CODE ###

from collections import deque

n, m = list(map(int, input().split()))
root_dict = {}

for _ in range(m):
    a, b = list(map(int, input().split()))
    if a not in root_dict:
        root_dict[a] = deque([b])
    else:
        root_dict[a].append(b)
    if b not in root_dict:
        root_dict[b] = deque([a])
    else:
        root_dict[b].append(a)

visited = [1] + [-1] * (n-1)

done = deque([1])

while done:
    x = done.popleft()
    while root_dict[x]:
        i = root_dict[x].popleft()
        if visited[i-1] < 0:
            visited[i-1] = x
            done.append(i)

if -1 in visited:
    print("No")
else:
    print("Yes")
    for i in range(1, n):
        print(visited[i])
n, k, s = map(int, input().split())
if s != 10**9:
  if s % 2 == 0:
    a = [s//2]*(k+1)+[10**9]*(n-k-1)
  if s % 2 == 1:
    if k % 2 == 0:
      a = [s//2, s//2 + 1]*(k//2) +[s//2] +[10**9]*(n-k-1)
    else:
      a = [s//2, s//2 + 1]*(k//2+1) + [10**9]*(n-k-1)
else:
  if k % 2 == 0:
    a =[10**9,1]*k//2:
  else:
    a =[10**9,1]*k//2 + [10**9]
print(*a)

### FIXED CODE ###

n, k, s = map(int, input().split())

if s < 10**9:

  if k > 0: 
      aa = [s]*k + [s+1]*(n-k)
  elif k == 0:
      aa = [s+1]*n

else:
  aa =[s]*k + [1]*(n-k)

print(*aa)
# B
from collections import deque
# input
N, M = map(int, input().split())
G = dict()
for n in range(1, N+1):
    G[n] = []

for _ in range(M):
    A, B = map(int, input().split())
    G[A].append(B)
    G[B].append(A)
    
# find minimum degree
s = np.argmin(np.array([len(G[k]) for k in range(1, N+1)])) + 1

targets = dict()
for a in G[s]:
    targets[a] = 1


# BFS
t = G[s][0]
pt = [s, t]
del targets[t]
while len(targets) > 0:
    ques = deque()
    visited = [0]*(N+1)    
    for a in pt:
        visited[a] = 1
    ques.append([t, pt])
    end = 0
    while len(ques) > 0 and end == 0:
        q = ques.popleft()
        s = q[0]
        pt = q[1]
        for t in G[s]:
            if visited[t] == 1:
                pass
            elif t in targets.keys():
                pt.append(t)
                end = 1
                del targets[t]
                break
            else:
                visited[t] = 1
                ques.append([t, pt+[t]])
            
print(len(pt))
print(" ".join([str(a) for a in pt]))

### FIXED CODE ###

# B
import numpy as np
from collections import deque
# input
N, M = map(int, input().split())
G = dict()
for n in range(1, N+1):
    G[n] = []
    
visited = [0]*(N+1)
for m in range(M):
    A, B = map(int, input().split())
    G[A].append(B)
    G[B].append(A)
    if m == 0:
        pt = [A, B]
        visited[A] = 1
        visited[B] = 1

# from left
s = pt[0]
add_left = list()

while True:
    left_ext = [l for l in G[s] if visited[l] == 0]
    if len(left_ext) != 0:
        s = left_ext[0]
        visited[s] = 1
        add_left.append(s)
    else:
        break

# from right
s = pt[1]
add_right = list()

while True:
    right_ext = [l for l in G[s] if visited[l] == 0]
    if len(right_ext) != 0:
        s = right_ext[0]
        visited[s] = 1
        add_right.append(s)
    else:
        break
pt = list(reversed(add_left)) + pt + add_right
print(len(pt))
print(" ".join([str(a) for a in pt]))
import math
s = input().strip()
A = []
B = [0 for _ in range(len(s)+1)]
y = ""
for i in range(len(s)):
    if s[i]!="x":
        y += s[i]
        A.append(i)
        B[i+1] = B[i]
    else:
        B[i+1] = B[i]+1
flag=0
cnt = 0
for i in range(len(y)//2):
    if y[i]!=y[-(i+1)]:
        flag=1
        cnt = -1
        break
if flag==0:
    if B[A[0]]!=B[-1]-B[A[-1]]:
        cnt += abs(B[A[0]]-(B[-1]-B[A[-1]]))
    for i in range(1,math.ceil(len(A)/2)):
        if B[A[i]]-B[A[i-1]] != B[A[-i]]-B[A[-(i+1)]]:
            cnt += abs(B[A[i]]-B[A[i-1]]-(B[A[-i]]-B[A[-(i+1)]]))
print(cnt)

### FIXED CODE ###

import math
s = input().strip()
A = []
B = [0 for _ in range(len(s)+1)]
y = ""
for i in range(len(s)):
    if s[i]!="x":
        y += s[i]
        A.append(i)
        B[i+1] = B[i]
    else:
        B[i+1] = B[i]+1
flag=0
cnt = 0
for i in range(len(y)//2):
    if y[i]!=y[-(i+1)]:
        flag = 1
        cnt = -1
        break
if flag==0 and len(y)>0:
    if B[A[0]]!=B[-1]-B[A[-1]]:
        cnt += abs(B[A[0]]-(B[-1]-B[A[-1]]))
    for i in range(1,math.ceil(len(A)/2)):
        if B[A[i]]-B[A[i-1]] != B[A[-i]]-B[A[-(i+1)]]:
            cnt += abs(B[A[i]]-B[A[i-1]]-(B[A[-i]]-B[A[-(i+1)]]))
print(cnt)
N = int(input())
l = list()
al = list()
bl = list()
 
for n in range(0,N):
    a = input()
　 l.append(a)
    al.append(a[1])
    bl.append(a[-1])
 
l_unq = list(set(l))
if len(l) == len(l_unq):
    for i in range(0,N-1):
        if al[i+1] != bl[i]:
          print("No")
          break
     print("Yes")
else:
    print("No")


### FIXED CODE ###

N = int(input())
l = list()

for n in range(N):
    a = input()
    l.append(a)

l_uniq = list(set(l))

if len(l) == len(l_uniq):
    for i in range(0, N-1):
        if l[i+1][0] != l[i][-1]:
            print("No")
            break
    else:
        print("Yes")
else:
    print("No")
import sys

N = int(input())
A = [int(a) for a in input().split()]

C_sum = [0]
s = {0}

for a in A:
    C_sum.append(C_sum[-1]^a)
    s.add(C_sum[-1])

if C_sum[-1] != 0:
    print(1)
else:
    dic_state = {}
    dic = {}
    for x in s:
        dic_state[x] = 0
        dic[x] = [0]
    for c in C_sum:
        if c==0:
            for d in dic:
                if dic_state[d] == 0:
                    dic[d][-1] += 1
                else:
                    dic[d].append(1)
                    dic_state[d] = 0
        else:
            if dic_state[c] == c:
                dic[c][-1] += 1
            else:
                dic[c].append(1)
                dic_state[c] = c

    ans = pow(2,dic[0][0]-2,10**9+7)

    for d in dic:
        tmp_0 = 1
        tmp_x = 0

        for i in range(1,len(dic[d])):
            if i%2==1:
                tmp_x += tmp_0 * dic[d][i]
                tmp_x %= 10**9+7
            else:
                tmp_0 += tmp_x * dic[d][i]
                tmp_0 %= 10**9+7

        ans += tmp_x
        ans %= 10**9+7

    print(ans)


### FIXED CODE ###

N,K = map(int,input().split())
print(N+1-K)
import math

def hensa(n, S):
 m = sum(S)/n
 x = 0
 for i in S:
  x += (i - m) ** 2
 hensa = math.sqrt(x / n)
 return hensa

n = 1
while n != 0:
 n = int(input())
 S = list(map(int, input().split()))
 print("{0:04f}".format(hensa(n, S)))

### FIXED CODE ###

import math

def hensa(n, S):
 m = sum(S)/n
 x = 0
 for i in S:
  x += (i - m) ** 2
 hensa = math.sqrt(x / n)
 return hensa

n = int(input())
while n != 0:
 S = list(map(int, input().split()))
 print("{0:04f}".format(hensa(n, S)))
 n = int(input())
??????????????????

### FIXED CODE ###

s = int(input())
h = int(s / (60 * 60))
m = int(s / 60) % 60
s = s % 60

print('{}:{}:{}'.format(h,m,s))
import math
while 1:
    try:
        d=int(input())
        if d>math.sqrt(72000000):
            print(0)
        else:
            S=0
            x=d
            y=x**2
            S=d*y
            while S<=72000000:
                de=72000000-S
                x+=d
                y=x**2
                S+=d*y
            if de<(S-72000000):
                print(72000000-de)
            else:
                print(S)
    except EOFError:
        break

### FIXED CODE ###

import math
while 1:
    try:
        d=int(input())
        time=600//d
        S=0
        for i in range(time):
            x=i*d
            y=x**2
            S+=y*d
        print(S)
    except EOFError:
        break
import bisect
from collections import defaultdict
N = int(input())
S = input()
Q = int(input())

dict = defaultdict(list)
for i in range(N):
    dict[S[i]].append(i)
# print(dict)

ans = []

for _ in range(Q):
    a, b, c = input().split()
    a = int(a)
    if a == 1:
        b = int(b) - 1
        dict[S[b]].remove(b)
        idx = bisect.bisect_left(dict[c], b)
        dict[c].insert(idx, b)

    elif a == 2:
        b = int(b) - 1
        c = int(c) - 1
        char_n = 0
        for key, value in dict.items():
            if len(value) > 0:
                x1 = bisect.bisect_left(value, b)
                x2 = bisect.bisect_right(value, c)
                if x2 - x1 > 0:
                    char_n += 1
        ans.append(char_n)

for i in ans:
    print(i)


### FIXED CODE ###

# test!!!!!!!!!!!

from bisect import bisect_left, bisect_right

N = int(input())

S = list(input())

Q = int(input())

memo = {chr(ord('a') + i): [] for i in range(26)}

for key,val in enumerate(S):
    memo[val].append(key)

for q in range(Q):
    query = list(input().split())
    if query[0] == '1':
        i, x = int(query[1])-1, query[2]
        now = S[i]
        if now == x:
            continue
        memo[now].remove(i)
        next_i = bisect_left(memo[x], i)
        memo[x].insert(next_i, i)
        S[i] = x
    else:
        start, end = int(query[1])-1, int(query[2])-1
        tmp_cout = 0
        for alf_array in memo.values():
            if len(alf_array) == 0:
                continue
            ss = bisect_left(alf_array, start)
            gg = bisect_right(alf_array, end)
            if gg- ss > 0:
                tmp_cout += 1
        print(tmp_cout)
a = list(map(,int, input().split()))
n = len(a)
print((n * (n+1) // 2) - sum(a))

### FIXED CODE ###

a = list(map(int, input().split()))
n = len(a)
print((n * (n+1) // 2) - sum(a))
# C - Typical Stairs

MOD = (10 ** 9) + 7
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
dp = [None] * (N + 1)

def f(i):
    if dp[i] != None:
        return dp[i]
    else:
        if i in A:
            dp[i] = 0
        elif i < 2:
            dp[i] = 1
        else:
            dp[i] = (f(i - 1) + f(i - 2)) % MOD
        return dp[i]

f(N)
print(dp[N])


### FIXED CODE ###

# C - Typical Stairs

MOD = (10 ** 9) + 7
N, M = map(int, input().split())
A = [False] * (N + 1)
for _ in range(M):
    A[int(input())] = True
dp = [0] * (N + 1)
dp[0] = 1
if A[1] == False:
    dp[1] = 1

for i in range(2, N + 1):
    if A[i] == True:
        dp[i] = 0
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % MOD

print(dp[N])
a,b,c=map(int,input().split())
x=max(a,b,c)
print(x*10+sum(a,b,c)-x)

### FIXED CODE ###

a,b,c=map(int,input().split())
x=max(a,b,c)
print(x*10+a+b+c-x)
x = input()
print(x*x*x)


### FIXED CODE ###

x = int(input())
print(x**3)
import math

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

def combinations_count(a, b):
    return math.factorial(a)//(math.factorial(a-b)*math.factorial(b))

for i in range(1,k+1):
    #青のグループ分けの組合せ
    b_num = combinations_count(k-1,i-1)
    #赤を並べて，そこに青のぶるーぷを置く組合せ
    a_num = combinations_count(n-k+1,i)
    #出力
    print((b_num*a_num)%(10**9+7))

### FIXED CODE ###

import math

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

def combinations_count(a, b):
    return math.factorial(a)//(math.factorial(a-b)*math.factorial(b))


blue = k
#両端を除いた隙間の数
blue_sp = k-1
red = n-k
#両端を含む隙間の数
red_sp = red+1


#青をグループに分けて，赤の隙間に入れる組合せを考える
#1から
for i in range(1,blue+1):
    #print(blue_sp,i-1,":",red_sp,i)        

    #出力
    #青のグループ数が赤の隙間より多い場合
    if i > red_sp:
        print(0)
    else:       
        #青のグループ分けの組合せ(両端を除いた隙間，選択する数)
        b_num = combinations_count(blue_sp,i-1)
        #赤を並べて，そこに青のグループを置く組合せ
        a_num = combinations_count(red_sp,i)
        print((b_num*a_num)%(10**9+7))
n=int(input())
s=''
while n!=0:
  s=str(n%2)+s
  n=-(n//2)
print(s*(if s)else 0)

### FIXED CODE ###

n=int(input())
s=''
while n!=0:
  s=str(n%2)+s
  n=-(n//2)
print(s*(s!='')or 0)
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    mod = 1000000007

    N = int(input())
    d = input().rstrip()
    input()
    domino = []
    i = 0
    #横０縦1
    while 1:
        if d[i]==d[i+1]:
            domino.append(0)
            i += 2
        else:
            domino.append(1)
            i += 1
        if i==len(d)-1:
            break
    domino.append(1)
    if domino[0]:
        res = 3
    else:
        res = 6
    for i in range(1, len(domino)):
        if domino[i-1]:
            res *= 2
        else:
            if not domino[i]:
                res *= 3
    print(res%mod)
            

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    mod = 1000000007

    N = int(input())
    d = input().rstrip()
    input()
    domino = []
    i = 0
    #横０縦1
    if len(d)==1:
        print(3)
        exit()
    if len(d)==2:
        print(6)
        exit()
    while 1:
        if d[i]==d[i+1]:
            domino.append(0)
            i += 2
        else:
            domino.append(1)
            i += 1
        if i==len(d)-1:
            domino.append(1)
            break
        if i==len(d):
            break
    if domino[0]:
        res = 3
    else:
        res = 6
    for i in range(1, len(domino)):
        if domino[i-1]:
            res *= 2
        else:
            if not domino[i]:
                res *= 3
    print(res%mod)
            

if __name__ == '__main__':
    main()
A,B,N = map(int,input().split())
tmp=0
for i in range(N//2,N+1):
    floor = (A*i)//B-A*(i//B)
    if floor>tmp:
        tmp = floor
print(tmp)

### FIXED CODE ###

K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        break
    elif i%K!=0 and i==B:
        print("NG")
n = int(input())
p = int(input())
if n <= 8 and p<= 8:
  print('Yay!')
else:
  print(':(')

### FIXED CODE ###

a, b = map(int, input().split())
if a<=8 and b<=8:
  print("Yay!")
else:
  print(":(")
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
print("U"*y+"R"*x+"D"*y+"L"*(x+1)+"U"*(y+1)+"R"*(x+1)+"DR"+"D"*(y+1)+"L"*(x+1)+"U"

### FIXED CODE ###

sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
print("U"*y+"R"*x+"D"*y+"L"*(x+1)+"U"*(y+1)+"R"*(x+1)+"DR"+"D"*(y+1)+"L"*(x+1)+"U")
import math

r = int(input())
print("%f %f" % (r*r*math.pi,2*r*math.pi))

### FIXED CODE ###

import math

r = float(input())
print("%f %f" % (r*r*math.pi,2*r*math.pi))
from statistics import mean, median,variance,stdev
import sys
import math

#a = input().split()
#y = input().split()

x = int(input())
y = int(input())

x=-1
y=-1

print(x*y)


### FIXED CODE ###

from statistics import mean, median,variance,stdev
import sys
import math

a = input().split()
#y = input().split()

x = int(a[0])
y = int(a[1])
x-=1
y-=1
print(x*y)
def main():
    MOD = 10 ** 9 + 7
    n, k = map(int, input().split())
    *a, = map(int, input().split())

    compress = {x: i for i, x in enumerate(sorted(set(a)), 1)}
    rev = {i: x for x, i in compress.items()}

    e = [compress[x] for x in a]

    # -+-+-+-prepare combination-+-+-+-
    # -+-+-+-START-+-+-+-
    fact = [1] * (n + 1)
    for x in range(2, n + 1):
        fact[x] = x * fact[x - 1] % MOD

    invs = [1] * (n + 1)
    invs[n] = pow(fact[n], MOD - 2, MOD)
    for x in range(n - 1, 0, -1):
        invs[x] = invs[x + 1] * (x + 1) % MOD

    def cmb(n, r):
        if n < r:
            return 0
        return (((invs[r] * invs[n - r]) % MOD) * fact[n]) % MOD

    # -+-+-+-END-+-+-+-

    def add(k, x):
        while k <= n:
            b[k] += x
            k += k & -k

    def get(k):
        s = 0
        while k:
            s += b[k]
            k -= k & -k
        return s

    ret = 0
    b = [0] * (n + 10)

    cnt = [0] * (n + 10)
    for a_ in a:
        e_ = compress[a_]
        add(e_, 1)
        cnt[a_] += 1

    for e_ in e:
        a_ = rev[e_]
        c = cnt[a_]

        smaller_eq = get(e_)
        ser = n - smaller_eq

        cnt_s = 0
        for x in range(1, min(k, c) + 1):
            cnt_s = (cnt_s + cmb(ser, k - x) * cmb(c, x)) % MOD

        larger_eq = n - get(e_ - 1)
        ler = n - larger_eq

        cnt_l = 0
        for x in range(1, min(k, c) + 1):
            cnt_l = (cnt_l + cmb(ler, k - x) * cmb(c, x)) % MOD

        ret = (ret + (cnt_l - cnt_s) * a_) % MOD

    print(ret % MOD)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()

# int(input())
# map(int, input().split())


### FIXED CODE ###

MOD = 10 ** 9 + 7

n, k = map(int, input().split())
*a, = sorted(map(int, input().split()))

# -+-+-+-prepare combination-+-+-+-
# -+-+-+-START-+-+-+-
fact = [1] * (n + 1)
for x in range(2, n + 1):
    fact[x] = x * fact[x - 1] % MOD

invs = [1] * (n + 1)
invs[n] = pow(fact[n], MOD - 2, MOD)
for x in range(n - 1, 0, -1):
    invs[x] = invs[x + 1] * (x + 1) % MOD


def cmb(n, r):
    if n < r:
        return 0
    return (((invs[r] * invs[n - r]) % MOD) * fact[n]) % MOD


# -+-+-+-END-+-+-+-

ret = 0
for lt, x in enumerate(a):
    gt = n - lt - 1
    mi = cmb(gt, k - 1)
    ma = cmb(lt, k - 1)
    ret = (ret + (ma - mi) * x) % MOD

print(ret)
N, K = map(int, input().split())
Sunuke = [0]*N
d = list()
A = list()
for _ in range(K):
  d = int(input()
  A = list(map(int, input().split()))
  for a in A:
    Sunuke[a-1] += 1

ans = 0
for s in Sunuke:
  if s == 0:
     ans += 1
print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
people = [1]*N
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(d):
        if people[A[j] - 1] == 1:
            people[A[j] - 1] = 0

print(sum(people))
a = list(map(int,input()))
print(max(a)-min(a))

### FIXED CODE ###

a = list(map(int,input().split()))
print(max(a)-min(a))
number = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(number):
    for j in range(number):
        if a[i] ==j+1 and a[j] == i+1:
            count += 1
print(int(count/2)

### FIXED CODE ###

number = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(number):
    j = a[i]-1
    if a[j] == i + 1:
        count += 1
print(int(count/2))
a = list(map(int, input().split()))
d = max(a)
a.remove(d)
ans(d*10+sum(a))

### FIXED CODE ###

a = list(map(int, input().split()))
d = max(a)
a.remove(d)
print(d*10+sum(a))
N=int(input())
his=input().split()
DP=[]
DP.append(0)
DP.append(his[0]-his[1])
for i in range(2,len(his)):
  DP.append(max(DP[i-1]-his[i],DP[i-2])
print(DP[-1]

### FIXED CODE ###

N=int(input())
his=list(map(int,input().split()))
DP=[]
DP.append(0)
DP.append(abs(his[0]-his[1]))
for i in range(2,N):
  DP.append(min(DP[i-1]+abs(his[i-1]-his[i]),DP[i-2]+abs(his[i-2]-his[i])))
print(DP[-1])
l = [int(input()) for i in range(5)]
l_0 = [a%10 for a in l]
ar = []
for n in l_0:
  if n != 0:
    ar.append(10-n)
  else:
    ar.append(0)
s = l_0.index(max(l_0))
l.pop(s)
l_0.pop(s)
ans = sum(l) + sum(l_0) + l[s]
print(ans)

### FIXED CODE ###

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