peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
#!/usr/bin/env python3

N, A, B, C, D = map(int, input().split())
S = input()

#hunuke

h = S[A-1:D+1].count('##')
m3 = S[B-2:D+1].count('...')

if C < D:
    if h == 0: print('Yes')
    else: print('No')
else:
    if m3 != 0 and h == 0:
        print('Yes')
    else: print('No')
# Judge status: Accepted
import sys
a, b, c = map(int,sys.stdin.readline().split())
d = c - a - b
if d > 0 and d * d > 4 * b * a:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a, b, c = map(int, input().split())

if c-a-b>=0:
    if 4*a*b<(c-a-b)**2:
        print('Yes')
    else:
        print('No')
else:
    print('No')
# Judge status: Wrong Answer
import random
 
x = random.randint(0,1)
 
if x == 1:
  print(0)
  
elif x == 0:
  print(1)
# Judge status: Accepted
x,y=input().split()
x=int(x)
y=int(y)
if x==2 | y==2:
    print('No')
    exit()
lt1=[1,3,5,7,8,10,12]
lt2=[4,6,9,11]
if (lt1.count(x)==1 and lt1.count(y)==1) or (lt2.count(x)==1 and lt2.count(y)==1):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())

for n in [111, 222, 333, 444, 555, 666, 777, 888, 999]:
  if n >= N:
    print(n)
    break
# Judge status: Wrong Answer
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(A):
    for b in range(B):
        for c in range(C):
            if a * 500 + b * 100 + c * 50 == X:
                ans += 1
print(ans)
# Judge status: Accepted
# ABC149 C - Next Prime

x = int(input())
for i in range(x,10**5+4):
    if all(i%j!=0 for j in range(2,x)):
        print(i)
        break
# Judge status: Accepted
N = int(input())
from itertools import product

count_dic = {i: 0 for i in range(1, N+1)}
def func(x, y, z):
    return x**2 + y**2 + z**2 + x*y + y*z + z*x

for x, y, z in list(product(range(1, 101), repeat=3)):
    res = func(x, y, z)
    if res > N:
        continue
    count_dic[res] += 1

for i in range(1, N+1):
    print(count_dic[i])
# Judge status: Accepted
x = int(input())

if x%100 == 0 or x%101 == 0 or x%102 == 0 or x%103 == 0 or x%104 == 0 or x%105 == 0:
    print (1)
else:
    for i in range(100000):
        if 100*i <= x <= 105*i:
            print (1)
            exit ()
    else:
        print (0)
# Judge status: Accepted
N=int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
l=prime_factorize(N)
L=set(l)
z=0
for j in L:
  i=1
  while i*(i+1)//2<=l.count(j):
    i+=1
  z+=i-1
print(z)
# Judge status: Wrong Answer
#52 1日かかった
N = int(input())
b = list(map(int,input().split()))
a = [0 for i in range(N)]

for i in range(N-2):
    a[i] = min(b[i],b[i+1])

a[-1] = b[-1]
            
        
    
print(a)
print(sum(a))
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 23 16:50:38 2020

@author: liang
"""
N = int(input())
d = dict()
ans = 0 
A = [int(input()) for _ in range(N)]
for a in A:
    if a in d:
        d[a] += 1
    else:
        d[a] = 1
#print(d)
for key in d.keys():
    if d[key] %2 ==1:
        ans += 1
        d[key] = 0
#print(d)
print(ans)
# Judge status: Wrong Answer
N = int(input())
A_high_list = list(map(int,input().split()))
B_list = [A_high_list[0]]
Fumidai = 0
s = 0

for n, m in enumerate(A_high_list):
    if B_list[n] > A_high_list[n]:
        s = max(B_list) - int(A_high_list[n])
        Fumidai += s
        B_list.append(A_high_list[n])
    else:
        B_list.append(A_high_list[n])
        continue

print(Fumidai)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
n=0
for i in range(N-1):    
    if A[i]<A[i-1]:
        n+=A[i-1]-A[i]
        A[i]=A[i-1]
print(n)
# Judge status: Accepted
b0=input()

st=""
for x in range(len(b0)):
  if b0[x]=="P":
    st=st+"P"
  else:
    st=st+"D"
    
print(st)
# Judge status: Accepted
import math

n = int(input())
li = list(map(int, input().split(" ")))

for i in range(n - 1, 0, -1):
    if li[i - 1] <= li[i]:
        continue
    li[i - 1] -= 1
    if li[i - 1] > li[i]:
        print("No")
        exit()

print("Yes")
# Judge status: Wrong Answer
from copy import deepcopy

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

count1=0
p1=deepcopy(p)
for i in range(N-1):
  if p1[i] == i+1:
    p1[i],p1[i+1]=p1[i+1],p1[i]
    count1 += 1
    
count2=0
p2=deepcopy(p)
for i in range(N-1,0,-1):
  if p2[-i] == N-i:
    p2[-i],p2[-i-1]=p2[-i-1],p2[-i]
    count2 += 1
    
print(max(count1,count2))
# Judge status: Wrong Answer
import math
r = int(input())

print(2*math.pi)
# Judge status: Accepted
n = int(input())
a=list(map(int,input().split()))
if 0 in a:
    result=0
else:
    result = 1
    for i in range(n):
        result *= a[i]
        if result>1000000000000000000:
            result = -1
            break
print(result)
# Judge status: Accepted
import sys
import math
W,a,b = map(int,input().split())
al = [[a,0],[a,1],[a+W,0],[a+W,1]]
bl = [[b,1],[b,2],[b+W,1],[b+W,2]]
box = []
if (b <= a and a <= b+W) or (a <= b <= a+W and a <= b+W <=a+W) or (a <= b and b <= a+W):
  print(0)
  sys.exit()
for i in range(4):
  for j in range(4):
    num = math.sqrt((al[i][0]-bl[j][0])**2 + (al[i][1]-bl[j][1])**2)
    box.append(int(num))
print(min(box))
# Judge status: Accepted
(n,),a,b=[[*map(int,i.split())]for i in open(0)]
print("YNeos"[sum(min(j-i,(j-i)//2) for i,j in zip(a,b))<0::2])
# Judge status: Accepted
n=int(input())
if(n==0):
  print(1)
else:
  print(0)
# Judge status: Wrong Answer
import math
a,b,x=map(int,input().split())
if a*b**2>=2*x:
    print(math.degrees(math.atan2(a*b**2,(2*x))))
else:
    print(math.degrees(math.atan2(2*b*a**2-2*x,a**3)))
# Judge status: Accepted
n = int(input())
ans = 0

a, b = [], []
for i in range(n):
    ai, bi = map(int, input().split())

    a.append(ai)
    b.append(bi)

c = 0
for i in reversed(range(n)):
    a[i] += c
    x = a[i] % b[i]
    if x:
        if a[i] < b[i]:
            c += b[i] - a[i]
        elif a[i] > b[i]:
            c += b[i] - x

print(c)
# Judge status: Accepted
s = input()
t = input()
y = 1001
for i in range(len(s) - len(t) + 1): #sの始め
    x = 0
    for j in range(len(t)): #何文字目を調べるか
        if s[i + j] != t[j]:
            x += 1
    if x < y:
        y = x
print(y)
# Judge status: Accepted
def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    total_length = sum(a_list)
    ans = total_length
    accum_length = 0

    for i in range(n):
        accum_length += a_list[i]
        ans = min(ans, abs(2 * accum_length - total_length))

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
s =input()
print('No' if ('R' in set([s[i] for i in range(len(s)) if (i+1)%2 == 0])) or ('L' in set([s[i] for i in range(len(s)) if (i+1)%2 != 0])) else 'Yes')
# Judge status: Accepted
n=int(input())
a="zabcdefghijklmnopqrstuvwxy"
b=""
while n/26>0:
  b=a[n%26]+b
  n=(n-1)//26
print(b)
# Judge status: Accepted
num = list(map(int, input().split()))

num.sort()

e = (num[2]*10) + num[1] +num[0] 

print(e)
# Judge status: Accepted
x,a,b=map(int, input().split())


if -a+b <=0:
  print('delicious')
elif -a+b < x+1:
  print('safe')
else:
  print('dangerous')
# Judge status: Accepted
A, B, T = map(int, input().split())
print(B * (T // A))
# Judge status: Wrong Answer
import fractions
n, m = map(int, input().split())
a_list = [int(i) for i in input().split()]

c = 1
for a in a_list:
    c = c * (a // 2) // fractions.gcd(c, a // 2)
if (m // c) % 2 == 0:
    print((m // c) // 2)
else:
    print(((m // c) // 2) + 1)
# Judge status: Accepted
N = int(input())

dp = [N] * (N+1)

dp[0] = 0

for i in range(1,N+1):
    dp[i] = dp[i-1] + 1
    for k in range(1,10):
        if i < 6**k:
            break
        else:
            dp[i] = min(dp[i],dp[i-6**k]+1)
            
    for k in range(1,10):
        if i < 9**k:
            break
        else:
            dp[i] = min(dp[i],dp[i-9**k]+1)

print(dp[N])
# Judge status: Accepted
import heapq

N,M=map(int,input().split())
A=list(map(int,input().split()))
A=list(map(lambda x: x*(-1), A))
A.sort()

for _ in range(M):
  n=heapq.heappop(A)
  n=-(-n//2)
  heapq.heappush(A,n)
print(-sum(A))
# Judge status: Accepted
s=input()
t=input()

t_l = len(t)
diff_min = 999999999

def diff_str(s1, s2):
    diff_c = 0
    for j in range(len(s1)):
        if s1[j] != s2[j]:
            diff_c += 1
    return diff_c

if len(s) == len(t):
    diff_min = diff_str(s, t)

for i in range(len(s)-t_l):
    seq=s[i:i+t_l]
    diff_c = diff_str(seq, t)
    if diff_c < diff_min:
        diff_min = diff_c


print(diff_min)
# Judge status: Accepted
n,m,x,y=map(int,input().split())
x,y=[x],[y]
x.extend(list(map(int,input().split())))
y.extend(list(map(int,input().split())))
x.sort()
y.sort()
if x[-1]>=y[0]:
  print('War')
else:
  print('No War')
# Judge status: Accepted
n,k,q=map(int,input().split())
p=[q]*(n+1)

for i in range(q):
  a=int(input())
  p[a]-=1
  
for i in range(1,n+1):
  if p[i]<k:
    print("Yes")
  else:
    print("No")
# Judge status: Wrong Answer

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

sum = a+b
n % sum  

res = (n//sum)*a + n % sum
print(res)
# Judge status: Wrong Answer
A, B, C, K = map(int, input().split())

if K != 0:
    A, B, C = B+C, C+A, A+B

if abs(A-B) > 10**18:
    print('Unfair')
else:
    print(A-B)
# Judge status: Accepted
A = [int(input()) for i in range(5)]
D = int(input())
if A[4]-A[0] <= D:
  print("Yay!")
else:
  print(":(")
# Judge status: Accepted
from collections import Counter

n = int(input())
l = [Counter(input()) for _ in range(n)]

ans = ''
c = sorted(l[0])

for key in c:
    m = l[0][key]
    for i in range(1, n):
        m = min(m, l[i][key])
    ans += key * m

print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = 1
if len(a) > 2:
  if a[0] < a[1]: tr = 1
  elif a[0] > a[1]: tr = -1
  else: tr = 0
  ans = 1
  for i in range(2, n):
    if tr == 1 and a[i-1] > a[i]:
      ans += 1
      tr = 0
    elif tr == -1 and a[i-1] < a[i]:
      ans += 1
      tr = 0
    else:
      if a[i-1] > a[i]: tr = -1
      elif a[i-1] < a[i]: tr = 1
print(ans)
# Judge status: Wrong Answer
n=input().split()
if (int(n[3])<=int(n[0])+int(n[1])):
  print(int(n[0]))
else:
  print((int(n[0]))-(int(n[3])-int(n[0])-int(n[1])))
# Judge status: Wrong Answer
mino=10
ans=0
for i in range(5):
  x=int(input())
  if x%10==0:
    ans+=x
  else:
    if mino > x%10:
      mino = x%10
      ans+=x+x%10
ans=ans-(10-mino)
print(ans)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())
As.sort()
M = As.pop()

diff = 10**18
for a in As:
    if abs(M/2-a)<diff:
        diff = abs(M/2-a)
        ans = a

print(M, ans)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))

M=max(A)
check=[0]*(M+1)
#A.sort()
for i in range(N):
    a=A[i]
    if check[a]>1:
        continue
    while a<=M:
        check[a]+=1
        a+=A[i]
ans=0
for i in range(N):
    if check[A[i]]==1:
        ans+=1

print(ans)
# Judge status: Accepted
from collections import defaultdict
"""
N 以下の全ての整数に対して, (先頭, 末尾) を数える.
(先頭, 末尾), (末尾, 先頭)の組は, 独立しているので掛け算で求められる.
"""
n = int(input())
ansl = defaultdict(lambda: 0)
for i in range(1,n+1):
	sentou = int(str(i)[0])
	ushiro = int(str(i)[-1])
	ansl[(sentou, ushiro)] += 1
ans = 0
for i in range(1, 10):
	for j in range(1, 10):
		ans += ansl[(i, j)]*ansl[(j, i)]
print(ans)
# Judge status: Accepted
N, x = map(int, input().split())
A = list(map(int, input().split()))
acc = 0
ans = 0
for a in A:
    eat = max(acc + a - x, 0)
    ans += eat
    acc = a - eat
acc = 0
ans2 = 0
for a in A:
    eat = max(acc + a - x, 0)
    ans2 += eat
    acc = a - eat
print(min(ans, ans2))
# Judge status: Wrong Answer
n = int(input())
s = list(input())
t = list(input())


if s[-1] in t:
    i = t.index(s[-1])
    if s[-i-1:] == t[:i+1]:
        print(len("".join(s[:-i-1]) + "".join(t)))
    else:
        print(len("".join(s) + "".join(t)))
else:
    print(len("".join(s) + "".join(t)))
# Judge status: Accepted
import math
n, m = map(int, input().split())

ans = 1
for i in range(1,math.ceil(math.sqrt(m))):
	if m%i == 0:
		if m >= n*i:
			ans = max(ans, i)
		j = m//i
		if m >= n*j:
			ans = max(ans,j)

print (ans)
# Judge status: Wrong Answer
a = 2
print(a + a ** 2 + a ** 3)
# Judge status: Accepted
A,B,T = map(int,input().split())

print(int((T+0.5)//A*B))
# Judge status: Wrong Answer
s = int(input())

ans = 0

while s not in [1,2,4]:
    ans+=1
    if s%2:
        s = 3*s+1
    else:
        s//=2

ans+4
# Judge status: Accepted
from bisect import bisect_right
N = int(input())
A = [int(input()) for _ in range(N)]
dp = [10**10] * N
for a in A:
    a = -a
    dp[bisect_right(dp, a)] = a
ans = N - dp.count(10**10)
print(ans)
# Judge status: Accepted
def main():
    k = int(input())
    surplus = 0 
    for i in range(1, k+1):
        surplus *= 10
        surplus += 7
        surplus %= k
        if not surplus:
            print(i)
            return
    print(-1)
            

if __name__ == "__main__":
    main()
# Judge status: Accepted
n,m=map(int,input().split())
l=[]
for i in range(m):
  l+=list(map(int,input().split()))
for i in range(1,n+1):
  print(l.count(i))
# Judge status: Wrong Answer
n=['0']+list(input())
a=0
k=0
for i in range(len(n)-1,-1,-1):
  if (int(n[i])+k>5):
    a+=10-int(n[i])-k
    k=1
  else:
    a+=int(n[i])+k
    k=0
print(a)
# Judge status: Accepted
def Two_Coins(a , b , c):

    return "Yes" if a + b >= c else "No"

def main():
    a , b , c = map(int , input().split())
    print(Two_Coins(a , b , c))

if __name__ == '__main__':
    main()
# Judge status: Accepted
N,K = map(int, input().split())
A = [int(c) for c in input().split()]
cnt = 0
p = 0
used = [False]*N
used[0] = True
while True:
  p = A[p]-1
  cnt += 1
  if used[p]:
    m = p
    break
  used[p] = True
p = 0
while m!=p and K:
  cnt -= 1
  p = A[p]-1
  K -= 1
if K==0:
  print(p+1)
  import sys
  sys.exit()
K %= cnt
while K:
  p = A[p]-1
  K -= 1
print(p+1)
# Judge status: Wrong Answer
import math
a, b, x = map(int, input().split())
if a**2*b == x:
    s = 0
elif (a**2)*b/2 < x:
    s = math.degrees(math.atan(2*a/(2*(b-(x/(a**2))))))
else:
    s = math.degrees(math.atan(2*x/(a*b**2)))
print(90-s)
# Judge status: Accepted
D,N=map(int,input().split())
if N<100:
  print(N*100**D)
else:
  print(101*100**D)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
count = 0
ans, mina = a[0], abs(a[0])
flag = False
for i in range(1, n):
    ans += abs(a[i])
    mina = min(mina, abs(a[i]))
    if a[i]<0: count += 1
if count%2 or a.count(0): print(ans-mina*2)
else: print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
llist = []
rlist = []
for i in range(m):
    l, r = map(int, input().split())
    llist.append(l)
    rlist.append(r)

c = 0
lm = max(llist)
rm = min(rlist)
for i in range(1, n + 1):
    if lm <= i <= rm:
        c += 1

print(c)
# Judge status: Accepted
n = int(input())

ab = [list(map(int,input().split())) for i in range(n)]

a = [i[0] for i in ab]
b = [i[1] for i in ab]

temp = 0
for i in reversed(range(n)):
    a[i] += temp
    
    if a[i] % b[i] == 0:
        continue
    
    else:
        temp += (b[i] - (a[i]%b[i]))
    
print(temp)
# Judge status: Accepted
def solve():
    N = int(input())
    for i in range(1000 - N):
        if len(set(str(N + i))) == 1:
            print(N + i)
            exit()


if __name__ == '__main__':
    solve()
# Judge status: Wrong Answer
S=input()
s=len(S)
for i in range(s):
    print("x")
# Judge status: Accepted
c = sorted(list(map(int, input().split())))

print('Yes' if c[0] + c[1] == c[2] else 'No')
# Judge status: Wrong Answer
n,k=map(int,input().split())
x=list(map(int,input().split()))

import bisect
c=bisect.bisect_left(x,0)
mt=2*10**8

for i in range(n-k+1):
  if i+k<c:continue
  mt=min(mt,2*abs(x[i])+abs(x[i+k-1]),abs(x[i])+2*abs(x[i+k-1]))
  if i+k-1 ==c-1:mt=min(mt,abs(x[i]))
  if i==c:mt=min(mt,x[i+k-1])

print(mt)
# Judge status: Wrong Answer
A, B = list(map(int, input().split()))
S = input()

if S[A] == "-" and S[:A].isdecimal() and S[B:A+B+1].isdecimal():
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N=int(input())
if N<=81 and N%10!=0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
mod = 10**9 + 7
n, a, b = map(int, input().split())
ans = pow(2, n, mod) - 1

for r in [a, b]:
    x = 1
    for i in range(r):
        x *= n-i
        x %= mod
        x *= pow(i+1, mod-2, mod)
        x %= mod
    ans = (ans + mod-x)%mod

print(ans)
# Judge status: Accepted
import math
import sys

X, K, D = map(int, input().split())

a = X - K * D
if a > 0:
    print(a)
    sys.exit()
if a + 2 * K * D < 0:
    print(abs(a + 2 * K * D))
    sys.exit()
else:
    b = a / (-2 * D)
    p = math.floor(b)
    q = math.ceil(b)
    r = -(a + 2 * D * p)
    s = a + 2 * D * q
    print(min(r,s))
    sys.exit()
# Judge status: Wrong Answer
import bisect

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort
b.sort
c.sort
ans = 0

for i in range(n):
    a_M = bisect.bisect_left(a, b[i])
    c_m = bisect.bisect_right(c, b[i])
    ans += a_M * (n - c_m)
print(ans)
# Judge status: Wrong Answer
x, a, b = map(int, input().split())

if(b < a):
    print("delicious")
elif(b > a and x+a > b):
    print("safe")
else:
    print("dangerous")
# Judge status: Accepted
n, m = map(int, input().split())
a = [-1]*n
for i in range(m):
    s, c = map(int, input().split())
    if a[s-1] == -1:
        a[s-1] = c
    elif a[s-1] != c:
        print(-1)
        exit()
    if n != 1 and s == 1 and c == 0:
        print(-1)
        exit()
for i in range(n):
    if a[i] == -1:
        a[i] = 0
if n != 1 and a[0] == 0:
    a[0] = 1
for i in range(n):
    print(a[i], end="")
# Judge status: Wrong Answer
s = input()
for i in range(ord('a'), ord('z') + 1):
  c = chr(i)
  if s.count(c) > 0:
    print(c)
    break
else:
  print('None')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

dp = [0] * N
dp[0] = 1000

for i in range(1, N):
    dp[i] = dp[i - 1]
    for j in range(i - 1):
        V = dp[j] // A[j]
        W = dp[j] + (A[i] - A[j]) * V
        dp[i] = max(dp[i], W)

print(dp[N - 1])
# Judge status: Accepted
def main():
    print("Yes" if "".join(sorted(list(input()))) == "abc" else "No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b=map(int, input().split())
if a > 9 or b > 9:
    print("-1")
else:
    print(a*b)
# Judge status: Accepted
N, A, B = map(int, input().split())

if N == 1:
    if A == B:
        print(1)
    else:
        print(0)
    exit()

if A > B:
    print(0)
    exit()

# 全部A〜全部Bまでの範囲
ans = B * (N - 2) - A * (N - 2) + 1
print(ans)
# Judge status: Wrong Answer
a, b, c=map(int,input().split())
print(a*b/2)
# Judge status: Wrong Answer
a,b,c = map(int, input().split())
print(c - (a-b))
# Judge status: Accepted
a,b,x = list(map(int,input().split()))

if a > x:
    print('NO')
else:
    if a+b >= x:
        print('YES')
    else:
        print('NO')
# Judge status: Accepted
N = int(input())
job = [list(map(int, input().split())) for _ in range(N)]
job.sort(key=lambda x: x[1])
time = 0
FLG = True

for need, limit in job:
    time += need
    if time > limit:
        FLG = False
        break

if FLG:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def resolve():
    ap, ar, bp, br = map(int, input().split())

    if ar <= bp or br <= ap:
        return print(0)
    else:
        u = max(ap, bp)
        o = min(ar, br)
        ans = o - u
        print(ans)

if __name__ == '__main__':
    resolve()
# Judge status: Wrong Answer
N = int(input())
w = list(map(int,input().split()))

M = sum(w) // 2
i = 0
s1 = 0
while s1 < M:
    s1 += w[i]
    i += 1

print(abs(sum(w)-s1-s1))
# Judge status: Wrong Answer
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]


A.sort()
B.sort()
C.sort()

import bisect
ans = 0

a2b = []
c2b = []
for c in C:
    c_bisect = bisect.bisect_right(B, c)
    c2b.append(c_bisect)
    
for a in A:
    a_bisect = N - bisect.bisect_right(B, a)
    a2b.append(a_bisect)

for i, j in zip(a2b, c2b):
    ans += i*j
print(ans)
# Judge status: Accepted
s = input()
s_o = 10
flag = "ok"
for i in s:
    if s_o == i:
        flag = "ng"
    s_o = i
if flag == "ng":
    print("Bad")
else:
    print("Good")
# Judge status: Accepted
t = input()
t = t.replace("?","D")
print(t)
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=list(map(int,input().split()))
if n-sum(a)<=0:
  print(-1)
else:
  print(n-sum(a))
# Judge status: Wrong Answer
n=int(input())
I=list(map(int,input().split()))
num=1000
for i in range(n-1):
    if I[i]<I[i+1]:
        num-=(num//I[i])*I[i]
        num+=(num//I[i])*I[i+1]
print(num)
# Judge status: Accepted
N,K,S=map(int,input().split())
A=[]
if 1<=S<10**9:
  for i in range(K):
    A.append(S)
  for i in range(N-K):
    A.append(S+1)
  print(*A)
else:
  for i in range(K):
    A.append(S)
  for i in range(N-K):
    A.append(S-1)
  print(*A)
# Judge status: Accepted
X = int(input())
N = X // 100
for n in range(N + 1):
  M = X - n * 100
  if M > n * 5:
    continue
  else:
    print(1)
    break
else:
  print(0)
# Judge status: Wrong Answer

def main():
    n = int(input())

    print((n//2)+1)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n,a,b,c,d = map(int,input().split())
s = input()
S = s[min(a,b):max(c,d)]

l = len(S)
C = True
D = False
for i in range(l-1):
  if S[i]=='#' and S[i+1]=='#':
    C = False
    break
  if d > i > 0:
    if S[i-1]=='.' and S[i]=='.' and S[i+1]=='.':
      D = True
      
if not C:
  print('No')
elif C and not D:
  if c < d:
    print('Yes')
  else:
    print('No')
else:
  print('Yes')
# Judge status: Accepted
ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
x = ni()
if 400<=x < 600:
    r=8
if 600<=x < 800:
    r=7
if 800<=x < 1000:
    r=6
if 1000<=x < 1200:
    r=5
if 1200<=x < 1400:
    r=4
if 1400<=x < 1600:
    r=3
if 1600<=x < 1800:
    r=2
if 1800<=x < 2000:
    r=1
print(r)
# Judge status: Accepted
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

n = int(input())
a = int(input())
n%=500
if n>a:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
import sys
sp=input()
t=input()

m=len(sp)
n=len(t)
for i in range(m-n,-1,-1):
  cand=sp[:i].replace('?','a')+t+sp[i+n:].replace('?','a')
  for j,w in enumerate(t):
    if sp[j+i]!=w and sp[j+i]!='?':
      break
  else:
    print(cand)
    sys.exit()
print('UNRESTORABLE')
# Judge status: Accepted
import math

N = int(input())
A = list(map(int, input().split()))
# print(N, A)

_A = []
for i in range(len(A)):
    _A.append(A[i] - (i + 1))
_A.sort()
median = _A[math.floor(len(A) / 2)]

sadness = 0
for i in range(len(A)):
    sadness += abs(A[i] - (i + 1 + median))

print(sadness)
# Judge status: Accepted
n,d = map(int, input().split())
ans=0
for i in range(n):
    x,y = map(int, input().split())
    if x**2+y**2<=d**2:
        ans+=1

print(ans)
# Judge status: Accepted
from operator import itemgetter, attrgetter

n, m = list(map(int, input().split(' ')))
abn = [None] * n
for i in range(n):
    abn[i] = list(map(int, input().split(' ')))

abn = sorted(abn, key=itemgetter(0))

cost = 0
num = 0
for ab in abn:
    temp = 0
    while num < m and temp < ab[1]:
        cost += ab[0]
        temp += 1
        num += 1
    if num == m:
        break

print(cost)
# Judge status: Accepted
import math
a,b,c,d = map(int, input().split())
ans = b - a + 1
cntc = b//c - (a-1)//c
cntd = b//d - (a-1)//d
cd = (c * d) // math.gcd(c, d)
cntcd = b//cd - (a-1)//cd
ans = ans - cntc - cntd + cntcd
print(ans)
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]
dic = {num: 0 for num in set(A)}
for i in range(N):
    dic[A[i]] = 1 if dic[A[i]]==0 else 0
ans = 0
for num in set(A):
    ans += dic[num]
print(ans)