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")
    };
}
//入力マクロここまで

fn mod_pow(a: u64, n: u64, p: u64) -> u64 {
    let mut ans = 1;
    let mut a = a;
    let mut n = n;

    while n > 0 {
        if n & 1 == 1 {
            ans = ans * a % p
        }
        a = a * a % p;
        n >>= 1;
    }

    ans
}

fn inv_init(n: usize, p: u64) -> Vec<u64> {
    let mut inv = vec![0; n + 1];

    inv[1] = 1;

    for i in 2..n + 1 {
        inv[i] = p - inv[p as usize % i] * (p / i as u64) % p;
    }

    inv
}

fn com_init(n: u64, k: usize, p: u64, inv: &Vec<u64>) -> Vec<u64> {
    let mut com = vec![0; k + 1];

    com[0] = 1;

    let end = std::cmp::min(n, k as u64) as usize;

    for i in 1..end + 1 {
        com[i] = com[i - 1];
        com[i] *= (n - (i as u64) + 1) % p;
        com[i] %= p;
        com[i] *= inv[i];
        com[i] %= p;
    }
    com
}

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

    let p: u64 = 1_000_000_007;
    let k: usize = 200_000;

    let inv = inv_init(k, p);
    let com = com_init(n, k, p, &inv);

    let m_mod = |a: i64, b: i64| {
        let r = a % b;
        if r < 0 {
            r + b.abs()
        } else {
            r
        }
    };

    let pow = mod_pow(2, n as u64, p);

    println!(
        "{}",
        m_mod((pow as i64 - 1 - com[a] as i64 - com[b] as i64), p as i64)
    );
}