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 in Ruby (2.3.3) (judge verdict: Accepted)

#!/usr/bin/env ruby

M = 10**9 + 7

def mpow(n, p)
	if p == 1
		return n
	end
	
	m = (n ** 2) % M
	q = p / 2
	if p % 2 == 0
		return mpow(m, q) % M
	else
		return (mpow(m, q) * n) % M
	end
end

def mminus(a, b)
	n = a - b
	if n < 0
		n = n + M
	end
	return n
end

def mmulti(m, n)
	return m * n % M
end

def mfact(n)
	a = 1

	for i in 1..n
		a = mmulti(a, i)
	end
	
	return a
end

def minv(a)
	return mpow(a, M - 2)
end

def mcombi(n, k)
	min = [k, n - k].min
	max = [k, n - k].max
	return n if min == 1
	return 1 if min == 0
	
	a = 1
	for i in (max+1)..n
		a = mmulti(a, i)
	end
	
	b = mfact(k)
	
	return mmulti(a, minv(b))
end

(x, a, b)  = STDIN.gets.chomp.split(/\s/).map { |e| e.to_i }

ans = mminus(mminus(mpow(2, x) - 1, mcombi(x, a)), mcombi(x, b))

puts ans