AtCoder Beginner Contest 156 - Bouquet

Akari has n kinds of flowers, one of each kind.
She is going to choose one or more of these flowers to make a bouquet.
However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b.
How many different bouquets are there that Akari can make?
Find the count modulo (10^9 + 7).
Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.

-----Constraints-----
 - All values in input are integers.
 - 2 \leq n \leq 10^9
 - 1 \leq a < b \leq \textrm{min}(n, 2 \times 10^5)

-----Input-----
Input is given from Standard Input in the following format:
n a b

-----Output-----
Print the number of bouquets that Akari can make, modulo (10^9 + 7). (If there are no such bouquets, print 0.)

-----Sample Input-----
4 1 3

-----Sample Output-----
7

In this case, Akari can choose 2 or 4 flowers to make the bouquet.
There are 6 ways to choose 2 out of the 4 flowers, and 1 way to choose 4, so there are a total of 7 different bouquets that Akari can make.

Source: atcoder | Difficulty: MEDIUM


Solutions:
M = 10 ** 9 + 7

def comb(n, k):
	a = b = 1
	for i in range(1, k + 1):
		a = a * n % M
		b = b * i % M
		n -= 1
	return a * pow(b, M - 2, M)
(n, a, b) = map(int, input().split())
print((pow(2, n, M) - 1 - comb(n, a) - comb(n, b)) % M)


def combination(n, r, mod=10 ** 9 + 7):
	(n1, r) = (n + 1, min(r, n - r))
	numer = denom = 1
	for i in range(1, r + 1):
		numer = numer * (n1 - i) % mod
		denom = denom * i % mod
	return numer * pow(denom, mod - 2, mod) % mod
mod = 10 ** 9 + 7
(N, A, B) = list(map(int, input().split()))
ans = pow(2, N, mod) - 1 - combination(N, A) - combination(N, B)
ans %= mod
print(ans)


from functools import reduce
(n, a, b) = map(int, input().split())

def nCr(N, R, DIV):
	f = lambda x, y: x * y % DIV
	X = reduce(f, range(N - R + 1, N + 1))
	Y = reduce(f, range(1, R + 1))
	return X * pow(Y, DIV - 2, DIV) % DIV
DIV = 10 ** 9 + 7
ans = pow(2, n, DIV) - 1
ans -= nCr(n, a, DIV)
ans -= nCr(n, b, DIV)
print(ans % DIV)


M = 10 ** 9 + 7
(n, a, b) = map(int, input().split())
r = pow(2, n, M) - 1
f = c = 1
l = iter((a, b))
for i in range(b):
	f = f * (i + 1) % M
	c = c * (n - i) % M
	if i + 1 == a:
		a = b
		r -= c * pow(f, M - 2, M)
print(r % M)


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

def modinv(x, mod):
	return pow(x, mod - 2, mod)
modinv_table = [-1] * (b + 1)
for i in range(1, b + 1):
	modinv_table[i] = modinv(i, MOD)

def comb(n, k, mod):
	ans = 1
	for i in range(k):
		ans *= n - i
		ans *= modinv_table[i + 1]
		ans %= mod
	return ans
ans = (pow(2, n, MOD) - comb(n, a, MOD) - comb(n, b, MOD)) % MOD - 1
print(ans)


(n, a, b) = [int(k) for k in input().strip().split(' ')]
mod = 10 ** 9 + 7
tp = pow(2, n, mod) - 1
tpa = 1
tpb = 1
while a:
	a -= 1
	tpa *= (n - a) * pow(a + 1, mod - 2, mod)
	tpa %= mod
while b:
	b -= 1
	tpb *= (n - b) * pow(b + 1, mod - 2, mod)
	tpb %= mod
res = (tp - tpa - tpb) % mod
print(res)


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

def cmb(n, k):
	(x, y) = (1, 1)
	for i in range(k):
		x = x * (n - i) % mod
		y = y * (k - i) % mod
	return x * pow(y, mod - 2, mod) % mod
mod = 10 ** 9 + 7
All = pow(2, n, mod) - 1
ac = cmb(n, a)
bc = cmb(n, b)
ans = (All - ac - bc) % mod
print(ans)


(n, a, b) = list(map(int, input().split()))
p = 10 ** 9 + 7
all_ = pow(2, n, p)
C_ = [1] * (b + 10)
for i in range(1, b + 1):
	C_[i] = C_[i - 1] * (n - i + 1) % p * pow(i, p - 2, p) % p
ans = (all_ - C_[a] - C_[b]) % p
print(ans - 1)


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

def cmb(n, r):
	x = 1
	y = 1
	for i in range(r):
		x *= n - i
		x %= M
		y *= i + 1
		y %= M
	return x * pow(y, M - 2, M) % M
print((pow(2, n, M) - cmb(n, a) - cmb(n, b) - 1) % M)


def calc_pow(x, y):
	if y == 0:
		return 1
	else:
		ans = calc_pow(x, y // 2) ** 2
		if y % 2:
			ans *= x
		return ans % 1000000007

def calc_combination(n, r, p):
	fact = 1
	factinv = 1
	r = min(r, n - r)
	for i in range(r):
		fact = fact * (n - i) % p
		factinv = factinv * (i + 1) % p
	ans = fact * calc_pow(factinv, p - 2) % p
	return ans
(n, a, b) = list(map(int, input().split()))
p = 10 ** 9 + 7
ans = (calc_pow(2, n) - calc_combination(n, a, p) - calc_combination(n, b, p) - 1) % p
print(ans)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, n, mod) - 1
(nca, ncb) = (1, 1)
for i in range(b):
	ncb = ncb * (n - i) % mod
	ncb *= pow(i + 1, mod - 2, mod)
	if i + 1 == a:
		nca = ncb
print((ans - (nca + ncb)) % mod)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
total = pow(2, n, mod) - 1

def c(n, r):
	(p, q) = (1, 1)
	for i in range(r):
		p = p * (n - i) % mod
		q = q * (i + 1) % mod
	return p * pow(q, mod - 2, mod) % mod
print((total - c(n, a) - c(n, b)) % mod)


import math
(n, c, d) = map(int, input().split())
mod = pow(10, 9) + 7

def comb(n, k):
	x = 1
	y = 1
	for i in range(1, k + 1):
		x *= n + 1 - i
		x %= mod
		y *= i
		y %= mod
	return x * pow(y, mod - 2, mod)
ans = (pow(2, n, mod) - 1 - comb(n, c) - comb(n, d)) % mod
print(ans)


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

def nCr(n, r):
	r = min(r, n - r)
	(num, den) = (1, 1)
	for i in range(r):
		num = num * (n - i) % mod
		den = den * pow(i + 1, mod - 2, mod) % mod
	return num * den % mod
mod = 10 ** 9 + 7
print((pow(2, n, mod) - nCr(n, a) - nCr(n, b) - 1) % mod)


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

def comb(n, r):
	P = 1
	R = 1
	for i in range(r):
		P = P * (n - i) % mod
		R = R * (r - i) % mod
	return P * pow(R, mod - 2, mod) % mod
combN = pow(2, n, mod) - 1
print((combN - comb(n, a) - comb(n, b)) % mod)


(N, A, B) = map(int, input().split())
P = 10 ** 9 + 7

def C(n, k):
	a = 1
	b = 1
	for i in range(k):
		a = a * (n - i) % P
		b = b * (i + 1) % P
	return a * pow(b, P - 2, P) % P
print((pow(2, N, P) - 1 - C(N, A) - C(N, B)) % P)


(N, A, B) = map(int, input().split())
p = 10 ** 9 + 7

def cmb(n, k):
	(x, y) = (1, 1)
	for i in range(k):
		x = x * (n - i) % p
		y = y * (i + 1) % p
	return x * pow(y, p - 2, p) % p
print((pow(2, N, p) - cmb(N, A) - cmb(N, B) - 1) % p)


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

def cmb(n, r, m):
	X = Y = 1
	r = min(r, n - r)
	for i in range(1, r + 1):
		Y = Y * i % m
		X = X * (n - i + 1) % m
	Y = pow(Y, m - 2, m)
	return X * Y
print((pow(2, n, m) - 1 - cmb(n, a, m) - cmb(n, b, m)) % m)


import sys
from collections import deque, defaultdict, namedtuple
import heapq
from math import sqrt, factorial, gcd, ceil, atan, pi

def input():
	return sys.stdin.readline()[:-1]
import string
import operator
import random
from bisect import bisect_left, bisect_right
from functools import lru_cache, reduce
MOD = int(1000000000.0) + 7
INF = float('inf')

def print_lines(data):
	sys.stdout.write('\n'.join((str(x) for x in data)))

def solve():
	(N, a, b) = [int(x) for x in input().split()]

	def prod(a, b):
		ans = 1
		for x in range(a, b + 1):
			ans *= x
			ans %= MOD
		return ans

	def fact(x):
		ans = 1
		while x:
			ans *= x
			ans %= MOD
			x -= 1
		return ans

	def coef(n, k):
		if k > n:
			return 0
		return prod(n - k + 1, n) * pow(fact(k) % MOD, MOD - 2, MOD) % MOD
	print((MOD + pow(2, N, MOD) - 1 - coef(N, a) - coef(N, b)) % MOD)
T = 1
for case in range(1, T + 1):
	ans = solve()


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

def combination(n, r, mod=10 ** 9 + 7):
	r = min(r, n - r)
	res = 1
	for i in range(r):
		res = res * (n - i) * pow(i + 1, mod - 2, mod) % mod
	return res
print((pow(2, n, lim) - combination(n, a) - combination(n, b) - 1) % lim)


def ncr(n, r, p):
	num = 1
	den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
(n, a, b) = list(map(int, input().split()))
m = 1000000007
print((pow(2, n, m) - 1 - ncr(n, a, m) - ncr(n, b, m)) % m)


(N, A, B) = map(int, input().split())
M = 10 ** 9 + 7

def cmb(N, R, M):
	C = [1] * (R + 1)
	for i in range(1, R + 1):
		C[i] = C[i - 1] * (N + 1 - i) * pow(i, M - 2, M) % M
	return C
C = cmb(N, B, M)
ans = pow(2, N, M) - 1
ans -= C[A] + C[B]
print(ans % M)


def cmb(n, r, mod):
	c = 1
	for i in range(1, r + 1):
		c = c * (n - i + 1) * pow(i, mod - 2, mod) % mod
	return c
(n, a, b) = map(int, input().split())
MOD = 10 ** 9 + 7
print((pow(2, n, MOD) - cmb(n, a, MOD) - cmb(n, b, MOD) - 1) % MOD)


def MI():
	return map(int, input().split())
MOD = 10 ** 9 + 7

def nCr(n, k):
	tmp = 1
	for i in range(n - k + 1, n + 1):
		tmp *= i
		tmp %= MOD
	for i in range(1, k + 1):
		tmp *= pow(i, MOD - 2, MOD)
		tmp %= MOD
	return tmp
(N, A, B) = MI()
ans = pow(2, N, MOD) - 1 - nCr(N, A) - nCr(N, B)
print(ans % MOD)


mod = 1000000007

def mod_cmb(n: int, k: int, p: int) -> int:
	if n < 0 or k < 0 or n < k:
		return 0
	if n == 0 or k == 0:
		return 1
	if k > n - k:
		return mod_cmb(n, n - k, p)
	c = d = 1
	for i in range(k):
		c *= n - i
		d *= k - i
		c %= p
		d %= p
	return c * pow(d, -1, p) % p

def main():
	(n, a, b) = list(map(int, input().split()))
	ans = pow(2, n, mod) - 1
	tmp_a = mod_cmb(n, a, mod)
	tmp_b = mod_cmb(n, b, mod)
	print((ans - tmp_a - tmp_b) % mod)

def __starting_point():
	main()
__starting_point()


mod = 10 ** 9 + 7

def cmb(n, r):
	(p, q) = (1, 1)
	for i in range(r):
		p = p * (n - i) % mod
		q = q * (i + 1) % mod
	return p * pow(q, mod - 2, mod) % mod
(n, a, b) = list(map(int, input().split()))
ans = pow(2, n, mod) - 1
ans -= cmb(n, a)
ans -= cmb(n, b)
print(ans % mod)


def Li():
	return list(map(int, input().split()))
(n, a, b) = Li()
mod = pow(10, 9) + 7
bunshi = 1
bunbo = 1
ans = pow(2, n, mod) - 1
for i in range(a):
	bunshi = bunshi * (n - i) % mod
	bunbo = bunbo * (i + 1) % mod
ans = (ans - bunshi * pow(bunbo, -1, mod)) % mod
for i in range(a, b):
	bunshi = bunshi * (n - i) % mod
	bunbo = bunbo * (i + 1) % mod
ans = (ans - bunshi * pow(bunbo, -1, mod)) % mod
print(ans)


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

def cmb2(n, r, mod):
	res = 1
	temp = 1
	for k in range(1, r + 1):
		res *= n - k + 1
		temp *= k
		res %= mod
		temp %= mod
	res *= pow(temp, mod - 2, mod)
	res %= mod
	return res

def power(a, n, mod):
	bi = str(format(n, 'b'))
	res = 1
	for i in range(len(bi)):
		res = res * res % mod
		if bi[i] == '1':
			res = res * a % mod
	return res
ans = power(2, n, mod) - cmb2(n, a, mod) - cmb2(n, b, mod) - 1
ans %= mod
print(ans)


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

def nCr(n, r):
	r = min(r, n - r)
	if r == 0:
		return 1
	num = functools.reduce(lambda x, y: x * y % mod, list(range(n, n - r, -1)))
	den = functools.reduce(lambda x, y: x * y % mod, [pow(x, mod - 2, mod) for x in range(1, r + 1)])
	return num * den % mod
mod = 10 ** 9 + 7
print((pow(2, n, mod) - nCr(n, a) - nCr(n, b) - 1) % mod)


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

def comb(k):
	m = 1
	c = 1
	for i in range(k):
		m = m * (n - i) % mod
		c = c * (i + 1) % mod
	return m * pow(c, mod - 2, mod) % mod
print((pow(2, n, mod) - 1 - comb(a) - comb(b)) % mod)


def solve():

	def combis(n, k, mod):
		from math import factorial
		numerator = 1
		denominator = 1
		for i in range(k):
			numerator = numerator * (n - i) % mod
			denominator = denominator * (i + 1) % mod
		return numerator * pow(denominator, mod - 2, mod) % mod
	(n, a, b) = [int(i) for i in input().split()]
	mod = 10 ** 9 + 7
	ans = pow(2, n, mod) - 1 - combis(n, a, mod) - combis(n, b, mod)
	print(ans % mod)

def __starting_point():
	solve()
__starting_point()


M = 10 ** 9 + 7
(n, a, b) = map(int, input().split())
s = r = 1
for i in range(b):
	r = r * (n - i) * pow(i + 1, M - 2, M) % M
	s += r * (i + 1 in (a, b))
print((pow(2, n, M) - s) % M)


import math
z = 10 ** 9 + 7
(n, a, b) = [int(i) for i in input().split()]
r = pow(2, n, z) - 1

def c(m):
	x = 1
	for i in range(n - m + 1, n + 1):
		x = x * i % z
	return x * pow(math.factorial(m), z - 2, z) % z
r = (r - c(a) - c(b)) % z
print(r)


from functools import reduce
from operator import mul
mod = 10 ** 9 + 7

def cmb(n, r):
	r = min(n - r, r)
	if r == 0:
		return 1
	over = reduce(lambda a, b: a * b % mod, list(range(n, n - r, -1)))
	under = reduce(lambda a, b: a * b % mod, list(range(1, r + 1)))
	return over * pow(under, mod - 2, mod)
(n, a, b) = list(map(int, input().split()))
print((pow(2, n, mod) - 1 - cmb(n, a) - cmb(n, b)) % mod)


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

def com(n, k, m):
	(p, q) = (1, 1)
	for i in range(n - k + 1, n + 1):
		p *= i
		p %= m
	for i in range(1, k + 1):
		q *= i
		q %= m
	return p * pow(q, m - 2, m) % m
(ca, cb) = (com(n, a, m), com(n, b, m))
ans = (pow(2, n, m) - 1 - ca - cb) % m
print(ans)


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

def comb(N, x):
	numerator = 1
	for i in range(N - x + 1, N + 1):
		numerator = numerator * i % mod
	denominator = 1
	for j in range(1, x + 1):
		denominator = denominator * j % mod
	d = pow(denominator, mod - 2, mod)
	return numerator * d % mod
a = comb(n, a)
b = comb(n, b)
print((pow(2, n, mod) - 1 - a - b) % mod)


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

def nCk(n, k):
	a = 1
	for i in range(n, n - k, -1):
		a *= i
		a %= mod
	b = 1
	for i in range(1, k + 1):
		b *= i
		b %= mod
	a *= pow(b, mod - 2, mod)
	return a
ans = pow(2, n, mod) - 1
ans -= nCk(n, a) + nCk(n, b)
print(ans % mod)


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

def modinv(a):
	return pow(a, mod - 2, mod)

def comb(n, r):
	r = min(r, n - r)
	res = 1
	for i in range(r):
		res = res * (n - i) * modinv(i + 1) % mod
	return res
t = pow(2, n, mod) - 1
t = (t - comb(n, a) - comb(n, b)) % mod
print(t)


mod = 10 ** 9 + 7

def cmb(x, y):
	ret = 1
	for i in range(1, y + 1):
		ret = ret * (x + 1 - i) % mod
		ret = ret * pow(i, mod - 2, mod) % mod
	return ret
(n, a, b) = map(int, input().split())
ans = (pow(2, n, mod) - 1 - cmb(n, a) - cmb(n, b)) % mod
print(ans)


from math import factorial
M = 10 ** 9 + 7
(n, a, b) = map(int, input().split())
r = pow(2, n, M) - 1
c = 1
for i in range(b):
	c = c * (n - i) % M
	if i + 1 == a:
		r -= c * pow(factorial(a) % M, M - 2, M)
		a = b
print(r % M)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, n, mod) - 1
a = min(a, n - a)
b = min(b, n - b)
c = min(a, b)
wk = 1
for i in range(1, c + 1):
	wk = wk * (n + 1 - i) * pow(i, mod - 2, mod) % mod
ans -= wk
for i in range(c + 1, max(a, b) + 1):
	wk = wk * (n + 1 - i) * pow(i, mod - 2, mod) % mod
ans -= wk
print(ans % mod)


(n, *a) = map(int, open(0).read().split())
k = 1000000007
c = (1 << n) % k - 1
for l in a:
	X = Y = j = Z = 1
	d = k - 2
	for i in range(l):
		X = X * (n - i) % k
	while j <= l:
		Y = Y * j % k
		j += 1
	while d > 0:
		Z = Z * Y % k if d & 1 == 1 else Z
		Y = Y * Y % k
		d >>= 1
	c -= X * Z % k
print(c % k)


mod = 10 ** 9 + 7
(n, a, b) = list(map(int, input().split()))
ans = pow(2, n, mod) - 1
comb1 = 1
for i in range(n - a + 1, n + 1):
	comb1 *= i
	comb1 %= mod
for i in range(1, a + 1):
	comb1 *= pow(i, mod - 2, mod)
	comb1 %= mod
comb2 = 1
for i in range(n - b + 1, n + 1):
	comb2 *= i
	comb2 %= mod
for i in range(1, b + 1):
	comb2 *= pow(i, mod - 2, mod)
	comb2 %= mod
ans -= comb1 + comb2
ans %= mod
print(ans)


(n, a, b) = list(map(int, input().split()))
if a > b:
	(a, b) = (b, a)
mod = 10 ** 9 + 7
tmp = 1
C = n
ans = 0
if a == 1:
	Ca = n
for r in range(1, n + 1):
	C = C * (n - r) % mod * pow(r + 1, mod - 2, mod) % mod
	if r == a - 1:
		Ca = C
	if r == b - 1:
		Cb = C
		break
print((pow(2, n, mod) - Ca - Cb - 1) % mod)


(n, a, b) = list(map(int, input().split()))
mod = 1000000007
c = [1] * (b + 1)

def com(n, b):
	for i in range(1, b + 1):
		c[i] = c[i - 1] * ((n - i + 1) * pow(i, mod - 2, mod)) % mod
com(n, b)
ans = (pow(2, n, mod) - c[a] - c[b] - 1) % mod
print(ans)


p = 7 + 10 ** 9

def comb(n, r):
	bunshi = 1
	for i in range(n - r + 1, n + 1):
		bunshi = bunshi * i % p
	bunbo = 1
	for i in range(1, r + 1):
		bunbo = bunbo * i % p
	return bunshi * pow(bunbo, p - 2, p)
(n, a, b) = map(int, input().split())
s = -1 + pow(2, n, p) - comb(n, a) - comb(n, b)
print(s % p)


import sys
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.141592653589793

def read_str():
	return sys.stdin.readline().strip()

def read_int():
	return int(sys.stdin.readline().strip())

def read_ints():
	return map(int, sys.stdin.readline().strip().split())

def read_ints2(x):
	return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())

def read_str_list():
	return list(sys.stdin.readline().strip().split())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def GCD(a: int, b: int) -> int:
	return b if a % b == 0 else GCD(b, a % b)

def LCM(a: int, b: int) -> int:
	return a * b // GCD(a, b)

def nCr(n, r):
	(a, b) = (1, 1)
	for i in range(r):
		a = a * (n - i) % MOD
		b = b * (i + 1) % MOD
	return a * pow(b, MOD - 2, MOD) % MOD

def Main():
	(n, a, b) = read_ints()
	num = pow(2, n, MOD) - 1
	print((num - nCr(n, a) - nCr(n, b)) % MOD)

def __starting_point():
	Main()
__starting_point()


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

def nck(k):
	(y, z) = (1, 1)
	for i in range(1, k + 1):
		y = y * (n + 1 - i) % mod
		z = z * pow(i, mod - 2, mod) % mod
	return y * z % mod
ans = (pow(2, n, mod) - 1 - nck(a) - nck(b)) % mod
print(ans)


(n, a, b) = map(int, input().split())
k = 10 ** 9 + 7
c = (1 << n) % k - 1
X = Y = 1
for i in range(b):
	X = X * (n - i) % k
	Y = Y * (i + 1) % k
	if i + 1 in (a, b):
		c -= X * pow(Y, k - 2, k)
print(c % k)


(N, a, b) = map(int, input().split())
mod = 10 ** 9 + 7

def cmb(N, K):
	r = 1
	for i in range(K):
		r = r * (N - i) * pow(i + 1, mod - 2, mod) % mod
	return r
ans = ((pow(2, N, mod) - 1) % mod - cmb(N, a) - cmb(N, b)) % mod
print(ans)


def main():
	(n, a, b) = map(int, input().split())
	mod = 10 ** 9 + 7
	s = pow(2, n, mod) - 1
	x = 1
	y = 1
	for i in range(1, b + 1):
		x = x * (n - i + 1) % mod
		y = y * i % mod
		if i == a or i == b:
			s -= x * pow(y, mod - 2, mod)
	print(s % mod)
main()


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
a = min(a, n - a)
b = min(b, n - b)
com = [1] * (max(a, b) + 1)
for i in range(1, len(com)):
	com[i] = com[i - 1] * pow(i, mod - 2, mod) * (n - i + 1) % mod
print((pow(2, n, mod) + mod - 1 - com[a] - com[b]) % mod)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, n, mod) - 1
nCa = 1
nCb = 1
for i in range(b):
	nCb *= n - i
	nCb %= mod
	nCb *= pow(i + 1, mod - 2, mod)
	if i == a - 1:
		nCa = nCb
ans -= nCa
ans %= mod
ans -= nCb
ans %= mod
print(ans)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
maxx = pow(2, n, mod) - 1
res = 0
pat = 1
for i in range(0, n + 1):
	res = pat
	if i == a:
		maxx -= res
	if i == b:
		maxx -= res
		break
	pat *= (n - i) * pow(i + 1, mod - 2, mod)
	pat %= mod
print(maxx % mod)


(N, A, B) = map(int, input().split())
p = 10 ** 9 + 7

def f(n, x):
	(a, b) = (1, 1)
	for i in range(1, x + 1):
		a = a * n % p
		b = b * i % p
		n -= 1
	return a * pow(b, p - 2, p)
print((pow(2, N, p) - 1 - f(N, A) - f(N, B)) % p)


(N, a, b) = map(int, input().split())
MOD = 10 ** 9 + 7

def comb(n, k):
	tmp = 1
	for i in range(n - k + 1, n + 1):
		tmp *= i
		tmp %= MOD
	for i in range(1, k + 1):
		tmp *= pow(i, MOD - 2, MOD)
		tmp %= MOD
	return tmp
ans = pow(2, N, MOD) - 1 - comb(N, a) - comb(N, b)
print(ans % MOD)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
res = pow(2, n, mod) - 1
p = 1
for i in range(n, n - a, -1):
	p = p * i % mod
q = 1
for i in range(n, n - b, -1):
	q = q * i % mod
for i in range(1, a + 1):
	p = p * pow(i, mod - 2, mod) % mod
for i in range(1, b + 1):
	q = q * pow(i, mod - 2, mod) % mod
print((res - p - q) % mod)


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

def combination(n, k):
	if k > n - k:
		k = n - k
	if k == 0:
		return 1
	if k == 1:
		return n
	p = [-1 for i in range(k + 1)]
	kp = {i: [] for i in range(n - k + 1, n + 1)}
	count = [0 for i in range(k + 1)]
	for i in range(2, k + 1):
		if p[i] == -1:
			for j in range(i, k + 1, i):
				if p[j] == -1:
					p[j] = i
			for j in range(((n - k) // i + 1) * i, n + 1, i):
				kp[j].append(i)
	for i in range(2, k + 1):
		j = i
		while p[j] != -1:
			m = p[j]
			while j % m == 0:
				count[m] += 1
				j = j // m
	ans = 1
	for i in kp:
		bufi = i
		for j in kp[i]:
			while count[j] > 0 and bufi % j == 0:
				bufi = bufi // j
				count[j] -= 1
		ans *= bufi
		ans %= M
	return ans
print((pow(2, n, M) - 1 - combination(n, a) - combination(n, b)) % M)


from math import factorial
(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
up = [1]
down = [1]
comb = [1]
for i in range(1, b + 1):
	up.append(up[i - 1] * (n - i + 1) % mod)
	down.append(down[i - 1] * i % mod)
	comb.append(up[i] * pow(down[i], mod - 2, mod) % mod)
print((pow(2, n, mod) - 1 - comb[a] - comb[b]) % mod)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
s = 1
for i in range(a):
	s = s * (n - i) % mod
	s = s * pow(i + 1, mod - 2, mod) % mod
t = 1
for i in range(b):
	t = t * (n - i) % mod
	t = t * pow(i + 1, mod - 2, mod) % mod
print((2 ** n - 1 - s - t) % mod)


(n, a, b) = map(int, input().split())
MOD = 10 ** 9 + 7
ans = pow(2, n, MOD) - 1

def cmb(x, y):
	X = 1
	Y = 1
	for i in range(1, y + 1):
		X = X * (x + 1 - i) % MOD
		Y = Y * i % MOD
	return X * pow(Y, MOD - 2, MOD) % MOD
ans -= cmb(n, a) + cmb(n, b)
ans %= MOD
print(ans)


mod = 10 ** 9 + 7
(l, a, b) = map(int, input().split())

def C(n, k, m):
	g = k
	f = n
	for i in range(1, k):
		n = n * (f - i) % m
		k = k * (g - i) % m
	return n * pow(k, m - 2, m) % m
ans = pow(2, l, mod) - 1
ca = C(l, a, mod)
cb = C(l, b, mod)
print((ans - ca - cb) % mod)


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

def CombMod(n, r):
	(p, q) = (1, 1)
	for i in range(r):
		p = p * (n - i) % MOD
		q = q * (i + 1) % MOD
	return p * pow(q, MOD - 2, MOD) % MOD
print((pow(2, n, MOD) - 1 - (CombMod(n, a) + CombMod(n, b))) % MOD)


(n, a, b) = map(int, input().split())
m = 10 ** 9 + 7
ALL = pow(2, n, m) - 1
x = y = 1
for i in range(b):
	x = x * (i + 1) % m
	y = y * (n - i) % m
	if i + 1 == a:
		a = b
		ALL -= y * pow(x, m - 2, m)
print(ALL % m)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
k = max(a, b)
com = [1]
for i in range(1, k + 1):
	com.append(com[i - 1] * (n - i + 1) * pow(i, mod - 2, mod) % mod)
print((pow(2, n, mod) - 1 - com[a] - com[b]) % mod)


(N, A, B) = [int(_) for _ in input().split()]
mod = 10 ** 9 + 7
c = [1, N]
for i in range(1, B + 1):
	c += [c[-1] * (N - i) * pow(i + 1, mod - 2, mod) % mod]
ans = pow(2, N, mod) - c[A] - c[B] - 1
ans %= mod
print(ans)


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

def genCombinationFunction(max_k, mod):
	modinv_table = [-1] * (max_k + 1)
	modinv_table[1] = 1
	for i in range(2, max_k + 1):
		modinv_table[i] = -modinv_table[mod % i] * (mod // i) % mod

	def binomial_coefficients(n, k):
		ans = 1
		for i in range(k):
			ans *= n - i
			ans *= modinv_table[i + 1]
			ans %= mod
		return ans
	return binomial_coefficients
max_k = 2 * 10 ** 5
mod = 10 ** 9 + 7
f = genCombinationFunction(max_k, mod)
ans = pow(2, n, mod) - 1
ans -= f(n, a)
ans -= f(n, b)
print(ans % mod)


(n, a, b) = map(int, input().split())
M = 10 ** 9 + 7
Answer = pow(2, n, M) - 1
factorial = 1
for i in range(1, a + 1):
	factorial = factorial * (n + 1 - i) * pow(i, M - 2, M) % M
Answer -= factorial % M
factorial = 1
for j in range(1, b + 1):
	factorial = factorial * (n + 1 - j) * pow(j, M - 2, M) % M
Answer -= factorial % M
Answer = Answer % M
print(Answer)


(n, a, b) = map(int, input().split())
MOD = 10 ** 9 + 7
x = 1
y = 1
ans = pow(2, n, MOD) - 1
for i in range(1, b + 1):
	x = x * i % MOD
	y = y * (n - i + 1) % MOD
	if i == a or i == b:
		ans -= y * pow(x, MOD - 2, MOD)
print(ans % MOD)


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

def c(x, r=1):
	for i in range(x):
		r = r * (n - i) * pow(i + 1, m - 2, m) % m
	return r
print((pow(2, n, m) - 1 - c(a) - c(b)) % m)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
M = pow(2, n, mod) - 1

def comb(v):
	ans = 1
	for i in range(1, v + 1):
		ans *= n - i + 1
		ans *= pow(i, mod - 2, mod)
		ans %= mod
	return ans
print((M - comb(a) - comb(b)) % mod)


def main():
	(n, a, b) = list(map(int, input().split()))
	mod = 10 ** 9 + 7

	def cmb(n, r):
		if n - r < r:
			r = n - r
		if r == 0:
			return 1
		if r == 1:
			return n
		numerator = [n - r + k + 1 for k in range(r)]
		denominator = [k + 1 for k in range(r)]
		for p in range(2, r + 1):
			pivot = denominator[p - 1]
			if pivot > 1:
				offset = (n - r) % p
				for k in range(p - 1, r, p):
					numerator[k - offset] /= pivot
					denominator[k] /= pivot
		result = 1
		for k in range(r):
			if numerator[k] > 1:
				result *= int(numerator[k])
				result %= 10 ** 9 + 7
		return result
	print(int(((pow(2, n, mod) - 1) % mod - cmb(n, a) % mod - cmb(n, b) % mod) % mod))
main()


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

def cmb(n, r, mod):
	inv = [0, 1]
	for i in range(2, r + 1):
		inv.append(-inv[mod % i] * (mod // i) % mod)
	cmd = 1
	for i in range(1, min(r, n - r) + 1):
		cmd = cmd * (n - i + 1) * inv[i] % mod
	return cmd
exceptA = cmb(n, a, 10 ** 9 + 7)
exceptB = cmb(n, b, 10 ** 9 + 7)

def modPow(a, n, mod):
	if n == 0:
		return 1
	if n == 1:
		return a % mod
	if n % 2 == 1:
		return a * modPow(a, n - 1, mod) % mod
	t = modPow(a, n / 2, mod)
	return t * t % mod
print((modPow(2, n, 10 ** 9 + 7) - 1 - exceptA - exceptB) % (10 ** 9 + 7))


MOD = 1000000007
(n, a, b) = map(int, input().split())
A = 1
B = 1
for i in range(0, a, 1):
	A = A * (n - i) * pow(a - i, 1000000005, 1000000007) % MOD
for i in range(0, b, 1):
	B = B * (n - i) * pow(b - i, 1000000005, 1000000007) % MOD
print((pow(2, n, MOD) - A % MOD - B % MOD - 1) % MOD)


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

def minus(n, k):
	(x, y) = (1, 1)
	for i in range(k):
		x = x * (n - i) % mod
		y = y * (k - i) % mod
	return x * pow(y, mod - 2, mod) % mod
ans = pow(2, n, mod) - 1 - minus(n, a) - minus(n, b)
while ans < 0:
	ans += mod
print(ans)


def main():
	import sys
	input = lambda : sys.stdin.readline().strip()
	(N, A, B) = map(int, input().split())
	mod = 10 ** 9 + 7

	def cmb(n, r, mod=10 ** 9 + 7):
		r = min(r, n - r)
		res = 1
		for i in range(r):
			res = res * (n - i) * pow(i + 1, mod - 2, mod) % mod
		return res
	ans = pow(2, N, mod) - 1 - cmb(N, A, mod) - cmb(N, B, mod)
	print(ans % mod)

def __starting_point():
	main()
__starting_point()


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

def comb(n, k):
	child = 1
	mother = 1
	for i in range(k):
		child = child * (n - i) % p
		mother = mother * (i + 1) % p
	return child * pow(mother, p - 2, p) % p
ans = pow(2, n, p) - 1 - comb(n, a) - comb(n, b)
print(ans % p)


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

def calc(n, a, m):
	x = 1
	y = 1
	for i in range(a):
		x = x * (n - i) % m
		y = y * (i + 1) % m
	return x * pow(y, m - 2, m) % m
m = 10 ** 9 + 7
x = pow(2, n, m) - 1
print((x - calc(n, a, m) - calc(n, b, m)) % m)


def main():
	import sys
	input = lambda : sys.stdin.readline().strip()
	(N, A, B) = map(int, input().split())
	mod = 10 ** 9 + 7

	def pow(x, y, mod):
		res = 1
		if y > 0:
			res = pow(x, y // 2, mod)
			if y % 2 == 0:
				res = res * res % mod
			else:
				res = res * res % mod * x % mod
		return res

	def cmb(n, r, mod=10 ** 9 + 7):
		c = 1
		m = 1
		r = min(n - r, r)
		for i in range(r):
			c = c * (n - i) % mod
			m = m * (i + 1) % mod
		return c * pow(m, mod - 2, mod) % mod
	ans = pow(2, N, mod) - 1 - cmb(N, A, mod) - cmb(N, B, mod)
	print(ans % mod)

def __starting_point():
	main()
__starting_point()


def comb(n, r, p):
	(num, den) = (1, 1)
	r = min(r, n - r)
	for i in range(1, r + 1):
		num = num * (n - i + 1) % p
		den = den * i % p
	return num * pow(den, p - 2, p) % p
(n, a, b) = list(map(int, input().split()))
MOD = 1000000007
ans = pow(2, n, MOD)
ans %= MOD
ans -= comb(n, a, MOD)
ans %= MOD
ans -= comb(n, b, MOD)
ans %= MOD
ans -= 1
ans %= MOD
print(ans)


def f(x, r, p):
	ans = 1
	for i in range(1, r + 1):
		ans = ans * (x - i + 1) % p
	return ans

def comb(x, r, p):
	r = min(r, x - r)
	return pow(f(r, r, p), p - 2, p) * f(x, r, p) % p
(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
print((pow(2, n, mod) - comb(n, a, mod) - comb(n, b, mod) - 1) % mod)


def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
p = 10 ** 9 + 7
(n, a, b) = map(int, input().split())
bb = ncr(n, a, p) + ncr(n, b, p) + 1
print((pow(2, n, p) - bb % p) % p)


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

def fact(n, p):
	a = 1
	for i in range(1, n + 1):
		a = a * i % p
	return a

def bfact(n, x, p):
	a = 1
	for i in range(n - x + 1, n + 1):
		a = a * i % p
	return a
p = 10 ** 9 + 7
na = bfact(n, a, p) % p
nb = bfact(n, b, p) % p
aa = fact(a, p) % p
bb = fact(b, p) % p
aaa = pow(aa, -1, p)
bbb = pow(bb, -1, p)
ans = pow(2, n, p) - 1
ans -= na * aaa + nb * bbb
print(ans % p)


from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions
sys.setrecursionlimit(10 ** 8)
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
(n, a, b) = inpl()
dl = 1
for i in range(a):
	dl *= n - i
	dl %= mod
for i in range(a):
	dl *= pow(a - i, mod - 2, mod)
	dl %= mod
vv = 1
for i in range(b):
	vv *= n - i
	vv %= mod
for i in range(b):
	vv *= pow(b - i, mod - 2, mod)
	vv %= mod
res = pow(2, n, mod) - dl - vv - 1
print(res % mod)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
x = 1
d = [2]
m = n
for i in range(30):
	if m & 1:
		x *= d[-1]
		x %= mod
	m >>= 1
	d.append(d[-1] ** 2 % mod)
l = n
inverse = [0, 1]
g = [1, 1]
for i in range(2, 4 ** 9):
	if i == a + 1:
		x -= l * g[-1] % mod
	if i == b + 1:
		x -= l * g[-1] % mod
		break
	l *= n - i + 1
	l %= mod
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
	g.append(g[-1] * inverse[-1] % mod)
print((x - 1) % mod)


MOD = 10 ** 9 + 7
(N, a, b) = map(int, input().split())
nCr = 1
A = 1
B = 1
oa = 1
for r in range(b):
	nCr_1 = nCr * ((N - r) * pow(r + 1, MOD - 2, MOD)) % MOD
	nCr_1 %= MOD
	nCr = nCr_1
	if r == a - 1:
		A = nCr_1
	if r == b - 1:
		B = nCr_1
ans = pow(2, N, MOD) - 1 - A - B
print(ans % MOD)


(n, a, b) = map(int, input().split())
c = 10 ** 9 + 7
ans = pow(2, n, c) - 1
nca = 1
ncb = 1
for i in range(a):
	nca *= (n - i) * pow(i + 1, c - 2, c)
	nca %= c
for i in range(b):
	ncb *= (n - i) * pow(i + 1, c - 2, c)
	ncb %= c
ans -= nca + ncb
while ans < 0:
	ans += c
print(ans)


(N, a, b) = map(int, input().split())
MOD = 10 ** 9 + 7

def comb(N, a):
	(x, y) = (1, 1)
	for i in range(a):
		x *= N - i
		x %= MOD
		y *= i + 1
		y %= MOD
	return x * pow(y, MOD - 2, MOD) % MOD
ans = (pow(2, N, MOD) - 1 - comb(N, a) - comb(N, b)) % MOD
print(ans)


def calc_comb(n, r):
	numerator = 1
	for i in range(n - r + 1, n + 1):
		numerator = numerator * i % mod
	denominator = 1
	for i in range(1, r + 1):
		denominator = denominator * i % mod
	return numerator * pow(denominator, mod - 2, mod) % mod
(n, a, b) = list(map(int, input().split()))
mod = 1000000007
print((pow(2, n, mod) - 1 - calc_comb(n, a) - calc_comb(n, b) + mod) % mod)


def modpow(a, n, p):
	if n == 1:
		ans = a % p
	elif n % 2 == 0:
		ans = modpow(a, n // 2, p) ** 2 % p
	else:
		ans = a * modpow(a, n // 2, p) ** 2 % p
	return ans
p = 10 ** 9 + 7
(n, a, b) = [int(x) for x in input().split()]
tot = modpow(2, n, p)
(Xa, Ya) = (1, 1)
for i in range(a):
	Xa = Xa * (n - i) % p
	Ya = Ya * (i + 1) % p
Za = modpow(Ya, p - 2, p)
nCa = Xa * Za % p
(Xb, Yb) = (1, 1)
for i in range(b):
	Xb = Xb * (n - i) % p
	Yb = Yb * (i + 1) % p
Zb = modpow(Yb, p - 2, p)
nCb = Xb * Zb % p
ans = (tot - nCa - nCb - 1) % p
print(ans)


def modinv(a, m):
	return pow(a, m - 2, m)
(n, a, b) = map(int, input().split())
P = 10 ** 9 + 7
nCa = 1
for i in range(1, a + 1):
	nCa = nCa * (n + 1 - i) * modinv(i, P) % P
nCb = nCa
for j in range(a + 1, b + 1):
	nCb = nCb * (n + 1 - j) * modinv(j, P) % P
ans = (pow(2, n, P) - 1 - nCa - nCb + 2 * P) % P
print(ans)


(N, a, b) = map(int, input().split())
MOD = 10 ** 9 + 7
c = pow(2, N, MOD) - 1

def comb(n, k):
	(fac, finv) = (1, 1)
	for i in range(k):
		fac = fac * (n - i) % MOD
		finv = finv * (i + 1) % MOD
	return fac * pow(finv, MOD - 2, MOD) % MOD
print((c - comb(N, a) - comb(N, b)) % MOD)


def ncr(n, r, z):
	x = 1
	y = 1
	for i in range(min(r, n - r)):
		x = x * (n - i) % z
		y = y * (i + 1) % z
	y = pow(y, z - 2, z)
	return x * y % z
(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
A = ncr(n, a, mod)
B = ncr(n, b, mod)
ans = pow(2, n, mod) - 1 - A - B
while ans < 0:
	ans += mod
print(ans)


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)


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

def nCr(n, r, m):
	a = b = 1
	for i in range(r):
		a = a * (n - i) % m
		b = b * (r - i) % m
	return a * pow(b, m - 2, m) % m
ans = pow(2, n, M) - 1
ans -= nCr(n, a, M)
ans -= nCr(n, b, M)
ans %= M
if ans < 0:
	ans += M
print(ans)


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

def pow(a, n, m):
	if n == 0:
		return 1
	else:
		k = pow(a * a % m, n // 2, m)
		if n % 2 == 1:
			k = k * a % m
		return k
inv = [0 for i in range(200001)]
finv = [0 for i in range(200001)]
inv[1] = 1
finv[1] = 1
for i in range(2, 200001):
	inv[i] = -(1000000007 // i) * inv[1000000007 % i] % 1000000007
	finv[i] = finv[i - 1] * inv[i] % 1000000007
a_num = 1
b_num = 1
for i in range(n - a + 1, n + 1):
	a_num = i * a_num % 1000000007
for i in range(n - b + 1, n + 1):
	b_num = i * b_num % 1000000007
print((pow(2, n, 1000000007) - 1 - a_num * finv[a] - b_num * finv[b]) % 1000000007)


import math

def main():
	(n, a, b) = [int(x) for x in input().split(' ')]
	p = 1000000007
	a = min([a, n - a])
	b = min([b, n - b])
	M = max([a, b])
	f = [1, 1]
	finv = []
	for i in range(M):
		f.append(f[-1] * (i + 2) % p)
	lf = len(f)
	finv.append(modpower(f[-1], p - 2, p))
	for i in range(lf - 1):
		finv.append(finv[-1] * (lf - i - 1) % p)
	na = 1
	nb = 1
	for i in range(M):
		if a > i:
			na = na * (n - i) % p
		if b > i:
			nb = nb * (n - i) % p
	print((modpower(2, n, p) - 1 - na * finv[lf - 1 - a] % p - nb * finv[lf - 1 - b] % p) % p)

def modpower(a, p, d):
	pp = [a]
	for i in range(int(math.log2(p)) + 1):
		pp.append(pp[-1] ** 2 % d)
	b_p = format(p, 'b')
	m = 1
	for i in range(len(b_p)):
		if b_p[-i - 1] == '1':
			m = m * pp[i] % d
	return m
main()


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, n, mod) - 1 + mod * 2

def c(x, y):
	p = 1
	for i in range(x - y + 1, x + 1):
		p *= i
		p %= mod
	for i in range(2, y + 1):
		p *= pow(i, mod - 2, mod)
		p %= mod
	return p
r = ans - c(n, a) - c(n, b)
print(r % mod)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, n, mod) - 1
fa = 1
fb = 1
for i in range(1, a + 1):
	fa *= i
	fa %= mod
for i in range(1, b + 1):
	fb *= i
	fb %= mod
fa = pow(fa, mod - 2, mod)
fb = pow(fb, mod - 2, mod)
for i in range(a):
	fa *= n - i
	fa %= mod
for i in range(b):
	fb *= n - i
	fb %= mod
print((ans - fa - fb) % mod)


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

def comb(n, r, p):
	(X, Y) = (1, 1)
	for i in range(r):
		X *= n - i
		Y *= i + 1
		X %= p
		Y %= p
	return int(X * pow(Y, p - 2, p))
ans = pow(2, n, p) - comb(n, a, p) - comb(n, b, p) - 1
print(ans % p)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, n, mod) - 1
product = 1
div = 1
for i in range(1, b + 1):
	product = product * (n - i + 1) % mod
	div = div * i % mod
	if i == a or i == b:
		ans -= product * pow(div, mod - 2, mod)
print(ans % mod)


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

def comb(n, k):
	temp = 1
	k = min(k, n - k)
	for i in range(1, k + 1):
		temp = temp * pow(i, mod - 2, mod)
		temp = temp * (n - i + 1) % mod
	return temp % mod
ans = pow(2, n, mod) - 1 - comb(n, a) - comb(n, b)
print(ans % mod)


MOD = 1000000007

def calc_combi(n, k):
	frac = 1
	denomi = 1
	for i in range(n - k + 1, n + 1):
		frac = frac * i % MOD
	for i in range(1, k + 1):
		denomi = denomi * i % MOD
	return frac * pow(denomi, MOD - 2, MOD)
(n, a, b) = map(int, input().rstrip().split())
nca = calc_combi(n, a)
ncb = calc_combi(n, b)
print((pow(2, n, MOD) - 1 - nca - ncb) % MOD)


def pow(x, n, p):
	if n == 0:
		return 1
	K = 1
	while n > 1:
		if n % 2 != 0:
			K = x * K % p
		x = x * x % p
		n //= 2
	return K * x % p

def cmb3(n, r, q):
	if r < 0 or n < r:
		return 0
	r = min(r, n - r)
	s = 1
	for x in range(n, n - r, -1):
		s = s * x % q
	t = 1
	for x in range(1, r + 1):
		t = t * x % q
	u = pow(t, q - 2, q)
	return u * s % q
(n, a, b) = list(map(int, input().split()))
A = pow(2, n, 10 ** 9 + 7)
if a <= n:
	B = cmb3(n, a, 10 ** 9 + 7)
else:
	B = 0
if b <= n:
	C = cmb3(n, b, 10 ** 9 + 7)
else:
	C = 0
print((A - B - C - 1) % (10 ** 9 + 7))


(n, a, b) = map(int, input().split())
mod = 7 + 10 ** 9
ans = pow(2, n, mod)

def comb(n, c, mod):
	s = 1
	t = 1
	for i in range(1, c + 1):
		s = s * i % mod
	for j in range(n - c + 1, n + 1):
		t = t * j % mod
	return t * pow(s, mod - 2, mod) % mod
print((ans - 1 - comb(n, a, mod) - comb(n, b, mod)) % mod)


MOD = 1000000007

def mod_pow(x, n):
	ret = 1
	while n > 0:
		if n & 1:
			ret = ret * x % MOD
		x = x * x % MOD
		n >>= 1
	return ret
(n, a, b) = [int(x) for x in input().split()]
ans = mod_pow(2, n) - 1
xa = n
for i in range(n - 1, n - a, -1):
	xa = xa * i % MOD
ya = a
for i in range(a - 1, 0, -1):
	ya = ya * i % MOD
xb = n
for i in range(n - 1, n - b, -1):
	xb = xb * i % MOD
yb = b
for i in range(b - 1, 0, -1):
	yb = yb * i % MOD
ca = xa * mod_pow(ya, MOD - 2) % MOD
cb = xb * mod_pow(yb, MOD - 2) % MOD
ans = (ans + MOD * 2 - ca - cb) % MOD
print(ans)


import math
l = 10 ** 9 + 7
(n, a, b) = map(int, input().split())
comb = [1]
for i in range(max(a, b)):
	den = i + 1
	num = n - i
	ans = comb[i] * num * pow(den, l - 2, l) % l
	comb.append(ans)
print((pow(2, n, l) - 1 - comb[a] - comb[b]) % l)


(n, a, b) = map(int, input().split())
MOD = 10 ** 9 + 7
ans = pow(2, n, MOD) - 1
(a, b) = (min(a, b), max(a, b))
tmp = 1
for i in range(1, a + 1):
	tmp = tmp * (n + 1 - i) * pow(i, -1, MOD)
	tmp %= MOD
ans = (ans - tmp) % MOD
for i in range(a + 1, b + 1):
	tmp = tmp * (n + 1 - i) * pow(i, -1, MOD)
	tmp %= MOD
ans = (ans - tmp) % MOD
print(ans)


def modinv(a, m):
	b = m
	u = 1
	v = 0
	while b:
		t = a // b
		a -= t * b
		(a, b) = (b, a)
		u -= t * v
		(u, v) = (v, u)
	u %= m
	if u < 0:
		u += m
	return u

def nCk(N, k, mod):
	ret_val = 1
	for i in range(k):
		ret_val *= N - i
		ret_val %= mod
		ret_val *= modinv(i + 1, mod)
		ret_val %= mod
	return ret_val
(n, a, b) = map(int, input().split())
MOD = 10 ** 9 + 7
all_cnt = pow(2, n, MOD) - 1
a_cnt = nCk(n, a, MOD)
b_cnt = nCk(n, b, MOD)
ans = all_cnt - a_cnt - b_cnt
print(ans % MOD)


def comb_mod(n, r):
	mod = 10 ** 9 + 7
	ans = 1
	for i in range(r):
		ans *= n - i
		ans %= mod
	for i in range(1, r + 1):
		ans *= pow(i, -1, mod)
		ans %= mod
	return ans

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


(n, a, b) = map(int, input().split())
mod = 1000000007
ans = pow(2, n, mod) - 1

def fur(n, k):
	(p, q) = (1, 1)
	for i in range(k):
		p = p * (n - i) % mod
		q = q * (i + 1) % mod
	return p * pow(q, mod - 2, mod) % mod
print((ans - fur(n, a) - fur(n, b)) % mod)


import itertools
import math
(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7

def comb(n, r):
	ans = 1
	for i in range(r):
		ans = ans * (n - i) * pow(i + 1, mod - 2, mod) % mod
	return ans
print((pow(2, n, mod) - 1 - comb(n, a) - comb(n, b)) % mod)


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

def c(k):
	s = t = 1
	for i in range(k):
		s = s * (n - i) % M
		t = t * (i + 1) % M
	return s * pow(t, M - 2, M) % M
print((pow(2, n, M) - c(a) - c(b) - 1) % M)


(n, a, b) = map(int, input().split())
MOD = 10 ** 9 + 7
ans = pow(2, n, MOD) - 1
X = Y = 1
for i in range(1, b + 1):
	Y = Y * i % MOD
	X = X * (n - i + 1) % MOD
	if i == a or i == b:
		ans -= X * pow(Y, MOD - 2, MOD)
print(ans % MOD)


(n, a, b) = list(map(int, input().split()))
mod = 10 ** 9 + 7
sum = (pow(2, n, mod) - 1) % mod
nume_a = 1
deno_a = 1
for i in range(n - a + 1, n + 1):
	nume_a = nume_a * (i % mod) % mod
	deno_a = deno_a * (i - (n - a + 1) + 1) % mod % mod
ans_a = nume_a * pow(deno_a, mod - 2, mod) % mod
nume_b = 1
deno_b = 1
for i in range(n - b + 1, n + 1):
	nume_b = nume_b * (i % mod) % mod
	deno_b = deno_b * (i - (n - b + 1) + 1) % mod % mod
ans_b = nume_b * pow(deno_b, mod - 2, mod) % mod
print((sum - ans_a - ans_b) % mod)


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

def cmb(r):
	N = 1
	R = 1
	for i in range(r):
		N = N * (n - i) % m
		R = R * (i + 1) % m
	return N * pow(R, m - 2, m) % m
ans = (pow(2, n, m) - (cmb(a) + cmb(b) + 1) % m) % m
print(ans)


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

def combination(p, k):
	(a, b) = (1, 1)
	for i in range(k):
		a *= p - i
		a %= mod
		b *= i + 1
		b %= mod
	return a * pow(b, mod - 2, mod) % mod
print((pow(2, n, mod) - 1 - combination(n, a) - combination(n, b)) % mod)


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

def comb(n, m, mod=10 ** 9 + 7):
	numerator = 1
	denominator = 1
	for i in range(1, m + 1):
		numerator = numerator * (n - i + 1) % mod
		denominator = denominator * i % mod
	d_inv = pow(denominator, mod - 2, mod)
	return numerator * d_inv % mod
cmb_n_a = comb(n, a)
cmb_n_b = comb(n, b)
print((pow(2, n, mod) - 1 - cmb_n_a - cmb_n_b) % mod)


(n, a, b) = map(int, input().split())
c = d = 1
e = 0
m = 10 ** 9 + 7
for i in range(1, b + 1):
	c = c * (n + 1 - i) % m
	d = d * i % m
	if i == a or i == b:
		e += c * pow(d, m - 2, m) % m
print((pow(2, n, m) - e - 1) % m)


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

def comb(n, r):
	u = 1
	d = 1
	for i in range(n - r + 1, n + 1):
		u = u * i % mod
	for i in range(1, r + 1):
		d = d * i % mod
	D = pow(d, mod - 2, mod)
	return u * D % mod
ans = pow(2, n, mod) - 1 - comb(n, a) - comb(n, b)
print(ans % mod)


MOD = 10 ** 9 + 7

def comb(n, r):
	res = 1
	for i in range(r):
		res *= n - i
		res *= pow(i + 1, MOD - 2, MOD)
		res %= MOD
	return res
(n, a, b) = map(int, input().split())
print((pow(2, n, MOD) - 1 - comb(n, a) - comb(n, b)) % MOD)


import sys
input = lambda : sys.stdin.readline().rstrip()
mod = 10 ** 9 + 7
(n, a, b) = map(int, input().split())
ans = pow(2, n, mod) - 1
bb = 1
for i in range(b):
	bb = bb * (n - i) * pow(i + 1, mod - 2, mod) % mod
	if i == a - 1:
		aa = bb
print((ans - aa - bb) % mod)


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

def comb(n, r, m):
	(X, Y) = (1, 1)
	for i in range(r):
		X *= n - i
		Y *= i + 1
		X %= m
		Y %= m
	return int(X * pow(Y, m - 2, m))
out = pow(2, n, m) - 1 - comb(n, a, m) - comb(n, b, m)
print(out % m)


MOD = 10 ** 9 + 7
(n, a, b) = map(int, input().split())
all = pow(2, n, MOD)
if all:
	all -= 1
for i in (a, b):
	sub = 1
	for j in range(i):
		sub *= n - j
		sub %= MOD
		sub *= pow(j + 1, MOD - 2, MOD)
		sub %= MOD
	all -= sub
	if all < 0:
		all += MOD
print(all)


ip = input().split(' ')
n = int(ip[0])
a = int(ip[1])
b = int(ip[2])
m = 1000000007

def modMul(a, b, mod):
	return a * b % mod

def fastExp(b, exp, mod):
	res = 1
	base = b
	while exp > 0:
		if exp % 2 == 1:
			res = modMul(res, base, mod)
		base = modMul(base, base, mod)
		exp >>= 1
	return res

def getncr(n, r, m):
	num = 1
	fact = 1
	for i in range(r):
		num = modMul(num, n - i, m)
		fact = modMul(i + 1, fact, m)
	return modMul(num, fastExp(fact, m - 2, m), m)

def solve(n, a, b, m):
	got = fastExp(2, n, m) - 1
	for_a = getncr(n, a, m)
	for_b = getncr(n, b, m)
	got -= for_a
	if got < 0:
		got += m
	got -= for_b
	if got < 0:
		got += m
	print(got)
solve(n, a, b, m)


import math
import numpy as np
(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
factna = [n]
factnb = [n]
facta = [a]
factb = [b]
for i in range(1, a):
	factna.append(factna[-1] * (n - i) % mod)
	facta.append(facta[-1] * (a - i) % mod)
for i in range(1, b):
	factnb.append(factnb[-1] * (n - i) % mod)
	factb.append(factb[-1] * (b - i) % mod)

def pow(x, n):
	a = 1
	while n > 0:
		if n % 2 == 1:
			a *= x % mod
		x *= x % mod
		n >>= 1
	return a
A = pow(2, n) % mod
B = factna[-1] * pow(facta[-1], mod - 2) % mod
C = factnb[-1] * pow(factb[-1], mod - 2) % mod
print((A - B - C - 1) % mod)


(n, *A) = map(int, open(0).read().split())
k = 10 ** 9 + 7
c = (1 << n) % k - 1
for l in A:
	X = Y = 1
	for i in range(l):
		X = X * (n - i) % k
		Y = Y * (i + 1) % k
	c -= X * pow(Y, k - 2, k)
print(c % k)


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

def combi(n, r):
	(x, y) = (1, 1)
	for i in range(n - r + 1, n + 1):
		x *= i
		x %= mod
	for j in range(1, r + 1):
		y *= j
		y %= mod
	yinv = pow(y, mod - 2, mod)
	return x * yinv % mod

def main():
	nca = combi(n, a)
	ncb = combi(n, b)
	ans = pow(2, n, mod) - 1 - (nca + ncb)
	print(ans % mod)
main()


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

def c(x):
	out = 1
	for i in range(min(x, n - x)):
		out *= n - i
		out *= pow(i + 1, mod - 2, mod)
		out %= mod
	return out
ans = pow(2, n, mod) - 1 - c(a) - c(b)
ans %= mod
print(ans)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, n, mod) - 1

def f(x):
	N = 1
	D = 1
	for i in range(x):
		N *= n - i
		N %= mod
		D *= i + 1
		D %= mod
	return N * pow(D, mod - 2, mod) % mod
print((ans - f(a) - f(b)) % mod)


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

def Cmod(n, k):
	X = 1
	Y = 1
	for i in range(k):
		X = X * (n - i) % mod
		Y = Y * (k - i) % mod
	Yn = pow(Y, mod - 2, mod)
	return X * Yn % mod
print((pow(2, n, mod) - 1 - Cmod(n, a) - Cmod(n, b)) % mod)


(n, a, b) = map(int, input().split())
x = pow(2, n, 10 ** 9 + 7)
s = 1
for i in range(a):
	s = s * (n - i) * pow(1 + i, 10 ** 9 + 5, 10 ** 9 + 7)
	s = s % (10 ** 9 + 7)
t = 1
for i in range(b):
	t = t * (n - i) * pow(1 + i, 10 ** 9 + 5, 10 ** 9 + 7)
	t = t % (10 ** 9 + 7)
ans = (x - s - t - 1) % (10 ** 9 + 7)
print(ans)


(n, a, b) = map(int, input().split())
MOD = 10 ** 9 + 7
fact = [1, 1]
factn = [1, n % MOD]
for i in range(2, b + 1):
	factn.append(factn[-1] * (n - i + 1) % MOD)
	fact.append(fact[-1] * i % MOD)
nca = factn[a] * pow(fact[a], MOD - 2, MOD) % MOD
ncb = factn[b] * pow(fact[b], MOD - 2, MOD) % MOD
ans = (pow(2, n, MOD) - 1 - nca - ncb) % MOD
if ans < 0:
	ans += MOD
print(ans)


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

def cb(k):
	v = 1
	w = 1
	for i in range(k):
		v = v * (n - i) % m
		w = w * (i + 1) % m
	return v * pow(w, m - 2, m) % m
print((pow(2, n, m) - 1 - cb(a) - cb(b)) % m)


from functools import reduce
mod = 10 ** 9 + 7

def nCk(n, k):
	c = reduce(lambda x, y: x * y % mod, range(n, n - k, -1))
	m = reduce(lambda x, y: x * y % mod, range(1, k + 1))
	return c * pow(m, mod - 2, mod) % mod
(n, a, b) = map(int, input().split())
ans = pow(2, n, mod) - nCk(n, a) - nCk(n, b) - 1
ans %= mod
print(ans)


(n, a, b) = map(int, input().split())
MOD = 1000000007
ans = (pow(2, n, MOD) - 1) % MOD

def conv(n, k):
	(x, y) = (1, 1)
	for i in range(k):
		x = x * (n - i) % MOD
		y = y * (i + 1) % MOD
	return x * pow(y, MOD - 2, MOD) % MOD
ans = (ans - conv(n, a) - conv(n, b)) % MOD
print(ans)


mod = 10 ** 9 + 7
import math

def co(n, r, mod):
	x = 1
	y = 1
	for i in range(1, r + 1):
		x = x * (n - i + 1) % mod
		y = y * i % mod
	return x * pow(y, mod - 2, mod) % mod
(n, a, b) = map(int, input().split())
ans = pow(2, n, mod) - 1 - co(n, a, mod) - co(n, b, mod)
print(max(ans % mod, 0))


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, n, mod) - 1
p = 1
for i in range(a):
	p *= n - i
	p *= pow(i + 1, mod - 2, mod)
	p %= mod
p2 = 1
for i in range(b):
	p2 *= n - i
	p2 *= pow(i + 1, mod - 2, mod)
	p2 %= mod
print((ans - p - p2) % mod)


import sys
N_MAX = 200000 + 5
INF = 10 ** 9 + 7
sys.setrecursionlimit(N_MAX)
MOD = 10 ** 9 + 7
MOD = 10 ** 9 + 7
N_MAX = 2 * 10 ** 5
fac = [1, 1]
facinv = [1, 1]
inv = [0, 1]
for i in range(2, N_MAX + 1):
	fac.append(fac[-1] * i % MOD)
	inv.append(-inv[MOD % i] * (MOD // i) % MOD)
	facinv.append(facinv[-1] * inv[-1] % MOD)

def fac(n, a):
	ans = 1
	for i in range(a):
		ans *= n
		ans %= MOD
		n -= 1
	return ans

def cmb(n, r):
	if r < 0 or r > n:
		return 0
	return fac[n] * facinv[r] * facinv[n - r] % MOD

def main():
	(n, a, b) = map(int, sys.stdin.readline().rstrip().split())
	ans = pow(2, n, MOD) - 1
	ans %= MOD
	ans -= fac(n, a) * facinv[a]
	ans %= MOD
	ans -= fac(n, b) * facinv[b]
	ans %= MOD
	print(ans)
main()


import functools
(N, A, B) = list(map(int, input().split()))
MOD = 10 ** 9 + 7

def modpow(x, n):
	ret = 1
	while n:
		if n & 1:
			ret = ret * x % MOD
		x = x * x % MOD
		n >>= 1
	return ret

@functools.lru_cache(maxsize=None)
def modinv(x):
	return modpow(x, MOD - 2)

def modcomb(n, r):
	ret = 1
	for i in range(n, n - r, -1):
		ret *= i
		ret %= MOD
	for i in range(r, 1, -1):
		ret *= modinv(i)
		ret %= MOD
	return ret
total = modpow(2, N) - 1
ans = total - (modcomb(N, A) + modcomb(N, B))
ans %= MOD
print(ans)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, n, mod) - 1
cma = 1
(a, b) = (min(a, b), max(a, b))
for i in range(1, a + 1):
	cma = cma * (n - i + 1) * pow(i, mod - 2, mod) % mod
ans -= cma
if a == b:
	print(ans)
	exit()
for i in range(a + 1, b + 1):
	cma = cma * (n - i + 1) * pow(i, mod - 2, mod) % mod
print((ans - cma) % mod)


def cmb(a, b, c):
	b = min(b, a - b)
	num = 1
	for i in range(b):
		num = num * (n - i) % c
	den = 1
	for i in range(b):
		den = den * (i + 1) % c
	return num * pow(den, -1, c) % c
mod = 10 ** 9 + 7
(n, a, b) = map(int, input().split())
ans = (pow(2, n, mod) - cmb(n, a, mod) - cmb(n, b, mod) - 1) % mod
if ans < 0:
	ans = ans + mod
print(ans)


def comb_mod(n, m, mod):
	p = q = 1
	for i in range(m):
		p = p * (n - i) % mod
		q = q * (i + 1) % mod
	return p * pow(q, mod - 2, mod) % mod
(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
print((pow(2, n, mod) - 1 - comb_mod(n, a, mod) - comb_mod(n, b, mod)) % mod)


import math
(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
s = pow(2, n, mod) - 1

def cal(n, r):
	p = 1
	q = 1
	for i in range(r):
		p = p * (n - i) % mod
		q = q * (i + 1) % mod
	return p * pow(q, mod - 2, mod) % mod
print((s - cal(n, a) - cal(n, b)) % mod)


(N, a, b) = map(int, input().split())
mod = 10 ** 9 + 7

def C(n, k, mod):
	k = min(k, n - k)
	x = 1
	for i in range(k):
		y = (n - i) * pow(i + 1, mod - 2, mod)
		x = x * y % mod
	return x
ans = pow(2, N, mod) - 1 - C(N, a, mod) - C(N, b, mod)
print(ans % mod)


(n, a, b) = map(int, input().split())
k = 10 ** 9 + 7
we = pow(2, n, k)
su = 1
suu = 1
for i in range(a):
	su = su * (i + 1) % k
	suu = suu * (n - i) % k
df = suu * pow(su, k - 2, k) % k
su = 1
suu = 1
for i in range(b):
	su = su * (i + 1) % k
	suu = suu * (n - i) % k
df += suu * pow(su, k - 2, k) % k
we = we - df - 1
print(we % k)


(n, a, b) = map(int, input().split())
Mod = 10 ** 9 + 7
c = max(a, b)
f = [1] * (c + 1)
g = [n] * (c + 1)
for i in range(2, c + 1):
	f[i] = f[i - 1] * i % Mod
	g[i] = g[i - 1] * (n - i + 1) % Mod

def f_inv(i):
	return pow(f[i], Mod - 2, Mod)

def h(i):
	return g[i] * f_inv(i) % Mod
Ans = pow(2, n, Mod) - h(a) - h(b) - 1
print(Ans % Mod)


(n, a, b) = map(int, input().split())
cmba = 1
cmbb = 1
p = 10 ** 9 + 7
lst = []
num = pow(2, n, p) - 1
for i in range(1, b + 1):
	cmbb *= (n - i + 1) * pow(i, p - 2, p) % p
	if cmbb > p:
		cmbb = cmbb % p
	cmba = cmbb
	if i == a:
		lst.append(cmba)
num = num - lst[0] - cmbb
num = num % p
print(num)


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

def perm(a, b):
	tmp = 1
	for i in range(b):
		tmp *= a - i
		tmp = tmp % C
	return tmp
cta = perm(n, a) * pow(perm(a, a), C - 2, C)
ctb = perm(n, b) * pow(perm(b, b), C - 2, C)
ans = pow(2, n, C) - 1 - cta - ctb
print(ans % C)


def calc_pow(x, y):
	if y == 0:
		return 1
	else:
		ans = calc_pow(x, y // 2) ** 2
		if y % 2:
			ans *= x
		return ans % 1000000007

def calc_X(c):
	X = 1
	k = n
	for i in range(c):
		X = X * k % 1000000007
		k = k - 1
	return X

def calc_Y(c):
	Y = 1
	for i in range(1, c + 1):
		Y = Y * i % 1000000007
	return Y
(n, a, b) = list(map(int, input().split()))
ans = calc_pow(2, n) - 1
XYa = calc_X(a) * calc_pow(calc_Y(a), 1000000005) % 1000000007
XYb = calc_X(b) * calc_pow(calc_Y(b), 1000000005) % 1000000007
ans = (ans - XYa - XYb) % 1000000007
print(ans)


def main():
	(n, a, b) = list(map(int, input().split()))
	mod = 10 ** 9 + 7

	def modpow(x, n, mod):
		res = 1
		while n:
			if n % 2:
				res *= x % mod
			x *= x % mod
			n >>= 1
		return res

	def cmb(n, r, mod):
		nume = 1
		for i in range(n - r + 1, n + 1):
			nume = nume * i % mod
		deno = 1
		for j in range(1, r + 1):
			deno = deno * j % mod
		d = modpow(deno, mod - 2, mod)
		return nume * d % mod
	all_cmb = pow(2, n, mod) - 1
	bad_a = cmb(n, a, mod)
	bad_b = cmb(n, b, mod)
	print((all_cmb - bad_a - bad_b) % mod)

def __starting_point():
	main()
__starting_point()


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

def CC(n, k):
	(X, Y) = (1, 1)
	for i in range(n - k + 1, n + 1):
		X = X * i % p
	for j in range(1, k + 1):
		Y = Y * j % p
	YY = pow(Y, p - 2, p)
	return X * YY % p
A = CC(n, a)
B = CC(n, b)
ALL = pow(2, n, p)
ans = (ALL - 1 - A - B) % p
print(ans)


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

def cal(n, a):
	r = n
	sub = 1
	while a > 1:
		if a % 2 == 1:
			a -= 1
			sub = sub * r % MOD
		r = r * r % MOD
		a /= 2
	return r * sub % MOD

def felmer(n, a, b):
	r = [0, 0]
	ni = n
	ab = 1
	for i in range(1, max(a, b) + 1):
		ab = ab * i % MOD
		if i == a:
			r[0] = ni * cal(ab, MOD - 2) % MOD
		elif i == b:
			r[1] = ni * cal(ab, MOD - 2) % MOD
		ni = ni * (n - i) % MOD
	return r
allNumber = cal(2, n)
(nCa, nCb) = felmer(n, a, b)
ans = allNumber - 1 - nCa - nCb
ans %= MOD
if ans < 0:
	ans += MOD
print(ans)


import math
from math import gcd, pi, sqrt
INF = float('inf')
MOD = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 6)
import itertools
from collections import Counter, deque

def i_input():
	return int(input())

def i_map():
	return list(map(int, input().split()))

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def main():
	(n, a, b) = i_map()
	s = pow(2, n, MOD) - 1

	def fur(n, r):
		(p, q) = (1, 1)
		for i in range(r):
			p = p * (n - i) % MOD
			q = q * (i + 1) % MOD
		return p * pow(q, MOD - 2, MOD) % MOD
	print((s - fur(n, a) - fur(n, b)) % MOD)

def __starting_point():
	main()
__starting_point()


def comb2(n, r):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	res = 1
	for i in range(r):
		res = res * (n - i) % MOD * pow(i + 1, MOD - 2, MOD) % MOD
	return res
MOD = 10 ** 9 + 7
(N, A, B) = map(int, input().split())
ans = pow(2, N, MOD) - comb2(N, A) - comb2(N, B) - 1
print(ans % MOD)


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

def modpow(a, n):
	if n < 1:
		return 1
	ans = modpow(a, n // 2)
	ans = ans * ans % mod
	if n % 2 == 1:
		ans *= a
	return ans % mod

def cmb(n, i):
	(inv, ans) = (1, 1)
	for j in range(1, i + 1):
		ans = ans * (n - j + 1) % mod
		inv = inv * j % mod
	return ans * modpow(inv, mod - 2) % mod
ans_n = pow(2, n, mod) - 1
ans_a = cmb(n, a) % mod
ans_b = cmb(n, b) % mod
print((ans_n - ans_a - ans_b) % mod)


from math import factorial
(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7

def comb(n, k, p):
	x = 1
	y = 1
	for i in range(k):
		x = x * (n - i) % p
		y = y * (k - i) % p
	yinv = pow(y, p - 2, p)
	return x * yinv % p
ans = (pow(2, n, mod) - 1 - comb(n, a, mod) - comb(n, b, mod)) % mod
print(ans)


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

def pow(x, n, m):
	if n == 0:
		return 1
	res = pow(x * x % m, n // 2, m)
	if n % 2 == 1:
		res = res * x % m
	return res
c = max(a, b)
inv = [0 for i in range(c + 1)]
finv = [0 for i in range(c + 1)]
inv[1] = 1
finv[0] = finv[1] = 1
for i in range(2, c + 1):
	inv[i] = 1000000007 - 1000000007 // i * inv[1000000007 % i] % 1000000007
	finv[i] = finv[i - 1] * inv[i] % 1000000007

def kaizyou(k):
	num = 1
	for i in range(n - k + 1, n + 1):
		num = num * i % 1000000007
	return num

def combinations(k):
	return kaizyou(k) * finv[k] % 1000000007
print((pow(2, n, 1000000007) - combinations(a) - combinations(b) - 1) % 1000000007)


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
(c, d) = (1, 1)
for i in range(n - a + 1, n + 1):
	c = i * c % mod
for i in range(1, a + 1):
	c = c * pow(i, mod - 2, mod) % mod
for i in range(n - b + 1, n + 1):
	d = i * d % mod
for i in range(1, b + 1):
	d = d * pow(i, mod - 2, mod) % mod
print((pow(2, n, mod) - c - d - 1) % mod)


def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

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

def combination(n, r, mod=10 ** 9 + 7):
	r = min(r, n - r)
	res = 1
	for i in range(r):
		res = res * (n - i) * modinv(i + 1, mod) % mod
	return res

def power_func(a, n, p):
	bi = str(format(n, 'b'))
	res = 1
	for i in range(len(bi)):
		res = res * res % p
		if bi[i] == '1':
			res = res * a % p
	return res
(n, a, b) = [int(i) for i in input().split()]
mod = 10 ** 9 + 7
print((power_func(2, n, mod) - 1 - combination(n, a, mod) - combination(n, b, mod)) % mod)


(n, a, b) = [int(i) for i in input().split()]
mod = 10 ** 9 + 7
ans = pow(2, n, mod) - 1
ans = ans % mod

def inv(x):
	return pow(x, mod - 2, mod)
x = 1
k = 1
while x < max(a, b) + 1:
	k = k * (n - x + 1) * inv(x)
	k = k % mod
	if x == a or x == b:
		ans -= k
	x += 1
print(ans % mod)


def main():
	from math import factorial

	def calc(x):
		ret = 1
		for i in range(x):
			ret = ret * (n - i) % mod
		return ret * pow(factorial(x), mod - 2, mod) % mod
	(n, a, b) = list(map(int, input().split()))
	mod = 10 ** 9 + 7
	print(max(0, (pow(2, n, mod) - (calc(a) + calc(b)) % mod - 1) % mod))

def __starting_point():
	main()
__starting_point()


(n, a, b) = map(int, input().split())
mod = 10 ** 9 + 7
ans = pow(2, n, mod)
ans -= 1
aa = 1
for i in range(1, a + 1):
	aa = aa * (n - i + 1) * pow(i, -1, mod) % mod
bb = 1
for i in range(1, b + 1):
	bb = bb * (n - i + 1) * pow(i, -1, mod) % mod
ans = (ans - aa - bb) % mod
print(ans)


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

def nCr(n, r, mod):
	ret = [1] * (r + 1)
	for i in range(1, r + 1):
		ret[i] = ret[i - 1] * (n - i + 1) * pow(i, mod - 2, mod) % mod
	return ret
nCrl = nCr(n, k, p)
print((pow(2, n, p) - 1 - nCrl[a] - nCrl[b]) % p)


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

def com(n, k, c):
	l = 1
	m = 1
	for i in range(k):
		l *= n - i
		m *= i + 1
		l %= c
		m %= c
	return l * pow(m, c - 2, c) % c
ans = pow(2, n, c) - 1 - com(n, a, c) - com(n, b, c)
ans %= c
print(ans)


from math import factorial
(n, a, b) = [int(i) for i in input().split()]
mod = 10 ** 9 + 7

def nCr(n, r):
	nonlocal mod
	ans = 1
	for i in range(r):
		ans = ans * (n - i) % mod
	return ans * pow(factorial(r), mod - 2, mod) % mod
print((pow(2, n, mod) - nCr(n, a) - nCr(n, b) - 1) % mod)


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

def inv(x):
	return pow(x, mod - 2, mod)

def c(n, k):
	(ue, sita) = (1, 1)
	for i in range(0, k):
		ue = ue * (n - i) % mod
		sita = sita * (i + 1) % mod
	return ue * inv(sita) % mod
print(((pow(2, n, mod) - c(n, a) - c(n, b) - 1) % mod + mod) % mod)


(n, a, b) = map(int, input().split())
mod = int(1000000000.0 + 7)

def nCr(a, b):
	global mod
	res = 1
	for i in range(1, b + 1):
		res = res * (n - i + 1) % mod * pow(i, mod - 2, mod) % mod
	return res % mod
print((pow(2, n, mod) - 1 - nCr(n, a) - nCr(n, b) + 2 * mod) % mod)


s = list(map(int, input().split()))
ans = 0
ad = 1
mod = 10 ** 9 + 7

def comb(x):
	a = b = 1
	for i in range(x):
		a = a * (s[0] - i) % mod
		b = b * (i + 1) % mod
	return a * pow(b, mod - 2, mod) % mod
ans = pow(2, s[0], mod)
print((ans - 1 - comb(s[1]) - comb(s[2])) % mod)


(n, a, b) = map(int, input().split())
MOD = 10 ** 9 + 7
N = pow(2, n, MOD)

def com(n, r):
	s = 1
	for i in range(n - r + 1, n + 1):
		s *= i
		s %= MOD
	t = 1
	for j in range(1, r + 1):
		t *= j
		t %= MOD
	return s * pow(t, MOD - 2, MOD) % MOD
print((N - com(n, a) - com(n, b) - 1) % MOD)


(n, a, b) = map(int, input().split())
mod = pow(10, 9) + 7
total = pow(2, n, mod)

def comb(m, x):
	numerator = 1
	for i in range(m - x + 1, m + 1):
		numerator = numerator * i % mod
	denominator = 1
	for i in range(1, x + 1):
		denominator = denominator * i % mod
	d = pow(denominator, mod - 2, mod)
	return numerator * d
a = comb(n, a)
b = comb(n, b)
print((total - a - b - 1) % mod)


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

def modinv(a, mod=10 ** 9 + 7):
	return pow(a, mod - 2, mod)
com = [0] * (k + 1)
com[0] = 1
for i in range(1, k + 1):
	com[i] = com[i - 1] * (n - i + 1) * modinv(i, p) % p
print((pow(2, n, p) - 1 - com[a] - com[b]) % p)


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

def cmb(n, r):
	nume = 1
	for i in range(n - r + 1, n + 1):
		nume = nume * i % p
	deno = 1
	for j in range(1, r + 1):
		deno = deno * j % p
		d = pow(deno, p - 2, p)
	return nume * d
nca = cmb(n, a)
ncb = cmb(n, b)
res = pow(2, n, p) - nca - ncb - 1
print(res % p)


import math
key = 10 ** 9 + 7
(n, a, b) = map(int, input().split())
ans = 1
tmp = 2
N = math.ceil(math.log2(n))
for i in range(N + 1):
	if n >> i & 1 == 1:
		ans *= tmp
	tmp *= tmp
	tmp %= key
	ans %= key
ans -= 1

def comb(r):
	perm = 1
	for i in range(0, r):
		perm *= n - i
		perm %= key
	fact = 1
	for i in range(1, r + 1):
		fact *= i
		fact %= key
	ans = 1
	tmp = fact
	p = key - 2
	N = math.ceil(math.log2(p))
	for i in range(N):
		if p >> i & 1 == 1:
			ans *= tmp
		tmp *= tmp
		tmp %= key
		ans %= key
	ans *= perm
	ans %= key
	return ans
ans -= comb(a)
ans -= comb(b)
ans %= key
print(ans)


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

def comb(n, r, mod):
	(p, q) = (1, 1)
	for i in range(r):
		p = p * (n - i) % mod
		q = q * (i + 1) % mod
	return p * pow(q, mod - 2, mod) % mod
nca = comb(n, a, mod)
ncb = comb(n, b, mod)
ans = pow(2, n, mod)
ans = (ans - ((nca + ncb) % mod + 1)) % mod
print(ans)


from functools import reduce
mod = 10 ** 9 + 7

def f(A):
	dem = reduce(lambda x, y: x * y % mod, range(n, n - A, -1))
	num = reduce(lambda x, y: x * y % mod, range(1, A + 1))
	return dem * pow(num, mod - 2, mod) % mod
stdin = open(0)
(n, a, b) = map(int, stdin.read().split())
ans = pow(2, n, mod) - f(a) - f(b) - 1
ans %= mod
print(ans)


(n, a, b) = list(map(int, input().split()))
mod = 10 ** 9 + 7
factna = [n]
factnb = [n]
facta = [a]
factb = [b]
for i in range(1, a):
	factna.append(factna[-1] * (n - i) % mod)
	facta.append(facta[-1] * (a - i) % mod)
for i in range(1, b):
	factnb.append(factnb[-1] * (n - i) % mod)
	factb.append(factb[-1] * (b - i) % mod)

def pow(x, n):
	a = 1
	while n > 0:
		if n % 2 == 1:
			a *= x % mod
		x *= x % mod
		n >>= 1
	return a
print((pow(2, n) - 1 - factna[-1] * pow(facta[-1], mod - 2) % mod - factnb[-1] * pow(factb[-1], mod - 2) % mod) % mod)