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)

use std::io::{stdin, Read};
const MOD: usize = 1000000007;
fn gcd(a: usize, b: usize) -> usize {
    match b {
        0 => a,
        _ => gcd(b, a % b),
    }
}

fn powmod(base: usize, exp: usize, m: usize) -> usize {
    let b: Vec<bool> = format!("{:b}", exp)
        .chars()
        .map(|x| x.to_digit(10).unwrap() != 0)
        .collect();
    let mut v = 1;
    for bi in b {
        v *= v;
        v %= m;
        if bi {
            v *= base;
            v %= m
        }
    }
    return v % m;
}

fn invmod(x: usize, m: usize) -> usize {
    powmod(x, m - 2, m)
}

fn prime_factors(x: usize) -> Vec<usize> {
    let mut res = vec![];
    let mut y = x;
    let mut p = 2;
    let upper = (y as f64).sqrt() as usize;
    while y > 1 && p <= upper {
        match y % p {
            0 => {
                res.push(p);
                y /= p;
            }
            _ => {
                p += 1;
            }
        }
    }
    if y > 1 {
        res.push(y)
    }
    return res;
}

fn get_factorials(n: usize, m: usize) -> Vec<usize> {
    let mut res = vec![0; n as usize];
    res[0] = 1;
    for i in 1..(n as usize) {
        res[i] = (res[i - 1] * (i as usize)) % m;
    }
    res
}

fn get_facinvs(n: usize, m: usize, facts: &Vec<usize>) -> Vec<usize> {
    let mut res = vec![0; n];
    res[n - 1] = invmod(facts[n - 1], m);
    for i in (0..(n - 1)).rev() {
        res[i] = (res[i + 1] * (i + 1)) % m;
    }
    res
}

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: ident) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn combmod(a: usize, b: usize) -> usize {
    let mut x = 1;
    for i in 0..b {
        x *= a - i;
        x %= MOD;
    }
    let mut y = 1;
    for i in 1..(b + 1) {
        y *= i;
        y %= MOD;
    }
    let y = invmod(y, MOD);
    (x * y) % MOD
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    let mut it = s.split_whitespace();
    let (n, a, b): (usize, usize, usize) = parse!(it, 3);
    let ret = 10 * MOD + powmod(2, n, MOD) - combmod(n, a) - combmod(n, b) - 1;
    let ret = ret % MOD;
    println!("{}", ret);
}