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 Rust (1.42.0) (judge verdict: Accepted)

#![allow(non_snake_case)]
//use permutohedron::LexicalPermutation as _;
use proconio::input;
//use proconio::marker::*;
//use std::collections::HashSet;
//use std::collections::HashMap;
//use std::collections::BTreeMap;
//use std::cmp::*;
//use std::num;
//use petgraph::unionfind::UnionFind;
const MOD: i64 = 1_000_000_000 + 7;
fn main() {
    input! {
        n:i64,a:i64,b:i64
    }
    // n choose r の合計、ただしr=a,bを除く。
    // n choose r = fact[n] * modInv(fact[n-r])*modInv(fact[r])
    // let mut fact = vec![1i64; n + 1];
    //  let mut ifact = vec![1i64; n + 1];
    let mut fact = 1;
    let mut fact_a = 0;
    let mut fact_b = 0;
    let mut fact_na = 0;
    let mut fact_nb = 0;
    for i in 1i64..=b as i64 {
        fact = fact * i % MOD;
        //println!("fact[{}]={}", i, fact);
        match i {
            i if i == a => {
                fact_a = fact;
            }
            i if i == b => {
                fact_b = fact;
            }
            _ => (),
        }
    }
    fact = 1;
    for i in ((n - b) as i64..=n as i64).rev() {
        fact = fact * i % MOD;
        match i {
            i if i == n - a + 1 => {
                fact_na = fact;
            }
            i if i == n - b + 1 => {
                fact_nb = fact;
            }
            _ => (),
        }
    }

    //println!("{},{},{},{}", fact_a, fact_b, fact_na, fact_nb);
    let mut ans = modPow(2, n as i64) - 1;
    let choose_na = fact_na * modInv(fact_a) % MOD;
    let choose_nb = fact_nb * modInv(fact_b) % MOD;
    ans = (ans + MOD + MOD - choose_na - choose_nb) % MOD;
    println!("{}", ans);
}

fn modPow(x: i64, a: i64) -> i64 {
    if a == 0 {
        1
    } else {
        if a % 2 != 0 {
            modPow(x, a - 1) * x % MOD
        } else {
            let y = modPow(x, a / 2);
            y * y % MOD
        }
    }
}
fn modInv(x: i64) -> i64 {
    modPow(x, MOD - 2) % MOD
}