Problem:
 Score : 400 points    Problem Statement 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 1 4 1 3      Sample Output 1 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.       Sample Input 2 1000000000 141421 173205      Sample Output 2 34076506  Print the count modulo (10^9 + 7) .

Solution (Python):
N,A,B=map(int,input().split())

MOD=10**9+7
def comb(n,k):
    if n<k:
        return 0
    if n<0 or k<0:
        return 0
    k=min(n-k,k)
    ans=1
    inv=[1]*(k+1)
    if k>=1:
        ans*=(n-k+1)%MOD
    for i in range(2,k+1):
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        ans=ans*(n-k+i)*inv[i]%MOD
    return ans

print((pow(2,N,MOD) - comb(N , A) - comb(N , B) - 1 ) % MOD )

Solution (Python):
n, a, b = map(int, input().split())
mod = 10**9 + 7
def comb(n,k):
    if n<k:
        return 0
    if n<0 or k<0:
        return 0
    k=min(n-k,k)
    ans=1
    inv=[1]*(k+1)
    if k>=1:
        ans*=(n-k+1)%mod
    for i in range(2,k+1):
        inv[i]=mod-inv[mod%i]*(mod//i)%mod
        ans=ans*(n-k+i)*inv[i]%mod
    return ans
c = comb(n, a)
d = comb(n, b)
answer = pow(2, n, mod) - 1
print((answer-c-d)%mod)

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

from functools import reduce

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)

Solution (Python):
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)

Solution (Python):
import sys
[n,a,b] = [int(s) for s in sys.stdin.read().split()] 

mod = 10**9+7
def comb(p,q,A): 
  X = 1
  Y = 1
  for i in range(1, q+1):
    X = (X*(p-i+1))%A
    Y = (Y*i)%A
  return (X*pow(Y, A-2, A))%A 
print((pow(2,n,mod)-comb(n,a,mod)-comb(n,b,mod)-1)%mod)

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

def comb(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

ans = (pow(2, n, mod) -1 - comb(n, a, mod) - comb(n, b, mod))%mod
print(ans)

Solution (Python):

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


mod = pow(10, 9) + 7

def cmb(n,k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    k = min(n-k,k)
    value = 1
    inv = [1] * (k+1)
    if k >= 1:
        value *= (n-k+1) % mod
    for i in range(2,k+1):
        inv[i] = mod-inv[mod%i]*(mod//i)%mod
        value = value * (n-k+i) * inv[i] % mod
    return value

answer = (pow(2, n, mod) - 1 - cmb(n, a) - cmb(n, b)) % mod
print(answer % mod)

Solution (Python):
n, a, b = map(int, input().split())
MOD = 10**9 + 7
def comb(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

ans = (pow(2, n, MOD)-1 - comb(n, a, MOD) - comb(n, b, MOD))%MOD
print(ans)

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

def modComb(n,r,mod):
    tmp = 1
    for i in range(1,r+1):
        tmp = tmp * (n-i+1) % mod
        tmp = tmp * pow(i,mod-2,mod)
    
    return tmp % mod


mod = 10**9+7
ans = pow(2,n,mod) - 1

print((ans-modComb(n,a,mod)-modComb(n,b,mod)) % mod)

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

def modComb(n,r,mod):
    tmp = 1
    
    for i in range(1,r+1):
        tmp = tmp * (n-i+1) % mod
        tmp = tmp * pow(i,mod-2,mod)
    
    return tmp % mod


mod = 10**9+7
ans = pow(2,n,mod) - 1

print((ans-modComb(n,a,mod)-modComb(n,b,mod)) % mod)

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

def modComb(n,r,mod):
    tmp = 1
    r = min(r,n-r)
    for i in range(1,r+1):
        tmp = tmp * (n-i+1) % mod
        tmp = tmp * pow(i,mod-2,mod)
    
    return tmp % mod


mod = 10**9+7
ans = pow(2,n,mod) - 1

print((ans-modComb(n,a,mod)-modComb(n,b,mod)) % mod)

Solution (Python):
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))

Solution (Python):
n,a,b = map(int,input().split())
cnt = 0
mod = 1000000007

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

cnt += pow(2,n,mod) - 1
cnt -= C(n,a)
cnt -= C(n,b)

print(max(0,cnt%mod))

Solution (Python):
def nrc_mod(n, r, mod=10**9+7):
    r = min(n - r, r)
    if r == 0:
        return 1
 
    over = 1
    for i in range(n, n - r, -1):
        over = over * i % mod
 
    under = 1
    for i in range(1, r + 1):
        under = under * i % mod
 
    inv = pow(under, mod - 2, mod)
    return over * inv % mod
 
 
n, a, b = map(int, input().split())
MOD = 10**9 + 7

ans = pow(2, n, MOD) - 1
ans -= nrc_mod(n, a, MOD)
ans -= nrc_mod(n, b, MOD)
while ans < 0:
    ans += MOD
print(ans)

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

def inv(a):
    return pow(a, (10**9 + 7) - 2, (10**9 + 7))
    
    
t = pow(2, n, 10**9 + 7) - 1
x = 1
y = 1
for i in range(a):
    x *= (n - i)
    x %= (10**9 + 7)
    y *= (a - i)
    y %= (10**9 + 7)
    
f = (x * inv(y)) % (10**9 + 7)
x = 1
y = 1

for i in range(b):
    x *= (n - i)
    x %= (10**9 + 7)
    y *= (b - i)
    y %= (10**9 + 7)
s = (x * inv(y)) % (10**9 + 7)

print((t - f - s + (10**9 + 7)) % (10**9 + 7))

Solution (Python):
def nrc_mod(n, r, mod=10**9+7):
    r = min(n - r, r)
    if r == 0:
        return 1

    over = 1
    for i in range(n, n - r, -1):
        over = over * i % mod

    under = 1
    for i in range(1, r + 1):
        under = under * i % mod

    inv = pow(under, mod - 2, mod)
    return over * inv % mod


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



ans = pow(2, n, MOD) - 1
ans -= nrc_mod(n, a, MOD)
ans -= nrc_mod(n, b, MOD)
while ans < 0:
    ans += MOD
print(ans)

Solution (Python):
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)

Solution (Python):
def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def cmb(n,r,mod):
    X=1
    Y=1
    for i in range(r):
        X*=n-i
        X%=mod
        Y*=i+1
        Y%=mod
    Y=pow(Y,mod-2,mod)
    X*=Y
    return X%mod

mod=10**9+7
n,a,b=map(int,input().split())
result=pow(2,n,mod)-cmb(n,a,mod)-cmb(n,b,mod)-1
if result<0:
    result+=mod
result%=mod
print(result)

Solution (Python):
def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def cmb(n,r,mod):
    X=1
    Y=1
    for i in range(r):
        X*=n-i
        X%=mod
        Y*=i+1
        Y%=mod
    Y=pow(Y,mod-2,mod)
    X*=Y
    return X%mod

mod=10**9+7
n,a,b=map(int,input().split())
result=pow(2,n,mod)-cmb(n,a,mod)-cmb(n,b,mod)-1
if result<0:
    result+=mod
result%=mod
print(result)

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


def comb_mod(n, k, mod):
    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_c_a = comb_mod(n, a, mod)
n_c_b = comb_mod(n, b, mod)

result = (pow(2, n, mod) - 1 - n_c_a - n_c_b) % mod
print(result)

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


def comb_mod(n, k, mod):
    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_c_a = comb_mod(n, a, mod)
n_c_b = comb_mod(n, b, mod)

result = (pow(2, n, mod) - 1 - n_c_a - n_c_b) % mod
print(result)

Solution (Python):
import sys
input = sys.stdin.readline
MOD = 10**9+7

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


def cmb(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


ans = pow(2, n, MOD) - 1 - cmb(n, a, MOD) - cmb(n, b, MOD)
if ans < 0:
    while ans < 0:
        ans += MOD
print(ans)

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

MOD = 10 ** 9 + 7

def comb(n, r):
    ret = 1
    for i in range(r):
        ret *= n - i
        ret *= pow(i+1, MOD-2, MOD)
        ret %= MOD

    return ret % MOD
    

ans = pow(2, n, MOD) - 1 - comb(n, a) - comb(n, b)
ans %= MOD
print(ans)

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

MOD = 10 ** 9 + 7

def comb(n, r):
    ret = 1
    for i in range(r):
        ret *= n - i
        ret %= MOD
    for i in range(r):
        ret *= pow(i+1, MOD-2, MOD)
        ret %= MOD

    return ret % MOD
    

ans = pow(2, n, MOD) - 1 - comb(n, a) - comb(n, b)
ans %= MOD
print(ans)

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


def comb_mod(n, k, mod):
    numerator = 1
    denominator = 1
    for i in range(k):
        numerator = (numerator * (n - i)) % mod
        denominator = (denominator * (i + 1)) % mod

    return ((numerator % mod) * (pow(denominator, mod - 2, mod) % mod)) % mod


n_c_a = comb_mod(n, a, mod)
n_c_b = comb_mod(n, b, mod)

result = ((pow(2, n, mod) - 1) % mod - n_c_a - n_c_b) % mod
print(result)

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


def comb_mod(n, k, mod):
    numerator = 1
    denominator = 1
    for i in range(k):
        numerator = (numerator * (n - i)) % mod
        denominator = (denominator * (i + 1)) % mod

    return ((numerator % mod) * (pow(denominator, mod - 2, mod) % mod)) % mod


n_c_a = comb_mod(n, a, mod)
n_c_b = comb_mod(n, b, mod)

result = (pow(2, n, mod) - 1 - n_c_a - n_c_b) % mod
print(result)

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


def comb_mod(n, k, mod):
    numerator = 1
    denominator = 1
    for i in range(k):
        numerator = numerator * (n - i) % mod
        denominator = denominator * (i + 1) % mod

    return ((numerator % mod) * (pow(denominator, mod - 2, mod) % mod)) % mod


n_c_a = comb_mod(n, a, mod)
n_c_b = comb_mod(n, b, mod)

result = (pow(2, n, mod) - 1 - n_c_a - n_c_b) % mod
print(result)

Solution (Python):
def fermat_binom(n,k,p):
  if k > n:
    return 0
  num = 1
  for i in range(n,n-k,-1):
    num = (num*i)%p
  denom = 1
  for i in range(1,k+1):
    denom = (denom*i)%p
  return (num * pow(denom,p-2,p))%p

if __name__ == '__main__':
  n, a, b = map(int, input().split())
  mod = 1000000007 
  k = pow(2, n, mod)
  r = k- 1- fermat_binom(n, a, mod) - fermat_binom(n, b, mod)
  r = (r%mod+mod)%mod
  print(max(r, 0))

Solution (Python):
import math
n,a,b=map(int,input().split())

count=0
mod=1000000007

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

count+=pow(2,n,mod)

count-=1
count-=C(n,a)

count-=C(n,b)

print(max(0,(count)%mod))

Solution (Python):
def cmb(n, r, mod):
    p, q = 1, 1
    for i in range(r):
        p *= n - i
        p %= mod
        q *= i + 1
        q %= mod
    
    return p * pow(q, mod - 2, mod)


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)

Solution (Python):
MOD = 1000000007

def pow(a, b):
    ret = 1
    while b > 0:
        if b%2 == 1:
            ret = ret*a%MOD
        a = a*a%MOD
        b //= 2
    return ret

def mul(s, e):
    ret = 1
    for i in range(s, e+1):
        ret = ret*i%MOD
    return ret

def fact(n):
    return mul(1, n)

def nCr(n, r):
    return mul(n-r+1, n) * pow(fact(r), MOD-2) % MOD

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

Solution (Python):
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)

Solution (Python):




from copy import *
from string import *				
from random import *				
from sys import stdin
from sys import maxsize

from itertools import *
from collections import Counter		
from collections import defaultdict 

'''
4 1 3
'''

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

def solve(n,a,b):
	mod = 10**9 + 7
	ans = pow(2,n,mod)
	ans -= nCr(n,a)
	ans -= nCr(n,b)
	return max(0,(ans-1)%mod)

n,a,b = map(int, stdin.readline().rstrip().split())
ans = solve(n,a,b)
print(ans)

Solution (Python):
from math import factorial
n, a, b = map(int, input().split(" "))
mod = pow(10, 9) + 7
ans = pow(2, n, mod)
ans = (ans - 1) % mod

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

Solution (Python):
import math
n,a,b = map(int,input().split())
mod = 10**9+7
k = 2
def Base_10_to_n(X,k):
  if (int(X/k)):
    return Base_10_to_n(int(X/k),k)+str(X%k)
  return str(X%k)
STR = Base_10_to_n(n,k)
ans = 1
cur = 2
for i in range(len(STR)):
    if STR[len(STR)-1-i] == '1':
        ans *= cur
        ans = ans%mod
    cur *= cur
    cur %= mod
    
ans -= 1
ans = ans%mod
L = [a,b]
cur = n
cur2 = n
for i in range(1,a):
    cur *= (n-i)*(pow(i+1, mod-2, mod))
    cur %= mod
for i in range(1,b):
    cur2 *= (n-i)*(pow(i+1, mod-2, mod))
    cur2 %= mod
cur %= mod
cur2 %= mod
ans -= cur
ans -= cur2
if ans < 0:
    while ans < 0:
        ans += mod
print(ans)

Solution (Python):
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)

Solution (Python):
mod = 1000000007


def mod_pow(a, n, p):
    if n == 1:
        return a % p
    if n % 2 == 1:
        return (a* mod_pow(a, n - 1, p)) % p
    tmp = mod_pow(a, n / 2, p)
    return ( tmp * tmp ) % p


def mod_cmb(n, k, p):
    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 * mod_pow(d, p - 2, p) % p

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

    ans = mod_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)

if __name__ == '__main__':
    main()

Solution (Python):
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)

Solution (Python):
mod = 10 ** 9 + 7

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


def choose(n, a, mod=mod):
    x, y = 1, 1
    for i in range(a):
        x = x * (n - i) % mod
        y = y * (i + 1) % mod
    return x * pow(y, mod - 2, mod)


ret = pow(2, n, mod)
ret -= 1
ret -= choose(n, a)
ret -= choose(n, b)
ret %= mod

print(ret)

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

def calculate_combination(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 - calculate_combination(n, a) - calculate_combination(n, b)
while ans < 0:
    ans += mod
print(ans)

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

Solution (Python):
MOD = 10 ** 9 + 7


class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    __radd__ = __add__

    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )

    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )


n, a, b = map(int, input().split())
ans = pow(2, n, MOD) - 1
product = ModInt(1)
div = ModInt(1)
for i in range(b + 1):
    product *= (n - i)
    div *= i + 1
    if i == a - 1 or i == b - 1:
        ans -= product / div
print(ans)

Solution (Python):
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==a)
print((pow(2,n,M)-s-r)%M)

Solution (Python):
def pow_self(x,n):
    ans = 1
    while n>0:
        if n&1 == 1:
            ans = (ans*x)%(10**9+7)
            
        x = (x*x)%(10**9+7)
        n >>= 1
    return ans

  
n,a,b = map(int, input().split())        
X,Y = 1,1
for i in range(b):
    X *= n-i
    X %= 10**9+7
    Y *= i+1
    Y %= 10**9+7

    if a-1 == i:
        Xa,Ya = X,Y

comb_a = (Xa*pow_self(Ya,10**9+5))%(10**9+7)
comb_b = (X*pow_self(Y,10**9+5))%(10**9+7)

result = pow_self(2,n)-1-comb_a-comb_b
while result <0:
    result += 10**9+7
print(result)

Solution (Python):
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+1in(a,b))
print((pow(2,n,M)-s)%M)

Solution (Python):
M=10**9+7
n,a,b=map(int,input().split())
def f(k):
 a=b=1;m=n
 for i in range(k):a=a*m%M;b=b*-~i%M;m-=1
 return a*pow(b,M-2,M)
print((~f(a)-f(b)+pow(2,n,M))%M)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
n,a,b = map(int,input().split())
lim = 10**9+7
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
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

print((pow(2,n,lim)-combination(n,a)-combination(n,b)-1) % lim)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):


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


def nCr(n,r):
    numerator, denominator = 1, 1
    for i in range(r):
        
        numerator = numerator * (n-i) % MOD
        
        denominator = denominator * (r-i) % MOD

    
    denominator = pow(denominator, MOD-2, MOD)
    return numerator * denominator % MOD

ans = pow(2, N, MOD)
ans -= (nCr(N, A) + nCr(N, B) + 1)
ans %= MOD
print(ans)

Solution (Python):
mod=10**9+7
n,a,b=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)

Solution (Python):
def cmb(n,r,mod):
    p,q=1,1
    if r>n/2:
        r=n-r
    for i in range(r):
        p*=n-i
        p%=mod
        q*=i+1
        q%=mod
    return (p*pow(q,mod-2,mod))%mod
    
n,a,b=map(int,input().split())
mod=10**9+7
v=pow(2,n,mod)-1
print((v-cmb(n,a,mod)-cmb(n,b,mod))%mod)

Solution (Python):

from math import factorial
import sys, math
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 1000000007

def combination(n, r):
    r = min(r, n - r)
    num = 1
    den = 1
    for i in range(1, r + 1):
        num = (num * (n + 1 - i)) % MOD
        den = (den * i) % MOD
    return num * pow(den, MOD - 2, MOD) % MOD

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

result_ = pow(2, N) - 1 - combination(N, A) - combination(N, B)
print(result_ % MOD)

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


def mod_cmb(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


answer = pow(2, n, mod) - 1
answer -= mod_cmb(n, a, mod) + mod_cmb(n, b, mod)
answer %= mod
print(answer)

Solution (Python):




def modPow (a,n,p):
    if n==1:
        return a % p
    if n%2 == 1:
        return (a * modPow(a,n-1,p)) % p
    else:
        t = modPow(a,n/2,p)
        return t * t



n,a,b = map(int,input().split())
p = 10**9+7
if n == 2 :
    print(0)
else:

    ans = modPow(2,n,p)-1

    child_a = 1
    mother_a = 1
    for i in range(a):
        child_a = (child_a*(n-i))%p
        mother_a = (mother_a*(i+1))%p
    com_a = (child_a * modPow(mother_a,p-2,p)) % p
    child_b = 1
    mother_b = 1
    for i in range(b):
        child_b = (child_b*(n-i))%p
        mother_b = (mother_b*(i+1))%p
    com_b = (child_b * modPow(mother_b,p-2,p)) % p
    ans = (ans -(com_a+com_b))%p
    print(ans%p)

Solution (Python):
from functools import reduce
def nCr(n,r,DIV):
  
  X=reduce(lambda x,y:x*y%DIV,range(n-r+1,n+1))
  Y=reduce(lambda x,y:x*y%DIV,range(1,r+1))
  return X*pow(Y,DIV-2,DIV)%DIV

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

Solution (Python):
N, A, B = map(int, input().split())
MOD = 10**9 + 7

def pow(x, y):
  if y == 0:
    return 1
  K = 1
  while y > 1:
    if y % 2 == 0:
      y = y // 2
      x = (x * x) % MOD
    else:
      K = (K * x) % MOD
      y -= 1
  return (K * (x ** y)) % MOD

def comb_mod(p, q):
  bunsi = 1
  bunbo = 1
  for i in range(q):
    bunsi = (bunsi * (p-i)) % MOD
    bunbo = (bunbo * (i+1)) % MOD
  return ((bunsi * pow(bunbo, MOD - 2)) % MOD)

print((pow(2,N) - 1 - comb_mod(N, A) - comb_mod(N, B)) % MOD)

Solution (Python):
n, a, b=map(int, input().split())
mod = 10 ** 9 + 7 
def cmb(n, r, mod):
    r = min(r, n -r)
    if r == 0: return 1
    over, under = 1, 1
    for i in range(1, r+1):
        over = over * (n-i+1) % mod
        under = under * i % mod
    
    inv=pow(under, mod-2, mod)
    
    return over*inv % mod
  
print((pow(2,n,mod)-1 - cmb(n, a,mod)-cmb(n,b,mod))%mod)

Solution (Python):
input = raw_input

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

from math import factorial

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



def power(n, r, mod):
    if r == 0: return 1
    
    
    
    if True:
        if r%2 == 0:
            ret = power(n*n % mod, r//2, mod) % mod
        if r%2 == 1:
            ret = n * power(n, r-1, mod) % mod
        
    return ret


def comb(n, k, mod):
    k = min(k, n-k)
    bunshi = 1
    bunbo = 1
    for i in range(k):
        bunshi = bunshi * (n-i)
        bunshi = bunshi % M
        bunbo = bunbo * (i+1)
        bunbo = bunbo % M

    ret = (bunshi * power(bunbo, mod-2, mod)) % mod
    
    
    
    
    return ret


if False:
    comb_dict = {}
    comb_dict[(1, 0)] = 1
    comb_dict[(1, 1)] = 1

    zenbu2 = 1
    for i in range(2, n+1):
        new_comb_dict = {}
        new_comb_dict[(i, 0)] = 1
        new_comb_dict[(i, i)] = 1
        for j in range(1, i):
            tmp = comb_dict[(i-1, j-1)] + comb_dict[(i-1, j)]
            tmp = tmp % M
            new_comb_dict[(i, j)] = tmp
            if i == n:
                zenbu2 += tmp

        comb_dict = new_comb_dict


















zenbu = power(2, n, M) - 1

A = comb(n, a, M)

B = comb(n, b, M)


out = zenbu - A - B

out = out % M
print(out)

Solution (Python):







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

def cmb(n,r,mod):
    x=1
    y=1
    for i in range(0,r,1):
        x=(x*(n-i))%mod
        y=(y*(i+1))%mod
    x=x%mod
    y2=modpow(y,mod-2,mod)
    return (x*y2)%mod

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



print((modpow(2,n,p)-1-cmb(n,a,p)-cmb(n,b,p))%p)

Solution (Python):
N, A, B = map(int, input().split())
MOD = 10**9 + 7


def f(n, a):
    x, y = 1, 1
    for i in range(1, a+1):
        x = x * (n-i+1) % MOD
        y = y * i % MOD
    return x, y


def modpow(a: int, p: int, mod: int) -> int:
    res = 1
    while p > 0:
        if p & 1 > 0:
            res = res * a % mod
        a = a**2 % mod
        p >>= 1
    return res


ans = modpow(2, N, MOD) - 1
a_x, a_y = f(N, A)
b_x, b_y = f(N, B)

a = a_x * modpow(a_y, (MOD-2), MOD) % MOD
b = b_x * modpow(b_y, (MOD-2), MOD) % MOD
print((ans - a - b) % MOD)

Solution (Python):
import math
def f_pow(x,n):
    if n == 0:
        return 1
    half = f_pow(x, n//2)
    if n % 2:
        return x * half * half % mod
    else:
        return half * half % mod

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 * f_pow(q, mod-2)%mod

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

s = f_pow(2, n) - 1
print((s - c(n,a) - c(n,b))%mod)

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

mod = 10**9+7 
N = 10**5 * 2
def cmb(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
def p(n,r):
    if ( r<0 or r>n ):
        return 0
    return g1[n] * g2[n-r] % mod

g1 = [1, 1] 
g2 = [1, 1] 
inverse = [0, 1] 

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


import fractions
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

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

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

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


n,a,b = m()

nn = str(n)[::-1]

co = 1

tw = [[1] for i in range(10)]
for i in range(9):
    tw[0].append(tw[0][-1] * 2)
for i in range(1,10):
    for j in range(9):
        if j == 0:
            tw[i].append((tw[i-1][-1] * tw[i-1][1])%mod)
        else:
            tw[i].append((tw[i][-1]*tw[i][1])%mod)

for i in range(len(nn)):
    if i == 0:
        co *= tw[i][int(nn[i])]
    else:
        co = (co * tw[i][int(nn[i])])%mod
        co = co % mod

aaa = 1
bbb = 1
for i in range(min(a,n-a)):
    aaa *= (n-i)
    aaa %= mod
    if i == min(a,n-a)-1:
        aaa *= g2[i+1]
        aaa %= mod
for i in range(min(b,n-b)):
    bbb *= (n-i)
    bbb %= mod
    if i == min(b,n-b)-1:
        bbb *= g2[i+1]
        bbb %= mod


print((co - aaa - bbb - 1)%mod)

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


def powmod(x, y, mod):
    if y == 0:
        return 1
    return (((powmod(x, y >> 1, mod) ** 2) % mod) * x ** (y & 1)) % mod


def cmb(n, r, MOD):
    if n < r:
        return 0
    if n-r < r:
        r = n-r
    comb = 1
    for x in range(n-r+1, n+1):
        comb = (comb * x) % MOD
    d = 1
    for x in range(1, r+1):
        d = (d * x) % MOD
    comb *= powmod(d, MOD-2, MOD)
    return comb % MOD


a = cmb(n, a, mod)
b = cmb(n, b, mod)
ans = powmod(2, n, mod) - a - b - 1
print(ans % mod)

Solution (Python):
def main():
  n,a,b = map(int,input().split())
  MOD = 10 ** 9 + 7
  ans = pow(2,n,MOD) - 1
  P = 1
  F = 1

  for i in range(1,b + 1):
    P = P * (n - i + 1) % MOD 
    F = F * i % MOD  
    if i == a or i == b:
      
      ans -= P * pow(F,MOD - 2,MOD)
  
  print(ans % MOD)

main()