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.15.1) (judge verdict: Accepted)

#![allow(unused)]

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
//入力マクロここまで

mod mod_int {
    const MOD: u64 = 1_000_000_007;

    use std::ops::*;

    #[derive(Clone, Copy, PartialEq, Debug)]
    pub struct ModInt(u64);

    impl ModInt {
        pub fn new(x: u64) -> Self {
            if x < MOD {
                ModInt(x)
            } else {
                ModInt(x % MOD)
            }
        }

        //ModIntのMulAssign,Mulに依存
        pub fn pow(self, n: u64) -> ModInt {
            let mut t = ModInt::new(1);
            let mut a = self;
            let mut n = n;
            while n > 0 {
                if n & 1 == 1 {
                    t *= a;
                }
                n >>= 1;
                a *= a;
            }
            t
        }

        pub fn as_u64(self) -> u64 {
            self.0
        }
    }

    // 階乗のテーブル
    pub fn gen_fact_table(n: usize) -> Vec<ModInt> {
        let mut res = vec![ModInt::new(1); n + 1];
        for i in 0..n {
            res[i + 1] = res[i] * ModInt::new((i + 1) as u64);
        }
        res
    }

    // 逆元のテーブル
    pub fn gen_inv_table(n: usize) -> Vec<ModInt> {
        let mut res = vec![ModInt::new(0); n + 1];
        res[1] = ModInt::new(1);
        for i in 2..n + 1 {
            res[i] = -res[MOD as usize % i] * ModInt::new((MOD / i as u64) as u64);
        }
        res
    }

    // 階乗のmod pについての逆元のテーブル
    pub fn gen_fact_inv_table(n: usize, inv: Vec<ModInt>) -> Vec<ModInt> {
        let mut res = vec![ModInt::new(0); n + 1];
        res[1] = ModInt::new(1);
        for i in 2..n + 1 {
            res[i] = res[i - i] * inv[i];
        }
        res
    }

    //rhs: ModInt
    //rhs.0: u64
    impl Add for ModInt {
        type Output = ModInt;
        fn add(self, rhs: ModInt) -> ModInt {
            let t = self.0 + rhs.0;
            if t > MOD {
                ModInt(t % MOD)
            } else {
                ModInt(t)
            }
        }
    }

    impl Sub for ModInt {
        type Output = ModInt;
        fn sub(self, rhs: ModInt) -> ModInt {
            let t = if self.0 >= rhs.0 {
                self.0 - rhs.0
            } else {
                self.0 + MOD - rhs.0
            };
            ModInt(t)
        }
    }

    impl Mul for ModInt {
        type Output = ModInt;
        fn mul(self, rhs: ModInt) -> ModInt {
            let t = self.0 * rhs.0 % MOD;
            ModInt(t)
        }
    }

    impl Div for ModInt {
        type Output = Self;
        fn div(self, rhs: ModInt) -> ModInt {
            assert!(rhs.0 != 0);
            self * rhs.pow(MOD - 2)
        }
    }

    // 単項-(符号反転)
    impl Neg for ModInt {
        type Output = ModInt;
        fn neg(self) -> ModInt {
            ModInt::new(MOD - self.0)
        }
    }

    impl AddAssign for ModInt {
        fn add_assign(&mut self, rhs: ModInt) {
            *self = *self + rhs;
        }
    }
    impl SubAssign for ModInt {
        fn sub_assign(&mut self, rhs: ModInt) {
            *self = *self - rhs;
        }
    }

    impl MulAssign for ModInt {
        fn mul_assign(&mut self, rhs: Self) {
            *self = *self * rhs;
        }
    }

    impl DivAssign for ModInt {
        fn div_assign(&mut self, rhs: ModInt) {
            *self = *self / rhs;
        }
    }
}

use mod_int::{gen_fact_table, ModInt};

fn main() {
    input! {
        n: usize,
        a: usize,
        b: usize,
    }

    let k = std::cmp::min(200_000, n);

    let ft = gen_fact_table(k);

    let nca = {
        let mut nca = ModInt::new(1);

        for i in 1..a + 1 {
            nca *= ModInt::new(n as u64 - i as u64 + 1);
        }

        nca / ft[a]
    };

    let ncb = {
        let mut ncb = ModInt::new(1);

        for i in 1..b + 1 {
            ncb *= ModInt::new(n as u64 - i as u64 + 1);
        }

        ncb / ft[b]
    };

    let ans = ModInt::new(2).pow(n as u64) - ModInt::new(1) - nca - ncb;

    println!("{}", ans.as_u64());
}