Harryxun/stf_run huggingface dataset:
n,a,b = list(map(int, input().split()))
m = (10 ** 9) + 7
dp = [-1] * (n+1)
total = 0

for i in range(0, n+1):
    if(i > 0):
        x = i * dp[i - 1]

        if(x <= m):
            dp[i] = x
        else:
            dp[i] = x % m
    else:
        dp[0] = 1

if n > 2:
    for i in range(1, n+1):
        if(i != a and i != b):
            total += int(dp[n] / (dp[i] * dp[n-i]))


print(total)

### FIXED CODE ###

n, a, b = list(map(int, input().split()))
p = (10 ** 9) + 7

def powmod(x, exp, mod):
    if(exp == 1):
        return x % mod

    if(exp % 2 == 1):
        return (x * powmod(x, exp - 1, mod)) % mod

    x = powmod(x, exp / 2, mod)

    return (x * x) % mod

# nCrを計算するが、nもrも巨大なためフェルマーの小定理を利用する
# x = nPr
# y = r!
# x / y ≡ x * y^-1
# p を法とした時、掛けるたびにmodをとった数同士の割り算はうまくいかない
# フェルマーの小定理から
# y^(p-1) ≡ 1
# y * y^(p-2) ≡ 1
# y^(p-2)がyの逆元と同じ振る舞いをするのでy^(p-2)を掛ける
def combination(n, r, mod):
    x = 1
    y = 1

    for i in range(r):
        x *= n - i # n * (n - 1) * (n - 2) * ... * (n - i + 1)
        x %= mod
        y *= i + 1 # r * (r - 1) * (r - 2) * ... * 2 * 1 を逆さまにかけていく
        y %= mod

    return x * powmod(y, mod - 2, mod) % mod


total = powmod(2, n, p) - 1 #1本も花を選ばないパターンは除外する
comb_a = combination(n, a, p)
comb_b = combination(n, b, p)


print((total - comb_a - comb_b) % p)
n, q = map(int, input().split())
s = list(input())

l = [0]
ll = []
count = 0

for i in range(n):
    if s[i] == 'A' and s[i+1] == 'C':
        count += 1
    l.append(count)


for i in range(q):
    array = list(map(int, input().split()))
    ll.append(array)

for i in range(q):
    print(l[ll[i][1]-1] - l[ll[i][0]-1])



### FIXED CODE ###

n, q = map(int, input().split())
s = list(input())

l = [0]
ll = []
count = 0

for i in range(n-1):
    if s[i] == 'A' and s[i+1] == 'C':
        count += 1
    l.append(count)


for i in range(q):
    array = list(map(int, input().split()))
    ll.append(array)

for i in range(q):
    print(l[ll[i][1]-1] - l[ll[i][0]-1])
a = input()
b = input()
h = input()
print((a+b)*h/2)

### FIXED CODE ###

a=input()
b=input()
h=input()
print((int(a)+int(b))*int(h)//2)
num = list(map(int, input().split())
k = int(input())
print(max(num)*(2**k-1)+sum(num))

### FIXED CODE ###

num = list(map(int, input().split()))
k = int(input())
print(max(num)*(2**k-1)+sum(num))
x = input()
if x = "ABC":
    print("ARC")
if x = "ARC":
    print("ABC")

### FIXED CODE ###

x = input()
if x == 'ABC':
    print('ARC')
if x == 'ARC':
    print('ABC')
from collections import deque

h,w = map(int,input().split())
maze = []
for i in range(h):
    s = input()
    maze.append(s)

def cand_pos(i,j):
    neighbor = []
    if i==0:
        neighbor.append(maze[i+1][j])
    elif i==h-1:
        neighbor.append(maze[i-1][j])
    else:
        neighbor.append(maze[i+1][j])
        neighbor.append(maze[i-1][j])
    
    if j==0:
        neighbor.append(maze[i][j+1])
    elif j==w-1:
        neighbor.append(maze[i][j-1])
    else:
        neighbor.append(maze[i][j+1])
        neighbor.append(maze[i][j-1])
    
    if maze[i][j]!='#' and neighbor.count('.')==1:
        return True
    else:
        return False


# (sx, sy) から (gx, gy) への最短距離を求める
# 辿り着けないと INF
def bfs(sx,sy,gx,gy):
    # すべての点を INF で初期化
    d = [[float("inf")] * w for i in range(h)]

    # 移動4方向のベクトル
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]

    # スタート地点をキューに入れ、その点の距離を0にする
    que = deque([])
    que.append((sx, sy))
    d[sx][sy] = 0

    # キューが空になるまでループ
    while que:
        # キューの先頭を取り出す
        p = que.popleft()
        # 取り出してきた状態がゴールなら探索をやめる
        if p[0] == gx and p[1] == gy:
            break
        # 移動4方向をループ
        for i in range(4):
            # 移動した後の点を (nx, ny) とする
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]

            # 移動が可能かの判定とすでに訪れたことがあるかの判定
            # d[nx][ny] != INF なら訪れたことがある
            if 0 <= nx < h and 0 <= ny < w and maze[nx][ny] != "#" and d[nx][ny] == float("inf"):
                # 移動できるならキューに入れ、その点の距離を p からの距離 +1 で確定する
                que.append((nx, ny))
                d[nx][ny] = d[p[0]][p[1]] + 1

    return d[gx][gy]

pos_dic = {}
for i in range(h):
    for j in range(w):
        if cand_pos(i,j):
            pos_dic[i] = j
        else:
            continue

ans = 0

if len(pos_dic) == 0:
    ans = h+w-2
elif len(pos_dic) == 1:
    stx,sty = 0,0
    for k,v in pos_dic.items():
        glx, gly = k,v
    ans = bfs(stx, sty, glx, gly)
else:
    for k,v in pos_dic.items():
        stx, sty = k,v
        for kk, vv in pos_dic.items():
            glx, gly = kk, vv
            tmp = bfs(stx, sty, glx, gly)
            ans = min(ans, tmp)
print(ans)

### FIXED CODE ###

from collections import deque

h,w = map(int,input().split())
maze = []

for _ in range(h):
    maze.append(list(input()))

def bfs(initial):
    distance = [[-1] * w for _ in range(h)]
    frontier = deque()
    frontier.append(initial)
    distance[initial[0]][initial[1]] = 0
    while len(frontier):
        current_node = frontier.popleft()
        x,y = current_node
        for i,j in ((1,0),(-1,0),(0,1),(0,-1)):
            new_x, new_y = x+i, y+j
            if 0<=new_x<h and 0<=new_y<w:
                if maze[new_x][new_y] == '.' and distance[new_x][new_y]==-1:
                    distance[new_x][new_y] = distance[x][y] + 1
                    frontier.append((new_x, new_y))
    return distance[x][y]

ans = 0
for i in range(h):
    for j in range(w):
        if (maze[i][j] == "#"):
            continue
        solution = bfs((i,j))
        ans = max(ans,solution)

print(ans)
N , M = map(int,input().split())
 
H = list(map(int,input().split()))
 
A = [0]*M
B = [0]*M
for i in range(M):
  A[i] ,B[i] = map(int,input().split())
 

S=[1]*N

 
for m in range(M)
  if H[A[m]-1] == H[B[m]-1]:
    S[A[m]-1] = 0
    S[B[m]-1] = 0
  elif H[A[m]-1] <= H[B[m]-1]:
    S[A[m]-1] = 0
  elif H[A[m]-1] >= H[B[m]-1]
    S[B[m]-1] = 0

 
print(sum(S))   

### FIXED CODE ###

N , M = map(int,input().split())
 
H = list(map(int,input().split()))
 
A = [0]*M
B = [0]*M
for i in range(M):
  A[i] ,B[i] = map(int,input().split())
 
 
S=[1]*N
 
 
for m in range(M):
  if H[A[m]-1] == H[B[m]-1]:
    S[A[m]-1] = 0
    S[B[m]-1] = 0
  elif H[A[m]-1] <= H[B[m]-1]:
    S[A[m]-1] = 0
  elif H[A[m]-1] >= H[B[m]-1]:
    S[B[m]-1] = 0
 
 
print(sum(S))
import sys
input = lambda: sys.stdin.readline().rstrip() 
import resource

resource.setrlimit(resource.RLIMIT_DATA, (-1, -1))

def combMod(n, r, p):
    fact = [0] * (n+1)
    fact[0] = fact[1] = 1
    factinv = [0] * (n+1)
    factinv[0] = factinv[1] = 1
    inv = [0] * (n+1)
    inv[1] = 1
    for i in range(2, n+1):
        fact[i] = (fact[i-1] * i) % p
        inv[i] = (-inv[p % i] * (p // i)) % p
        factinv[i] = (factinv[i-1] * inv[i]) % p
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    # print(fact)
    # print(factinv)
    return fact[n] * factinv[r] * factinv[n-r] % p

def resolve():
    n, a, b = map(int, input().split())
    mod = 10**9+7
    print((pow(2, n, mod) - 1) - (combMod(n, a, mod) + combMod(n, b, mod)))
    # print(combMod(n, a, mod))
    # print(combMod(n, b, mod))

if __name__ == '__main__':
    resolve()


### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip() 

def combMod(n, r, p):
    numer = 1
    denom = 1
    for i in range(1, r+1):
        numer = numer * (n-r+i) % p
        denom = denom * i % p
    return numer * pow(denom, p-2, p) % p

def resolve():
    n, a, b = map(int, input().split())
    mod = 10**9+7
    print((pow(2, n, mod) - 1 - combMod(n, a, mod) - combMod(n, b, mod)) % mod)

if __name__ == '__main__':
    resolve()
n = int(input())
array = input().split()
l = list(map(int, array))
for i in range(1, n + 1):
    print(l.count(i))


### FIXED CODE ###

import math
r = int(input())
r = r * 2 * math.pi
print(r)
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
a.reverse()
b.sort()
b.reverse()
c.sort()
c.reverse()
ans=[]
if x*y*z<=3000:
  for i in range(x):
    for j in range(y):
      for h in range(z):
        ans.append(a[i]+b[j]+c[h])
  ans.sort()
  ans.reverse()
  for i in range(k):
    print(ans[i])
  exit()
p=0
q=0
r=0
for i in range(k):
  ans.append(a[p]+[q]+[r])
  if p+1<len(a):
    a1=a[p]-a[p+1]
  else:
    a1=10**18
  if q+1<len(b):
    b1=b[q]-b[q+1]
  else:
    b1=10**18
  if r+1<len(c):
    c1=c[r]-c[r+1]
  else:
    c1=10**18
  if a1==min(a1,b1,c1):
    p+=1
  elif b1==min(a1,b1,c1):
    q+=1
  elif c1==min(a1,b1,c1):
    r+=1
for i in range(k):
  print(ans[i])

### FIXED CODE ###

x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=[]
ans2=[]
for i in range(x):
  for j in range(y):
    ans.append(a[i]+b[j])
if len(ans)>=k:
  ans.sort()
  ans.reverse()
  ans=ans[:k]
for i in range(len(ans)):
  for j in range(z):
    ans2.append(ans[i]+c[j])
ans2.sort()
ans2.reverse()
for i in range(k):
  print(ans2[i])
import re
output ="NO"
s = re.sub('dreamer', '', s)
s = re.sub('dream', '', s)
s = re.sub('eraser', '', s)
s = re.sub('erase', '', s)
if s == "":
    output = "YES"
print(output)

### FIXED CODE ###

s = input()

import re
output ="NO"
s = re.sub('eraser', '', s)
s = re.sub('erase', '', s)
s = re.sub('dreamer', '', s)
s = re.sub('dream', '', s)
if s == "":
    output = "YES"
print(output)
s=str(input())
print(s[0]+int(len(s)-2)+s[-1])

### FIXED CODE ###

s=str(input())
print(s[0]+str(len(s)-2)+s[-1])
S = input()
T = input()
if S == T:
    print("Yes")
    exit()
for i in range(N):
    S = S[-1] + S[0 : len(S) - 1]
    if S == T:
        print("Yes")
        exit()
print("No")


### FIXED CODE ###

S = input()
T = input()
if S == T:
    print("Yes")
    exit()
for i in range(len(S)):
    S = S[-1] + S[0 : len(S) - 1]
    if S == T:
        print("Yes")
        exit()
print("No")
N = int(input())
d = list(map(int, input().split()))

same = N / 2

# d.sort()

# distribution = [0] * d[len(d) - 1]
# total = 0
# for di in d:
#     num = d.count(di)
#     distribution[di - 1] = num

table = {}
for di in d:
    table[di] = 0 if table[di] is None else table[di] += 1

# total = 0
# totals = [0] * d[len(d) - 1]
# num = 0
# for i in range(len(distribution)):
#     total += distribution[i]
#     totals[i] = total

#     if totals[i] == same:
#         num += 1
#     elif num >= 1:
#         break

print(1)


### FIXED CODE ###

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

same = N / 2

# d.sort()

# distribution = [0] * d[len(d) - 1]
# total = 0
# for di in d:
#     num = d.count(di)
#     distribution[di - 1] = num

table = {}
for di in d:
    table[di] = 1 if table.get(di) is None else table.get(di) + 1
table = sorted(table.items())

total = 0
start = 0
end = 0
for difficulty, num in table:
    total += num

    if start == 0 and total == same:
        start = difficulty
    elif start != 0:
        end = difficulty
        break

# print(table, start, end)

answer = end - start
print(answer)
A,B = map(int,input().split)
if A*B > A+B and A*B > A-B : print(A*B)
if A+B > A-B and A+B > A*B : print(A+B)
if A-B > A*B and A-B > A+B : print(A-B)

### FIXED CODE ###

A,B = map(int,input().split())
X = A + B
Y = A - B
Z = A * B
if X >= Y and X >= Z:
     print(X)
elif Y >= Z and Y >= X:
     print(Y)
elif Z >= X and Z >= Y:
     print(Z)
from fractions import gcd
n, m = map(int, input().split())
s = list(input())
t = list(input())
i = 1
ans = n * m // gcd(n, m)

a = [""] * (ans * i)
flag = False
for j in range(n):
    a[ans // n * j] = s[j]
for k in range(m):
    if a[ans // m * k] != "" and a[ans // m * k] != t[k]:
        i += 1
        flag = True
        break
    a[ans // m * k] = t[k]
if flag:
    ans = -1

print(ans)


### FIXED CODE ###

from fractions import gcd
n, m = map(int, input().split())
s = list(input())
t = list(input())
i = 1
ans = n * m // gcd(n, m)
g = gcd(n, m)
for i in range(g):
    if s[i * n // g] != t[i * m // g]:
        ans = -1
        break
print(ans)
import collections
N=int(input())
x=list(map(int,input().split()))
c=collections.Counter(x)
t=[2**i for i in range(len(str(bin(max(x)*2))[2:])+1)[::-1]]
count=0
start=0
x.sort()
for i in range(len(x))[::-1]:
    for j in range(len(t)):
        if t[j] < x[i]:
            break
        if t[j]-x[i] in c.keys():
            if t[j]-x[i] == x[i] and c[x[i]] >= 2:
                c[x[i]] -= 2
                count +=1
            elif c[t[j]-x[i]]>0 and c[x[i]]>0:
                c[t[j]-x[i]] -= 1
                c[x[i]] -= 1
                count+=1
print(count)

### FIXED CODE ###

S=input()
count=0
def sigma(i):
    a=[b for b in range(0,i+1)]
    return sum(a)
place=0
flag=0
start=0
for i in range(len(S)):
    if S[i]=="B":
        flag=1
    elif S[i]=="W":
        if flag == 1:
            count += 1
            place += i - start
        else:
            start+=1
ans=place-sigma(count-1)
print(ans)
print(2/0)

#  random shit  random shit  random shit  random shit  random shit  random shit 

### FIXED CODE ###

inp = input().split(" ")
h = int(inp[0])
w = int(inp[1])

grid = []

for i in range(h):
	grid.append(list(input()))

for i in range(h):
	for j in range(w):
		c = grid[i][j]
		if c == ".":
			total = 0
			adj = []
			if i > 0:
				adj.append(grid[i-1][j])
			if j > 0:
				adj.append(grid[i][j-1])
			if i < h-1:
				adj.append(grid[i+1][j])
			if j < w-1:
				adj.append(grid[i][j+1])
			if i > 0 and j > 0:
				adj.append(grid[i-1][j-1])
			if i > 0 and j < w-1:
				adj.append(grid[i-1][j+1])
			if i < h-1 and j > 0:
				adj.append(grid[i+1][j-1])
			if i < h-1 and j < w-1:
				adj.append(grid[i+1][j+1])
			for k in adj:
				if k == "#":
					total += 1
			grid[i][j] = str(total)

for i in grid:
	print("".join(i))
N,K = list(map(int, input().split()))
A = list(map(int, input().split()))

from itertools import accumulate
    
for _ in range(K):
	ans=[0]*(N+1)
    for i,a in enumerate(A):
        ans[max(0,i-a)]+=1
        ans[min(i+a+1,N)]-=1
    A = list(accumulate(ans))[:-1]
    if all(i == N for i in A):
        break
print(*A)

### FIXED CODE ###

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

from itertools import accumulate

if N-min(A) <= K:
    print(*[N]*N)
    exit()
    
ans=[0]*(N+1)
for _ in range(K):
    for i,a in enumerate(A):
        ans[max(0,i-a)]+=1
        ans[min(i+a+1,N)]-=1
    A = list(accumulate(ans))[:-1]
    ans=[0]*(N+1)
    if all(i == N for i in A):
        break
print(*A)
a,b,c = raw_input().split()

A = {a:1,b:1,c:1}
print len(A)


### FIXED CODE ###

a,b,c = raw_input().split()
a=int(a)
b=int(b)
c=int(c)
A = {a:1,b:1,c:1}

print len(A)
import bisect

x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()
p = list(map(int, input().split()))
tmp = []

for i in range(1, 101):
    if i not in p:
        tmp.append((abs(i - x), i))

print(min(tmp)[1])

### FIXED CODE ###

x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()
p = list(map(int, input().split()))
tmp = []

for i in range(-1, 103):
    if i not in p:
        tmp.append((abs(i - x), i))

print(min(tmp)[1])
n = int(input())
g = [[] for i in range(n+1)]
d = {}
l = [-1] * (n-1)
max_idx = 0
for i in range(n-1):
  u,v = map(int, input().split())
  d[(u,v)] = i
  g[u].append((u,v))
  g[v].append((v,u))
  if len(g[max_idx]) < len(g[u]):
    max_idx = u
  if len(g[max_idx]) < len(g[v]):
    max_idx = v
m = len(g[max_idx])
stack = []
while len(g[1]) > 0:
  stack.append(g[1].pop())
while len(stack) > 0:
  u, v = stack.pop()
  if len(g[v]) > 0:
    count = m
    while len(g[v]) > 0:
      u2, v2 = g[v].pop()
      if count == l[d[(u, v)]]:
        count -= 1
      l[d[(u2, v2)]] = count
      count -= 1
      stack.append((u2, v2))
print(m)
for i in range(n-1):
  print(l[i])
  

### FIXED CODE ###

n = int(input())
g = [[] for i in range(n+1)]
d = {}
l = [-1] * (n-1)
max_idx = 0
for i in range(n-1):
  u,v = map(int, input().split())
  d[(u,v)] = i
  d[(v,u)] = i
  g[u].append((u,v))
  g[v].append((v,u))
  if len(g[max_idx]) < len(g[u]):
    max_idx = u
  if len(g[max_idx]) < len(g[v]):
    max_idx = v
m = len(g[max_idx])
stack = []
count = m
while len(g[1]) > 0:
  u2, v2 = g[1].pop()
  l[d[(u2, v2)]] = count
  count -= 1
  stack.append((u2, v2))

while len(stack) > 0:
  u, v = stack.pop()
  #print(u,v)
  if len(g[v]) > 0:
    count = m
    while len(g[v]) > 0:
      u2, v2 = g[v].pop()
      if count == l[d[(u, v)]]:
        count -= 1
      if l[d[(u2, v2)]] == -1:
        l[d[(u2, v2)]] = count
        count -= 1
        stack.append((u2, v2))
print(m)
for i in range(n-1):
  print(l[i])
data = input().split(" ")
A = input().split(" ")
B = input().split(" ")
total = 0
a = 0
b = 0
j = 0
for i in data:
    data[j] = int(i)
    j += 1
j = 0
for i in A:
    A[j] = int(i)
    j += 1
j = 0
for i in B:
    B[j] = int(i)
    j += 1


for i in range(data[2]):
    data1 = input().split()
    j = 0
    for i in data1:
        data1[j] = int(i)
        j += 1
    data2 = A[data1[0]] + B[data[1]] - data1[2]
    if total > data2:
        total = data2

for i in A:
    if a > i:
        a = i
for i in B:
    if b > i:
        b = i

if total > a+b:
    total = a+b

print(total)

### FIXED CODE ###

data = input().split(" ")
A = input().split(" ")
B = input().split(" ")
total = 1000000
a = 1000000
b = 1000000
j = 0
for i in data:
    data[j] = int(i)
    j += 1
j = 0
for i in A:
    A[j] = int(i)
    j += 1
j = 0
for i in B:
    B[j] = int(i)
    j += 1


for i in range(data[2]):
    data1 = input().split()
    j = 0
    for i in data1:
        data1[j] = int(i)
        j += 1
    data2 = A[data1[0]-1] + B[data1[1]-1] - data1[2]
    if total > data2:
        total = data2

for i in A:
    if a > i:
        a = i
for i in B:
    if b > i:
        b = i

if total > a+b:
    total = a+b

print(total)
_,b,_,d = map(int,input().split())
print(int(b*d)

### FIXED CODE ###

a,b,c,d = map(int,input().split())
print(int(max(a*c,a*d,b*c,b*d)))
n,w=map(int,input().split())
print(nw(nw-1) /2)

### FIXED CODE ###

n,w=map(int,input().split())
print((n*(n-1)//2)+(w*(w-1)//2))
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
ps=sorted(p,reverse=True)
qs=sorted(q,reverse=True)
rs=sorted(r,reverse=True)
pn=ps[:x]
qn=qs[:y]
mp=pn[-1]
mq=qn[-1]
s=0
t=0
for i in range(max(x,y)):
  if mp>rs[i] and mq>rs[i]:
    break
  elif mp<=mq<=rs[i]:
    s+=1
    pn.pop(-s)
    pn.append(rs[i])
    if pn[-s-1]<rs[i]:
      mp=pn[-s-1]
    else:
      mp=rs[i]
      s=s-1
  elif mq<mp<=rs[i]:
    t+=1
    qn.pop(-t)
    qn.append(rs[i])
    if qn[-t-1]<rs[i]:
      mq=qn[-t-1]
    else:
      mq=rs[i]
      t=t-1
print(sum(pn)+sum(qn))

### FIXED CODE ###

x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
ps=sorted(p,reverse=True)
qs=sorted(q,reverse=True)
pn=ps[:x]
qn=qs[:y]
nl=sorted(pn+qn+r,reverse=True)
print(sum(nl[:x+y]))
N = input()
l = [int(x) for x in input().rstrip().split()]
_max = 0
_min = l[0]
for t in l:
  if _max < t:
    _max = t
  if _min > t:
    _min = t  
return _max - _min

### FIXED CODE ###

N = input()
string_list = input().rstrip().split()
l = [int(x) for x in string_list]
_max = 0
_min = l[0]
for t in l:
  if _max < t:
    _max = t
  if _min > t:
    _min = t  
print(_max - _min)
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, C, D = MAP()
print(min([A, B]) + min([C, D]))


### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a,b)+min(c,d))
n=int(input())
l=[int(i) for i in range(n)]
ans=chk=p=0
w=[]
for i in range(n):
    x,y=map(int,input().split())
    w.append((x,y))
for i in list(itertools.permutations(l,n)):
    chk=0
    for j in range(n-1):
        chk+=((w[i[j]][0]-w[i[j+1]][0])**2+(w[i[j]][1]-w[i[j+1]][1])**2)**0.5
    ans+=chk
    p+=1

print(ans/p)

### FIXED CODE ###

import itertools
def sol():
    n=int(input())
    d=list(itertools.permutations([i for i in range(n)]))
    w=[]
    for i in range(n):
        x,y=map(int,input().split())
        w.append((x,y))
    ans=chk=0
    for i in d:
        for j in range(len(i)-1):
            ans+=((w[i[j]][0]-w[i[j+1]][0])**2+(w[i[j]][1]-w[i[j+1]][1])**2)**0.5
    print(ans/len(d))

if __name__=="__main__":
    sol()
num = int(input())
List = input().split(" ")
height = [int(n) for n in List]
dp = [{} for n in range(10000)]
def jump(a,cost,now):
  print(cost)
  if cost in dp[a]:
    return dp[a][cost]
  elif a-1 == num:
	res = 0
  elif a+2 < num:
    res = min(jump(a+1,cost+abs(now-height[a+1]),height[a+1]),jump(a+2,cost+abs(now-height[a+2]),height[a+2]))
  else:
    res = jump(a+1,cost+abs(now-height[a+1]),height[a+1])
  dp[a][cost] = res
  return res
print(jump(1,0,height[0]))

### FIXED CODE ###

num = int(input())
List = input().split(" ")
height = [int(n) for n in List]
dp = [0 for n in range(10 ** 5 * 2)]
a = 0
while dp[num-1] == 0:
  a+= 1
  if a == num:
    break
  if a == 1:
    dp[a] = abs(height[a]-height[a-1])
  else:
    dp[a] = min(abs(height[a]-height[a-1])+dp[a-1],abs(height[a]-height[a-2])+dp[a-2])
print(dp[num-1])
N,K = map(int,input().split())
A = list(map(int,input().split()))
ans = []
for i,num in enumerate(A):
    for j in range(i+1,N):
        ans.append(num * A[j])
ans.sort()
print(ans[K-1])

### FIXED CODE ###

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

if A == B:
    if A == C:
        print('No')
    else:print('Yes')
elif A == C:
    print('Yes')
elif B == C:
    print('Yes')
else: print('No')
def main():
    n, x, m = map(int, input().split())
    mflg = [0] + [-1] * (m-1)
    ltot = [x]

    tot = x
    a = x
    for i in range(1, n):
        a = a ** 2 % m
        if mflg[a-1] >= 0:
            z = (n - i) // (i - mflg[a-1]) - 1
            y = (n - j) % (i - mflg[a-1])
            tot += (ltot[mflg[a-1] - 1 + y] - ltot[mflg[a-1] - 1]) + (ltot[-1] - ltot[mflg[a-1] - 1]) * z
            break
        
        mflg[a-1] = i
        tot += a
        ltot.append(tot)

    print(tot)


main()



### FIXED CODE ###



def main():
    n, x, m = map(int, input().split())
    mflg = [-1] * m
    mflg[x] = 0
    ltot = [x]

    tot = x
    a = x
    for i in range(1, n):
        a = a ** 2 % m

        if mflg[a] >= 0:
            b = mflg[a]
            z = (n - i) // (i - b)
            y = (n - i) % (i - b)
            if b == 0 and y == 0:
                tot += ltot[i - 1] * z
            elif b == 0:
                tot += ltot[b - 1 + y] + ltot[i - 1] * z
            else:
                tot += (ltot[b - 1 + y] - ltot[b - 1]) + (ltot[i - 1] - ltot[b - 1]) * z
            break

        mflg[a] = i
        tot += a
        ltot.append(tot)

    print(tot)


main()