CodeEff/ECCO huggingface dataset:
# Original solution
import heapq


def main():
    X, Y, A, B, C = list(map(int, input().split(' ')))
    P = list(map(int, input().split(' ')))
    Q = list(map(int, input().split(' ')))
    R = list(map(int, input().split(' ')))
    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort(reverse=True)
    que = []
    for p in P[:X]:
        heapq.heappush(que, p)
    for q in Q[:Y]:
        heapq.heappush(que, q)
    for r in R:
        min_que = heapq.heappop(que)
        if min_que >= r:
            heapq.heappush(que, min_que)
            break
        else:
            heapq.heappush(que, r)
    print((sum(que)))


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    X, Y, A, B, C = list(map(int, input().split(' ')))
    P = list(map(int, input().split(' ')))
    Q = list(map(int, input().split(' ')))
    R = list(map(int, input().split(' ')))
    P.sort(reverse=True)
    Q.sort(reverse=True)
    R = R + P[:X] + Q[:Y]
    R.sort(reverse=True)
    print((sum(R[:(X+Y)])))


if __name__ == '__main__':
    main()
# Original solution
from heapq import heappush, heappop

x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

hp = []
for e in p:
    heappush(hp, [-e, 0])
for e in q:
    heappush(hp, [-e, 1])
for e in r:
    heappush(hp, [-e, 2])

ans = 0
cnt = [0] * 3
sm = 0
mx = [x, y, c]
while hp:
    yum, col = heappop(hp)
    yum = -yum

    if cnt[col] >= mx[col]:
        continue

    ans += yum
    cnt[col] += 1
    sm += 1

    if sm == x + y:
        break

print(ans)


# Optimized solution
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)

apples = p[:x] + q[:y] + r
apples.sort(reverse=True)

ans = sum(apples[:x+y])
print(ans)
# Original solution
def main():
    x, y, a, b, c = list(map(int, input().split()))
    al = sorted(list(map(int, input().split())), reverse=True)[:x]
    bl = sorted(list(map(int, input().split())), reverse=True)[:y]
    cl = sorted(list(map(int, input().split())), reverse=True)
    ans = 0
    xi, yi = 0, 0
    for i in cl:
        if al:
            ai = al[-1]
        else:
            ai = 10000000000
        if bl:
            bi = bl[-1]
        else:
            bi = 10000000000
        if ai < bi:
            if al:
                m = al.pop()
            else:
                m = 0
        else:
            if bl:
                m = bl.pop()
            else:
                m = 0
                
        if m < i:
            ans += i
        else:
            ans += m
            break
    ans += sum(al)+sum(bl)
    print(ans)

if __name__ == "__main__":
    main()

# Optimized solution
def main():
    x, y, a, b, c = list(map(int, input().split()))
    p = list(sorted(list(map(int, input().split())), reverse=True))[:x]
    q = list(sorted(list(map(int, input().split())), reverse=True))[:y]
    r = list(map(int, input().split()))
    print((sum(list(sorted(p+q+r, reverse=True))[:(x+y)])))
if __name__ == "__main__":
    main()
# Original solution
X,Y,A,B,C = list(map(int,input().split()))
p,q,r = [sorted(map(int,input().split()),reverse=True) for i in range(3)]
ans,temp = 0,0

for i in range(X+1):
    temp = sum([p[t] for t in range(i)])
    for j in range(Y+1):
        temp_2 = temp + sum([q[t] for t in range(j)])
        t = lambda C: X-i+Y-j if X+Y-i-j < C else C
        temp_2 += sum([r[t] for t in range(t(C))]) 
        ans = max(temp_2,ans)

print(ans)

# Optimized solution
X,Y,A,B,C = list(map(int,input().split()))
p,q,r = [sorted(map(int,input().split()),reverse=True) for i in range(3)]
ans = 0
pp,qq = [p[i] for i in range(X)] ,[q[i] for i in range(Y)]
r = r + pp + qq
r = sorted(r,reverse=True)
for i in range(X+Y):
    ans += r[i]
print(ans)
# Original solution
#coding:utf-8
x, y, a, b, c = list(map(int, input().split()))
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]
r = [int(i) for i in input().split()]

def pick(list1,list2,number):
    list_f = list1.copy()
    list_f2 = list1.copy()
    list_s = list2.copy()
    list_f2.extend(list_s)
    list_f2.sort(reverse = True)
    total_deli = 0
    for i in range(number):
        delic = list_f2[0]
        total_deli += int(delic)
        if(delic not in list_f):
            list_s.remove(delic)
        list_f2.remove(delic)
    return total_deli, list_s


ans1 = 0
ans2 = 0
ans3 = 0
clear_apple = []

#パターン1：赤リンゴから緑のリンゴへ
ans1,clear_apple = pick(p,r,x)
ans2,clear_apple = pick(q,clear_apple,y)
ans3 = ans1 + ans2

#パターン2：緑のリンゴから赤のリンゴへ
ans1,clear_apple = pick(q,r,y)
ans2,clear_apple = pick(p,clear_apple,x)
ans2 = ans1 + ans2

ans = max(ans2,ans3)
print(("{}".format(ans)))

# Optimized solution
#coding:utf-8
x, y, a, b, c = list(map(int, input().split()))
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]
r = [int(i) for i in input().split()]
p.sort(reverse = True)
q.sort(reverse = True)

p = p[0:x]
q = q[0:y]

p.extend(q)
p.extend(r)
p.sort(reverse = True)

ans = 0

for i in range(x + y):
  ans += p[i]
  
print(("{}".format(ans)))
# Original solution
#!/usr/bin/env python3
import sys
import heapq
sys.setrecursionlimit(10**8)
INF = float("inf")


class MaxHeap(object):
    def __init__(self, x, default=-INF):
        self.heap = [-e for e in x]
        self.default = default
        heapq.heapify(self.heap)

    def push(self, value):
        heapq.heappush(self.heap, -value)

    def pop(self):
        if len(self.heap) == 0:
            return self.default
        else:
            return -heapq.heappop(self.heap)


def argmax(a):
    value, n = -(1 << 31), -1
    for i, v in enumerate(a):
        if value < v:
            n, value = i, v
    return n, value


def solve(X: int, Y: int, A: int, B: int, C: int, p: "List[int]", q: "List[int]", r: "List[int]"):
    ABC = [MaxHeap(p), MaxHeap(q), MaxHeap(r)]

    upper = [X, Y]

    abc = [k.pop() for k in ABC]
    xyz = [0, 0, 0]
    tot = 0
    for _ in range(X+Y):
        i, m = argmax(abc)
        tot += m
        if (i < 2 and xyz[i] < upper[i]-1) or (i == 2):
            abc[i] = ABC[i].pop()
        else:
            abc[i] = -INF
        xyz[i] += 1
    print(tot)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(A)]  # type: "List[int]"
    q = [int(next(tokens)) for _ in range(B)]  # type: "List[int]"
    r = [int(next(tokens)) for _ in range(C)]  # type: "List[int]"
    solve(X, Y, A, B, C, p, q, r)


if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys
import heapq
sys.setrecursionlimit(10**8)
INF = float("inf")


class MaxHeap(object):
    def __init__(self, x, default=-INF):
        self.heap = [-e for e in x]
        self.default = default
        heapq.heapify(self.heap)

    def push(self, value):
        heapq.heappush(self.heap, -value)

    def pop(self):
        if len(self.heap) == 0:
            return self.default
        else:
            return -heapq.heappop(self.heap)


def solve(X: int, Y: int, A: int, B: int, C: int, p: "List[int]", q: "List[int]", r: "List[int]"):
    p.sort()
    p = p[-X:]
    q.sort()
    q = q[-Y:]

    h = sorted(p+q+r)
    print((sum(h[-X-Y:])))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(A)]  # type: "List[int]"
    q = [int(next(tokens)) for _ in range(B)]  # type: "List[int]"
    r = [int(next(tokens)) for _ in range(C)]  # type: "List[int]"
    solve(X, Y, A, B, C, p, q, r)


if __name__ == '__main__':
    main()
# Original solution
from collections import deque
x,y,a,b,c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
l = p[:x] + q[:y] + r
l.sort(reverse=True)
print((sum(l[:(x+y)])))

# Optimized solution
x,y,a,b,c = list(map(int,input().split()))
print((sum(sorted(sorted(list(map(int,input().split())),reverse=True)[:x]+sorted(list(map(int,input().split())),reverse=True)[:y]+list(map(int,input().split())),reverse=True)[:(x+y)])))
# Original solution
X,Y,A,B,C=list(map(int,input().split()))
p=sorted(map(int,input().split()))
q=sorted(map(int,input().split()))
r=sorted(map(int,input().split()))
ans=[]
ans+=p[A-X:]
ans+=q[B-Y:]
for i in r:
	if i>min(ans):
		ans.remove(min(ans))
		ans.append(i)
print((sum(ans)))


# Optimized solution
X,Y,A,B,C=list(map(int,input().split()))
p=sorted(map(int,input().split()))
q=sorted(map(int,input().split()))
r=sorted(map(int,input().split()))
ans=[]
ans+=p[A-X:]
ans+=q[B-Y:]
ans.sort()
j=0
k=0
for i in ans:
	if len(r)>1:
		k=r[-1]
	elif len(r)==1:
		k=r[0]
	else:
		break
	if i<k:
		ans[j]=r.pop()
		j+=1
	else:
		break
print((sum(ans)))
# Original solution
from heapq import heapify, heappush, heappop

def main():
    X, Y, A, B, C = list(map(int, input().split()))
    P = list(map(int, input().split()))
    Q = list(map(int, input().split()))
    R = list(map(int, input().split()))

    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort(reverse=True)
    PQ = P[:X] + Q[:Y]
    heapify(PQ)
    
    while C:
        mpq = heappop(PQ)
        mr = R.pop(0)
        if mpq >= mr:
            heappush(PQ, mpq)
            break
        heappush(PQ, mr)
        C -= 1
    
    print((sum(PQ)))
    

if __name__ == "__main__":
    main()

# Optimized solution
from heapq import heapify, heappush, heappop

def main():
    X, Y, A, B, C = list(map(int, input().split()))
    P = list(map(int, input().split()))
    Q = list(map(int, input().split()))
    R = list(map(int, input().split()))

    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort(reverse=True)
    PQ = P[:X] + Q[:Y]
    heapify(PQ)

    while R:
        mpq = heappop(PQ)
        mr = R.pop(0)
        if mpq >= mr:
            heappush(PQ, mpq)
            break
        heappush(PQ, mr)
    
    print((sum(PQ)))
    

if __name__ == "__main__":
    main()
# Original solution
from heapq import heapify, heappush, heappop

def main():
    X, Y, A, B, C = list(map(int, input().split()))
    P = list(map(int, input().split()))
    Q = list(map(int, input().split()))
    R = list(map(int, input().split()))

    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort(reverse=True)
    PQ = P[:X] + Q[:Y]
    heapify(PQ)

    while R:
        mpq = heappop(PQ)
        mr = R.pop(0)
        if mpq >= mr:
            heappush(PQ, mpq)
            break
        heappush(PQ, mr)
    
    print((sum(PQ)))
    

if __name__ == "__main__":
    main()

# Optimized solution
from heapq import heapify, heappush, heappop

def main():
    X, Y, A, B, C = list(map(int, input().split()))
    P = list(map(int, input().split()))
    Q = list(map(int, input().split()))
    R = list(map(int, input().split()))

    P.sort(reverse=True)
    Q.sort(reverse=True)
    PQR = P[:X] + Q[:Y] + R
    PQR.sort(reverse=True)    
    print((sum(PQR[:X+Y])))
    

if __name__ == "__main__":
    main()
# Original solution
from heapq import heapify, heappush, heappop

def main():
    X, Y, A, B, C = list(map(int, input().split()))
    P = list(map(int, input().split()))
    Q = list(map(int, input().split()))
    R = list(map(int, input().split()))

    P.sort(reverse=True)
    Q.sort(reverse=True)
    PQR = P[:X] + Q[:Y] + R
    PQR.sort(reverse=True)    
    print((sum(PQR[:X+Y])))
    

if __name__ == "__main__":
    main()

# Optimized solution
def main():
    X, Y, A, B, C = list(map(int, input().split()))
    P = list(map(int, input().split()))
    Q = list(map(int, input().split()))
    R = list(map(int, input().split()))

    P.sort(reverse=True)
    Q.sort(reverse=True)
    PQR = P[:X] + Q[:Y] + R
    PQR.sort(reverse=True)    
    print((sum(PQR[:X+Y])))
    

if __name__ == "__main__":
    main()
# Original solution
import heapq

X,Y,A,B,C = list(map(int, input().split()))

p = sorted(map(int, input().split()), reverse=True)
q = sorted(map(int, input().split()), reverse=True)
r = sorted(map(int, input().split()), reverse=True)

red = p[:X]
green = q[:Y]
nocolor = r


heapq.heapify(red)
heapq.heapify(green)
# heapq.heapify(nocolor)

for nc in nocolor:
    R = heapq.heappop(red)
    G = heapq.heappop(green)
    heapq.heappush(red,R)
    heapq.heappush(green,G)
    if R > nc and G > nc:
        break
    elif nc > R and nc > G:
        if R > G:
            q = heapq.heappop(green)
            heapq.heappush(green,nc)
        else:
            q = heapq.heappop(red)
            heapq.heappush(red,nc)
    elif nc > R:
        q = heapq.heappop(red)
        heapq.heappush(red,nc)
    elif nc > G:
        q = heapq.heappop(green)
        heapq.heappush(green,nc)


print((sum(red)+sum(green)))

# Optimized solution
import heapq

X, Y, A, B, C = list(map(int, input().split()))

p = sorted(map(int, input().split()), reverse=True)
q = sorted(map(int, input().split()), reverse=True)
r = sorted(map(int, input().split()), reverse=True)

red = p[:X]
green = q[:Y]
nocolor = r

heapq.heapify(red)
heapq.heapify(green)

for nc in nocolor:
    R = red[0]
    G = green[0]
    if R > nc and G > nc:
        break
    elif nc > R and nc > G:
        if R > G:
            q = heapq.heappop(green)
            heapq.heappush(green, nc)
        else:
            q = heapq.heappop(red)
            heapq.heappush(red, nc)
    elif nc > R:
        q = heapq.heappop(red)
        heapq.heappush(red, nc)
    elif nc > G:
        q = heapq.heappop(green)
        heapq.heappush(green, nc)

print((sum(red) + sum(green)))
# Original solution
import heapq

X, Y, A, B, C = list(map(int, input().split()))

p = sorted(map(int, input().split()), reverse=True)
q = sorted(map(int, input().split()), reverse=True)
r = sorted(map(int, input().split()), reverse=True)

red = p[:X]
green = q[:Y]
nocolor = r

heapq.heapify(red)
heapq.heapify(green)

for nc in nocolor:
    R = red[0]
    G = green[0]
    if R > nc and G > nc:
        break
    elif nc > R and nc > G:
        if R > G:
            q = heapq.heappop(green)
            heapq.heappush(green, nc)
        else:
            q = heapq.heappop(red)
            heapq.heappush(red, nc)
    elif nc > R:
        q = heapq.heappop(red)
        heapq.heappush(red, nc)
    elif nc > G:
        q = heapq.heappop(green)
        heapq.heappush(green, nc)

print((sum(red) + sum(green)))


# Optimized solution
X, Y, A, B, C = list(map(int, input().split()))

p = sorted(map(int, input().split()), reverse=True)[:X]
q = sorted(map(int, input().split()), reverse=True)[:Y]
r = list(map(int, input().split()))

apples = p + q + r
apples.sort(reverse=True)

print((sum(apples[: X + Y])))
# Original solution
import heapq
x,y,a,b,c=list(map(int,input().split()))
p=sorted(list(map(int,input().split())),reverse=True)[:x]
q=sorted(list(map(int,input().split())),reverse=True)[:y]
r=list(map(int,input().split()))
l=p+q
ans=sum(l)
hq=[]
for i in l:
    heapq.heappush(hq,i)
rq=[]
for i in r:
    heapq.heappush(rq,-i)
a=heapq.heappop(hq)
b=-heapq.heappop(rq)
while a<b:
    ans+=b-a
    if hq:
        a=heapq.heappop(hq)
    else:
        break
    if rq:
        b=-heapq.heappop(rq)
    else:
        break
print(ans)

# Optimized solution
x,y,a,b,c=list(map(int,input().split()))
p=sorted(list(map(int,input().split())),reverse=True)[:x]
q=sorted(list(map(int,input().split())),reverse=True)[:y]
r=list(map(int,input().split()))
print((sum(sorted(p+q+r,reverse=True)[:x+y])))
# Original solution
import heapq
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
hq = []
for z in p:
  heapq.heappush(hq, [-z, 1])
for z in q:
  heapq.heappush(hq, [-z, 2])
for z in r:
  heapq.heappush(hq, [-z, 3])
red = 0
green = 0
less = 0
ans = 0
while red + green + less < x + y:
  v, f = heapq.heappop(hq)
  if f == 1 and red < x:
    ans -= v
    red += 1
  elif f == 2 and green < y:
    ans -= v
    green += 1
  elif f == 3:
    ans -= v
    less += 1
print(ans)

# Optimized solution
x, y, a, b, c = list(map(int, input().split()))
p = sorted(list(map(int, input().split())), reverse=True)[:x]
q = sorted(list(map(int, input().split())), reverse=True)[:y]
r = sorted(list(map(int, input().split())), reverse=True)
print((sum(sorted(p + q + r, reverse=True)[:x+y])))
# Original solution
X, Y, A, B, C = list([int(x) for x in input().split(" ")])
li = []
p = list([int(x) for x in input().split(" ")])
q = list([int(x) for x in input().split(" ")])
r = list([int(x) for x in input().split(" ")])

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
p = p[:X]
q = q[:Y]

for j, y  in enumerate(r):
  for i, x in enumerate(p):
    if x > y:
      continue
    p[i] = y
    r[j] = x
for j, y  in enumerate(r):
  
  for i, x in enumerate(q):
    if x > y:
      continue
    q[i] = y
    r[j] = x
print((sum(p) + sum(q)))



# Optimized solution
X, Y, A, B, C = list([int(x) for x in input().split(" ")])
li = []
p = list([int(x) for x in input().split(" ")])
q = list([int(x) for x in input().split(" ")])
r = list([int(x) for x in input().split(" ")])

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
p = p[:X]
q = q[:Y]
r.extend(p)
r.extend(q)
r.sort(reverse=True)
print((sum(r[:X+Y])))
# Original solution
import heapq
x,y,a,b,c=list(map(int,input().split()))
def _int(x):
    return -int(x)
p=list(map(_int,input().split()))
q=list(map(_int,input().split()))
r=list(map(_int,input().split()))
heapq.heapify(p)
heapq.heapify(q)
heapq.heapify(r)

ans=[]
heapq.heapify(ans)
for i in range(x):
    _p=heapq.heappop(p)
    heapq.heappush(ans,-_p)
for i in range(y):
    _q=heapq.heappop(q)
    heapq.heappush(ans,-_q)
#ansは小さい順、rは大きい順
for i in range(x+y):
    if len(r)==0:break
    _ans=heapq.heappop(ans)
    _r=-heapq.heappop(r)
    if _r>=_ans:
        heapq.heappush(ans,_r)
    else:
        heapq.heappush(ans,_ans)
        break
print((sum(ans)))

# Optimized solution
#heapqすら使わなくても良い
x,y,a,b,c=list(map(int,input().split()))

p=sorted(list(map(int,input().split())),reverse=True)[:x]
q=sorted(list(map(int,input().split())),reverse=True)[:y]
r=sorted(list(map(int,input().split())),reverse=True)

p.extend(q)
ans=sorted(p)

#ansは小さい順、rは大きい順
for i in range(x+y):
    if len(r)==i or r[i]<ans[i]:
        break
    else:
        ans[i]=r[i]
print((sum(ans)))
# Original solution
from heapq import heappop, heapify, heappush


x, y, a, b, c = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
D = [-i for i in C]
A.sort(reverse=True)
B.sort(reverse=True)
AB = A[:x] + (B[:y])

heapify(AB)
heapify(D)
ans = 0
for _ in range(c):
    d = -heappop(D)
    ab = heappop(AB)
    if ab > d:
        heappush(AB, ab)
        break
    heappush(AB, d)
ans = sum(AB)
print(ans)


# Optimized solution
x, y, a, b, c = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
ABC = A[:x] + B[:y] + C
ABC.sort(reverse=True)
print((sum(ABC[:(x+y)])))
# Original solution
X, Y, A, B, C = list(map(int, input().split()))
*P, = list(map(int, input().split()))
*Q, = list(map(int, input().split()))
*R, = list(map(int, input().split()))
P = sorted(P, reverse=True)
Q = sorted(Q, reverse=True)
R = sorted(R, reverse=True)
P = P[:X]
Q = Q[:Y]
PQ = sorted(P + Q)
ans = 0
cnt = 0
if X + Y > C:
    ans += sum(PQ[C:])
    cnt += X + Y - C
    PQ = PQ[:C]
PQR = PQ + R
PQR = sorted(PQR, reverse=True)
ans += sum(PQR[:X + Y - cnt])
print(ans)

# Optimized solution
X, Y, A, B, C = list(map(int, input().split()))
*P, = list(map(int, input().split()))
*Q, = list(map(int, input().split()))
*R, = list(map(int, input().split()))
P = sorted(P, reverse=True)[:X]
Q = sorted(Q, reverse=True)[:Y]
print((sum(sorted(P + Q + R, reverse=True)[:X + Y])))
# Original solution
m, d = list(map(int,input().split()))
n, e = list(map(int,input().split()))
print((int(n >= 2 and e == 1)))

# Optimized solution
m, d = list(map(int,input().split()))
n, e = list(map(int,input().split()))
print((int(e == 1)))
# Original solution
m1,d1=list(map(int,input().split()))
m2,d2=list(map(int,input().split()))
print(((m1<m2 and d1>d2)+0))

# Optimized solution
m,d=list(map(int,input().split()))
mm,dd=list(map(int,input().split()))
print(('01'[m<mm]))
# Original solution
a,b=open(0);print((+(a[:2]!=b[:2])))

# Optimized solution
print((+(input()[:2]!=input()[:2])))
# Original solution
print((1//int([*open(0)][1][2:])))

# Optimized solution
print((+(' 1\n'in[*open(0)][1])))
# Original solution
M1, D1 = list(map(int, input().split()))
M2, D2 = list(map(int, input().split()))

if M1 == M2:
    print((0))
else:
    print((1))


# Optimized solution
li = [list(input().split()) for _ in range(2)]
print((0 if li[0][0] == li[1][0] else 1))
# Original solution
N=int(eval(input()))
li = list(map(int, input().split()))
c=0
ali=[]
for i in range(0,N):
  for j in range(0,N):
    for k in range(0,N):
      if li[i]+li[j]>li[k] and li[j]+li[k]>li[i] and li[k]+li[i]>li[j]:
        if li[i]!=li[j] and li[j]!=li[k] and li[k]!=li[i]:
          if i!=j and j!=k and k!=i:
            ali.append(sorted([i,j,k]))
def get_duplicate_list(seq):
    seen = []
    return [x for x in seq if not seen.append(x) and seen.count(x) == 2]
print((len(get_duplicate_list(ali))))

# Optimized solution
N=int(eval(input()))
li = list(map(int, input().split()))
c=0
ali=[]
for i in range(0,N):
  for j in range(0,N):
    for k in range(0,N):
      if li[i]+li[j]>li[k] and li[j]+li[k]>li[i] and li[k]+li[i]>li[j]:
        if li[i]!=li[j] and li[j]!=li[k] and li[k]!=li[i]:
          if i!=j and j!=k and k!=i and i<j and j<k:
            ali.append(sorted([i,j,k]))
print((len(ali)))
# Original solution
#! env/bin/local python3
# -*- coding: utf-8 -*-

from itertools import combinations


def is_tri(_a, _b, _c):
    if (_a + _b > _c) and (_b + _c > _a) and (_c + _a > _b):
        return True
    else:
        return False


n = int(eval(input()))
sticks = list(map(int, input().split()))

h = combinations(sticks, 3)

counter = 0
for a, b, c in h:
    if is_tri(a, b, c):
        a, b, c = sorted([a, b, c])
        if (a != b) and (b != c):
            counter += 1

print(counter)


# Optimized solution
#! env/bin/local python3
# -*- coding: utf-8 -*-

from itertools import combinations


def is_tri(_a, _b, _c):
    if (_a + _b > _c) and (_b + _c > _a) and (_c + _a > _b):
        return True
    else:
        return False


n = int(eval(input()))
sticks = list(map(int, input().split()))

h = combinations(sticks, 3)

counter = 0
for a, b, c in h:
    if is_tri(a, b, c):
        # a, b, c = sorted([a, b, c])
        if (a != b) and (b != c) and (c != a):
            counter += 1

print(counter)