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

N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)

start = -1
end = A[-1] * F[0]

def check(now):
    cnt = 0
    for i in range(N):
        if A[i] * F[i] > now:
            cnt += (A[i]*F[i] - now + F[i] - 1) // F[i]
    if cnt > K:
        return False
    return True

while end > start + 1:
    now = (start + end) // 2
    if check(now):
        end = now
    else:
        start = now

print(end)


### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)

q = [0] * N
start = 0
end = 0
for i in range(N):
    q[i] = A[i] * F[i]
    end = max(end, q[i])

def check(now, K):
    cnt = 0
    for i in range(N):
        if q[i] - now > 0:
            cnt += (q[i] - now + F[i] - 1) // F[i]
            if cnt > K:
                return False
    return True

now = end // 2
while end > start + 1:
    if check(now, K):
        end = now
    else:
        start = now
    now = (start + end) // 2

if check(start, K):
    print(start)
else:
    print(end)
### BUGGY CODE ###

import sys
input=sys.stdin.buffer.readline
inputs=sys.stdin.buffer.readlines
sys.setrecursionlimit(10**9)
n,m=map(int,input().split())
edges=[[] for i in range(3+3*n)]
for i in range(m):
    """#weighted->erase_,__,___=map(int,input().split())
    edges[_].append((__,___))
    #undirected->erase#edges[__].append((_,___))
    """
    _,__=map(int,input().split())
    _*=3;__*=3
    edges[_].append(__+1)
    edges[_+1].append(__+2)
    edges[_+2].append(__)

    #undirected->erase#edges[__].append(_)
    """
"""#weighted->erase

s,T=map(int,input().split())
from collections import deque
dq=deque([])
dq.append((3*s,0))
T*=3
seen=set()
seen.add(3*s)
while dq:
    now,c=dq.popleft()
    if now==T :print(c//3);exit()
    for t in edges[now]:
        if t not in seen:
            dq.append((t,c+1))
            seen.add(now)

print("-1")


### FIXED CODE ###

import sys
input=sys.stdin.buffer.readline
inputs=sys.stdin.buffer.readlines
sys.setrecursionlimit(10**9)
n,m=map(int,input().split())
edges=[[] for i in range(3+3*n)]
o=inputs()
s,T=map(int,o.pop().split())
for i in o:
    _,__=map(int,i.split())
    _*=3;__*=3
    edges[_].append(__+1)
    edges[_+1].append(__+2)
    edges[_+2].append(__)

from collections import deque
dq=deque([])
dq.append((3*s,0))
T*=3
seen=[0]*(3*n+3)
seen[3*s]=1
while dq:
    now,c=dq.popleft()
    if now==T :print(c//3);exit()
    for t in edges[now]:
        if seen[t]==0:
            dq.append((t,c+1))
            seen[t]=1
print("-1")
### BUGGY CODE ###

import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
K = int(input())
list_A=[]
for i in range(K):
    for j in range(K):
        for k in range(K):
            list_A.append(gcd(i+1,j+1,k+1))
print(sum(list_A))

### FIXED CODE ###

import math


K = int(input())
S=0
for i in range(1,K+1):
    for j in range(1,K+1):
        s=math.gcd(i,j)
        for k in range(1,K+1):
            S += math.gcd(s,k)

print(S)
### BUGGY CODE ###

n = int(input())
s = input()

r = []
g = []
b = []
counter = 0

for x in range(n):
  if s[x] == 'R':
    r.append(x)
  elif s[x] == 'G':
    g.append(x)
  else:
    b.append(x)
    
for i in range(len(r)):
  for j in range(len(g)):
    for k in range(len(b)):
      if r[i]-g[j] != g[j]-b[k] and g[j]-b[k] != b[k]-r[i] and b[k]-r[i] != r[i]-g[j]:
        counter += 1
print(counter)


### FIXED CODE ###

n = int(input())
s = input()

r = s.count('R')
g = s.count('G')
b = s.count('B')
counter = 0

for i in range(n-2):
  for j in range(i+1, n-1):
    k = 2*j - i
    if k > n-1:
      break
    if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
      counter += 1
      
print(r*g*b - counter)
### BUGGY CODE ###

N,M=map(int,input().split())
Islands=[[] for i in range(N)]
Edge=[]
S=0
for i in range(M):
  a,b,c=map(int,input().split())
  Islands[a-1].append([b-1,c])
  Islands[b-1].append([a-1,c])
  Edge.append([a-1,b-1,c])
for m in range(M):
  a=Edge[m][0]
  b=Edge[m][1]
  c_m=Edge[m][2]
  List=[[a,0]]
  for l in List:
    c_base=l[-1]
    c=c_base
    if l[-2]==b:
      if c_m>c:
        S+=1
        break
    else:        
      for n in Islands[l[-2]]:
        if n[0] in l[0:-1]:
          pass
        else:
          c+=n[1]
          List.append(l[0:-1]+[n[0],c])  
          c=c_base
print(S)      

### FIXED CODE ###

N,M=map(int,input().split())
Islands=[[10**9]*N for i in range(N)]
Edge=[]
S=0
for i in range(M):
  a,b,c=map(int,input().split())
  Islands[a-1][b-1]=c
  Islands[b-1][a-1]=c
  Edge.append([a-1,b-1,c])
for k in range(N):
  for i in range(N):
    for j in range(N):
      Islands[i][j]=min(Islands[i][j],Islands[i][k]+Islands[k][j])

ans=0
for a,b,c in Edge:
  if Islands[a][b]!=c:
    ans+=1
print(ans)
### BUGGY CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
s = 1
ans=[]
for i in range(k):
    s *= a[i]
ans.append(s)
for i in range(k, n):
    s = s * a[i] // a[i - k]
    ans.append(s)
    if ans[i - k] < ans[i - k + 1]:
        print("Yes")
    else:
        print("No")
    # print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(k, n):
    if a[i - k] < a[i]:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

s = [i for i in input()]
q = int(input())

for i in range(q):
    x = input().split()
    
    if(x[0] == '1'):
        s = s[::-1]
    else:
        s.insert(0,x[2]) if(x[1]=='1') else s.append(x[2])


print(''.join(s))

### FIXED CODE ###

from collections import deque

revFlag = False

s = deque(input())
q = int(input())

for i in range(q):
    a,b,c, *_ = input().split() + [None, None]
    
    if(a == '1'):
        revFlag = not revFlag
        
    else:
        b = int(b)
        if(revFlag):
            b = (int(b)%2)+1
        
        if(b == 1):
            s.appendleft(c)
        else:
            s.append(c)
            
    #print(_,*s, sep="")

if(revFlag):
    s.reverse()
    
print(*s, sep='')
### BUGGY CODE ###

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

S = list(map(int,input().split()))
T = list(map(int,input().split()))

# 累積和参照のために0の行，列を追加
sm = [[0] * (M+1) for _ in range(N+1)]

for i in range(1,N+1) :
    for j in range(1,M+1) :
        new = sm[i-1][j] + sm[i][j-1]
        if S[i-1] == T[j-1] :
            new += 1  # dp = sm[i-1][j-1] + 1
        else :
            new -= sm[i-1][j-1] # dp = 0
        sm[i][j] = new

ans = (sm[-1][-1] + 1) % (10**9 + 7)

print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
MOD = 10**9 + 7

dp = [[0] * (M + 1) for _ in range(N + 1)]  # dp[s][t]

for i, s in enumerate(S, start=1):
    for j, t in enumerate(T, start=1):
        v = dp[i - 1][j] + dp[i][j - 1]
        if s == t:
            v += 1
        else:
            v -= dp[i - 1][j - 1]
        dp[i][j] = v % MOD

print((dp[-1][-1] + 1) % MOD)
### BUGGY CODE ###

n=int(input())
s=input()
r = [0]*n
g = [0]*n
b = [0]*n
ans = 0

for i in range(n):
    s1 = s[i]
    if s1 == "R":
        r[i] = 1
    elif s1 == "G":
        g[i] = 1
    else:
        b[i] = 1

for i in range(n):
    for j in range(i,n):
        s1 = s[i]
        s2 = s[j]
        t = (s1,s2)
        if s1 != s2:
            if "R" not in t:
                if 2*j-i < n:
                    ans += sum(r[j+1:]) - r[2*j-i]
                else:
                    ans += sum(r[j+1:])
            elif "G" not in t:
                if 2*j-i < n:
                    ans += sum(g[j+1:]) - g[2*j-i]
                else:
                    ans += sum(g[j+1:])
            else:
                if 2*j-i < n:
                    ans += sum(b[j+1:]) - b[2*j-i]
                else:
                    ans += sum(b[j+1:])

print(ans)


### FIXED CODE ###

def main():
    n=int(input())
    s=input()
    ans = 1

    r_cnt = s.count("R")
    g_cnt = s.count("G")

    ans = r_cnt*g_cnt*(n-r_cnt-g_cnt)
 
    for i in range(n):
        for j in range(i,n):
            s1 = s[i]
            s2 = s[j]
            if s1 != s2:
                t = (s1,s2)
                for s3 in "RGB":
                    if s3 not in t:
                        if 2*j-i < n and s[2*j-i] == s3:
                            ans -= 1
                        continue

    print(ans)

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

n=int(input())
p=list(map(int,input().split()))
ct=1
maxn=p.index(1)
for i in range(1,len(p)):
    if p.index(i+1)>maxn:
        pass
    else:
        maxn=p.index(i+1)
        ct+=1
print(ct)

### FIXED CODE ###

n=int(input())
p=list(map(int,input().split()))
ct=1
minn=p[0]
for i in range(1,n):
    if minn==1:
        #ct+=1
        break
    elif minn>p[i]:
        minn=p[i]
        ct+=1
print(ct)
### BUGGY CODE ###

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

ans = 1
for i in range(2, N+1):
  if min(P[:i-1]) < P[i-1]:
    pass
  else:
    ans += 1
print(ans)


### FIXED CODE ###

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

MIN = P[0]
ans = 1
for i in range(2, N+1):
  if MIN < P[i-1]:
    pass
  else:
    ans += 1
    
  if MIN > P[i-1]:
    MIN = P[i-1]
print(ans)
### BUGGY CODE ###

#169-B

N =int(input())

B = 1

A = list(map(int,input().split()))
    
#print(A)
for j in A:
    B = B * j


#print(B)
C = 10 ** 18
#print(C)
if B > C:
    print(-1)
else:
    print(B)


### FIXED CODE ###

N =int(input())

A = sorted(list(map(int,input().split())))

B = 1
C = 10 ** 18

for i in range(N):
    B = B * A[i]
    if B == 0:
        break
    elif B > C:
        B = -1
        break

print(B)
### BUGGY CODE ###

import math
k=int(input())
sum=0

for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      sum+=math.gcd(math.gcd(a,b),c)

      
print(sum)


### FIXED CODE ###

from math import gcd
k=int(input())
cnt=0
for i in range(1,k+1):
  for j in range(1,k+1):
    a=gcd(i,j)
    for k in range(1,k+1):
      cnt+=gcd(a,k)
print(cnt)
### BUGGY CODE ###

#!/usr/bin/python3

from bisect import bisect_left


def main():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    B = sorted(list(map(int, input().split())))
    C = sorted(list(map(int, input().split())))

    res = 0
    for a in A:
        t = bisect_left(B, a + 1)
        for b in B[t:]:
            s = bisect_left(C, b + 1)
            res += N - s

    print(res)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/python3

from bisect import bisect_left, bisect_right


def main():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    B = sorted(list(map(int, input().split())))
    C = sorted(list(map(int, input().split())))

    res = 0
    for b in B:
        res += bisect_left(A, b) * (N - bisect_right(C, b))

    print(res)


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

s = input()

l, r = 0, len(s)
while r - l > 1:
    c = (l + r) // 2
    
    # current point can be seen as xth smallest val, where x can be any value in [a, b] (subset of [0, c])
    # a <= b
    a, b = 0, c
    ok = True
    discrete = False # when True x = a, a+2, ..., b-2, b
    for si in s:
        if si == '1':
            if a == b == c:
                ok = False
                break
            a += 1
            b += 1
            if b > c:
                b = c - 1 if discrete else c
        elif si == '0':
            if a == b == 0:
                ok = False
                break
            a -= 1
            b -= 1
            if a < 0:
                a = 1 if discrete else 0
        else:
            if a == b == 0:
                a = b = 1
            elif a == b == c:
                a = b = c - 1
            elif a == b:
                discrete = True
                a -= 1
                b += 1
            else:
                a -= 1
                b += 1
                if a < 0:
                    a = 1 if discrete else 0
                if b > c:
                    b = c - 1 if discrete else c
    if ok:
        r = c
    else:
        l = c
print(r)

### FIXED CODE ###

from numba import njit
import numpy as np
s = np.array(list(map(lambda x: -1 if x == '?' else int(x), input())))
@njit
def test(c):
    # current point can be seen as xth smallest val, where x can be any value in [a, b] (subset of [0, c])
    # a <= b
    a, b = 0, c
    ok = True
    discrete = False # when True x = a, a+2, ..., b-2, b
    for si in s:
        if si == 1:
            if a == b == c:
                return False
            a += 1
            b += 1
            if b > c:
                b = c - 1 if discrete else c
        elif si == 0:
            if a == b == 0:
                return False
            a -= 1
            b -= 1
            if a < 0:
                a = 1 if discrete else 0
        else:
            if a == b == 0:
                a = b = 1
            elif a == b == c:
                a = b = c - 1
            elif a == b:
                discrete = True
                a -= 1
                b += 1
            else:
                a -= 1
                b += 1
                if a < 0:
                    a = 1 if discrete else 0
                if b > c:
                    b = c - 1 if discrete else c
    return True

l, r = 0, s.size
while r - l > 1:
    c = (l + r) // 2
    if test(c):
        r = c
    else:
        l = c
print(r)
### BUGGY CODE ###

n = int(input())
sl = [input() for _ in [0]*n]
for i in range(len(sl)):
  sl[i] = sorted(sl[i])
count = 0
for i in range(n-1):
  for j in range(i+1,n):
    if sl[i] == sl[j]:
      count += 1
print(count)

### FIXED CODE ###

n = int(input())
sl = sorted([''.join(sorted(input())) for _ in [0]*n])
count = 0
while len(sl)>1:
  i = 1
  flag = True
  while flag:
    if sl[-1] == sl[-(i+1)]:
      i += 1
      if i == len(sl):
        flag=False
    else:
      flag = False
  if i>1:
    count += i*(i-1)//2
  del sl[-i:]
  flag=True
print(count)
### BUGGY CODE ###

s,k = input().split()
mod = 998244353
k = int(k)
k = min(200,k)
raw = [0]
l = len(s)
for i in range(l):
  if s[i] == '0':
    raw.append(0)
  else:
    raw[-1] += 1
#print(raw)
now = [[0 for _ in range(k+1)] for _ in range(k+1)]
l = len(raw)
raw.reverse()
#print(raw)
now[0][0] = 1
for x in raw:
  last = now[:]
  now = [[0 for _ in range(k+1)] for _ in range(k+1)]
  for i in range(k+1):
    for j in range(k+1):
      for mag in range(x+1):
        if mag + i > k or mag + j > k:
          continue
        now[i+mag][j+mag] += last[i][j]
        now[i+mag][j+mag] %= mod
      for dim in range(j):
        now[i][dim] += last[i][j]
        now[i][dim] %= mod
  #print(now)
#print(now)
ans = 0
for i in range(k+1):
  ans += now[i][0]
print(ans%mod)

### FIXED CODE ###

s,k = input().split()
mod = 998244353
k = int(k)
k = min(300,k)
raw = [0]
l = len(s)
for i in range(l):
  if s[i] == '0':
    raw.append(0)
  else:
    raw[-1] += 1
#print(raw)
now = [[0 for _ in range(k+1)] for _ in range(k+1)]
l = len(raw)
raw.reverse()
#print(raw)
now[0][0] = 1
for x in raw:
  last = now[:]
  now = []
  for i in range(k+1):
    use = last[i][:]
    use.reverse()
    cum = []
    for j in range(k+1):
      if cum:
        cum.append(cum[-1]+use[j])
        cum[-1] %= mod
      else:
        cum = [use[0]]
    cum.reverse()
    now.append(cum)
    #print(cum)
  #print('#')
  cum2 = []
  for i in range(k+1):
    cum = [0 for _ in range(i)]
    cum.append(last[i][0])
    #print('%',cum)
    for l in range(i+1,k+1):
      cum.append(cum[-1]+last[l][l-i])
    #print(cum)
    cum2.append(cum)
  for i in range(k+1):
    for j in range(k+1):
      if j > i:
        pass
      now[i][j] += cum2[i-j][i]
      if i - x - 1 >= 0:
        now[i][j] -= cum2[i-j][i-x-1]
      now[i][j] %= mod
  for i in range(k+1):
    for j in range(k+1):
      now[i][j] -= last[i][j]
      now[i][j] %= mod
  #print(now)
  #print('##')
        
  #print(now)
#print(now)
ans = 0
for i in range(k+1):
  ans += now[i][0]
print(ans%mod)
### BUGGY CODE ###

import fractions
from functools import reduce

MOD = 10**9 + 7


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0


def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m


def pathes(x, y):
    xf = None
    yf = None
    xyf = None
    temp = 1
    for i in range(1, x + y + 1):
        temp *= i % MOD
        if i == x:
            xf = temp
        if i == y:
            yf = temp
        if i == x + y:
            xyf = temp

    return xyf * modinv(xf * yf % MOD, MOD)


def main():
    r1, c1, r2, c2 = map(int, input().split())

    a = (pathes(r1, c1) - 1) % MOD
    b = (pathes(r1, c2 + 1) - 1) % MOD
    c = (pathes(r2 + 1, c1) - 1) % MOD
    d = (pathes(r2 + 1, c2 + 1) - 1) % MOD

    print((d - c - b + a) % MOD)


main()


### FIXED CODE ###

import fractions
from functools import reduce
import math

MOD = 10**9 + 7


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0


def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m


# def pathes(x, y):
#     xf = None
#     yf = None
#     xyf = None
#     temp = 1
#     for i in range(1, x + y + 1):
#         temp *= i % MOD
#         if i == x:
#             xf = temp
#         if i == y:
#             yf = temp
#         if i == x + y:
#             xyf = temp
#     # xf = math.factorial(x) % MOD
#     # yf = math.factorial(y) % MOD
#     # xyf = math.factorial(x + y) % MOD

#     return xyf * modinv(xf * yf % MOD, MOD)


def pathes(rf, cf, rcf):
    return rcf * modinv((rf * cf) % MOD, MOD)


def main():
    r1, c1, r2, c2 = map(int, input().split())

    f = [1 for _ in range(r2 + c2 + 2 + 1 + 1)]

    for i in range(1, r2 + c2 + 2 + 1):
        f[i] = f[i - 1] * i % MOD

    a = (pathes(f[r1], f[c1], f[r1 + c1]) - 1) % MOD
    b = (pathes(f[r1], f[c2 + 1], f[r1 + c2 + 1]) - 1) % MOD
    c = (pathes(f[r2 + 1], f[c1], f[r2 + 1 + c1]) - 1) % MOD
    d = (pathes(f[r2 + 1], f[c2 + 1], f[r2 + c2 + 2]) - 1) % MOD

    print((d - c - b + a) % MOD)


main()
### BUGGY CODE ###

from collections import deque, defaultdict
import sys
input = sys.stdin.readline
N,M = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(M)]
Q = int(input())
vdc = [list(map(int,input().split())) for i in range(Q)]
'''
N,M = 10**5,7
ab = [[1,2],[1,3],[1,4],[4,5],[5,6],[5,7],[2,3]]
Q = 2
vdc = [[6,1,1],[1,2,2]]
'''
g = defaultdict(set)
for a,b in ab:
    g[a].add(b)
    g[b].add(a)

ans = [0]*(N+1)

for v,d,c in vdc[::-1]:
    visited = set([v])
    vs = [v]
    if ans[v] == 0:
        ans[v] = c 
    for i in range(d):
        temp = []
        for pv in vs:
            for nv in g[pv]:
                if not nv in  visited:
                    visited.add(nv)
                    if ans[nv] == 0:
                        ans[nv] = c
                    temp.append(nv)
        vs = temp

for a in ans[1:]:
    print(a)






### FIXED CODE ###

from collections import deque, defaultdict
import sys
input = sys.stdin.readline
N,M = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(M)]
Q = int(input())
vdc = [list(map(int,input().split())) for i in range(Q)]
g = defaultdict(set)

for a,b in ab:
    g[a].add(b)
    g[b].add(a)
'''
from random import randint as ri
import networkx as nx
N,M = 10**5,10**5
g = nx.gnm_random_graph(N,M)
g = nx.to_dict_of_lists(g)
g = {v+1:[nv+1 for nv in g[v]] for v in g}
Q = 20**3
vdc = [[ri(1,N),ri(0,10),ri(1,10**5)] for i in range(Q)]
'''

def dpinit(ps, val=0):
    import copy
    res = [val for i in [0]*ps[-1]]
    for i in ps[:-1][::-1]:
        res = [copy.deepcopy(res) for k in [0]*i]
    return res

ans = [0]*(N+1)
visited = dpinit([N+1,11],False)

for v,d,c in vdc[::-1]:
    if visited[v][d]:
        continue
    for t in range(d+1):
        visited[v][t] = True
    if ans[v] == 0:
        ans[v] = c 
    vs = [v]
    for i in range(d-1,-1,-1):
        temp = []
        for pv in vs:
            for nv in g[pv]:
                if not visited[nv][i]:
                    for t in range(i+1):
                        visited[nv][t] = True
                    if ans[nv] == 0:
                        ans[nv] = c
                    temp.append(nv)
        vs = temp
 
for a in ans[1:]:
    print(a)
### BUGGY CODE ###

a,b,k = map(int,input().split())
ans = [i for i in range(a,b+1) if i in range(a,min(a+k,b+1)) or i in range(max(a,b-k+1),b+1)]
for i in range(len(ans)):
    print(ans[i])

### FIXED CODE ###

a,b,k = map(int,input().split())
if b-a <= 2 * k - 1:
    for i in range(a,b+1):
        print(i)
else:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)
### BUGGY CODE ###

from bisect import bisect_right
N = int(input())
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))
cnt = 0
for i in range(N):
    a = A[i]
    indB = bisect_right(B,a)
    for j in range(indB,N):
        indC = bisect_right(C,B[j])
        cnt += N-indC
print(cnt)

### FIXED CODE ###

from bisect import bisect_right
N = int(input())
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))
F = [0 for _ in range(N+1)]
for i in range(N-1,-1,-1):
    b = B[i]
    indC = bisect_right(C,b)
    if i<N-1:
        indC1 = bisect_right(C,B[i+1])
    else:
        indC1 = N
    F[i] = F[i+1]+indC1-indC
G = [0 for _ in range(N+1)]
for i in range(N-1,-1,-1):
    G[i] = G[i+1]+F[i]
cnt = 0
for i in range(N):
    a = A[i]
    indB = bisect_right(B,a)
    cnt += G[indB]
print(cnt)
### BUGGY CODE ###

N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
INF = 1000000007
a = list(set(a))

ans, start = 1, 0

x = [1] * (N + 1)  #x[i]は0からiまでの階段の移動方法の数
x[0], x[1] = 1, 1
for i in range(2, N + 1):
	x[i] = (x[i - 1] + x[i - 2]) % INF

for j in range(1, M):
	if a[j] - a[j - 1] == 1:
		print(0)
		exit()

for k in range(N):
	if k in a:
		# print("hit")
		ans *= x[k - 1 - start]
		ans %= INF
		start = k + 1
	# print(k, "now", ans)
ans *= x[N - start]
print(ans % INF)


### FIXED CODE ###

from itertools import product

INF = 1000000007

def mat2_mul(X, Y):
	z = [[0, 0], [0, 0]]
	for (i, j, k) in product(range(2), range(2), range(2)):
		z[i][j] += X[i][k] * Y[k][j]
	return z

def mat2_pow(X, n):
	if n == 0:
		return [[1, 0], [0, 1]]
	elif n % 2:
		return mat2_mul(X, mat2_pow(X, n - 1))
	else:
		half_pow = mat2_pow(X, n / 2)
		return mat2_mul(half_pow, half_pow)

def fib(n):
	if n == 0:
		return 0
	else:
		f = [[0, 1], [1, 1]]
	return mat2_pow(f, n - 1)[1][1]


N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
ans, start = 1, 0
tmp = []

for i in range(len(a)):
	if a[i] - a[i - 1] == 1:
		print(0)
		exit()

for k in a:
	tmp.append(fib(k - start) % INF)
	start = k + 1

for j in tmp:
	ans *= j
	ans %= INF

ans *= fib(N - start + 1)
print(ans % INF)
### BUGGY CODE ###

r, g, b, n = map(int, input().split())
ans = 0
for i in range(3001):
    for j in range(3001):
        v = i*r + j*g
        if n >= v and (n-v) % b == 0:
            ans += 1
print(ans)


### FIXED CODE ###

r, g, b, n = map(int, input().split())
ans = 0
for i in range(3001):
    for j in range(3001):
        v = i*r + j*g
        if n >= v and (n-v) % b == 0:
            ans += 1
print(ans)