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 C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc156_d
{
  class Program
  {
    static void Main(string[] args)
    {
      var n = CIn.ReadInt();
      var a = CIn.ReadInt();
      var b = CIn.ReadInt();

      var mod = new Mod((int)1e9 + 7);

      var aa = Enumerable.Range(n - a + 1, a).Aggregate((p, c) => (int)mod.Mul(p, c));
      var bb = Enumerable.Range(n - b + 1, b).Aggregate((p, c) => (int)mod.Mul(p, c));

      var ans = mod.Sum(mod.Pow(2, n), -mod.Div(aa, mod.Fac(a)), -mod.Div(bb, mod.Fac(b)), -1);

      Console.WriteLine(ans);
    }
  }

  class Mod
  {
    public int N { get; }
    private readonly List<long> fac = new List<long>() { 1, 1 };
    private readonly List<long> inv = new List<long>() { 0, 1 };
    private readonly List<long> facInv = new List<long>() { 1, 1 };

    public Mod(int n) { N = n; }

    public long Add(long a, long b) => (a % N + b % N + N) % N;
    public long Sub(long a, long b) => Add(a, -b);
    public long Mul(long a, long b) => (a % N * b % N + N) % N;
    public long Div(long a, long b) => Mul(a, Inv(b));
    public long Sum(params long[] args) => args.Aggregate(Add);

    public long Inv(long a)
    {
      if (a < inv.Count) return inv[(int)a];
      long b = N, x = 1, y = 0, tmp;
      while (b != 0)
      {
        var q = a / b;
        tmp = y;
        y = x - q * y;
        x = tmp;
        tmp = b;
        b = a - q * b;
        a = tmp;
      }
      return (x % N + N) % N;
    }

    public long Pow(long a, long n)
    {
      var result = 1L;
      while (n > 0)
      {
        if ((n & 1) == 1) result = Mul(result, a);
        a = Mul(a, a);
        n >>= 1;
      }
      return result;
    }

    public void InitSeq(int n)
    {
      for (var i = fac.Count; i <= n; i++)
      {
        fac.Add(fac[i - 1] * i % N);
        inv.Add(N - inv[N % i] * (N / i) % N);
        facInv.Add(facInv[i - 1] * inv[i] % N);
      }
    }

    public long Fac(int n)
    {
      InitSeq(n);
      return fac[n];
    }

    public long Per(int n, int k)
    {
      if (n < k || n < 0 || k < 0) return 0;
      InitSeq(n);
      return fac[n] * facInv[n - k] % N;
    }

    public long Com(int n, int k)
    {
      if (n < k || n < 0 || k < 0) return 0;
      InitSeq(n);
      return fac[n] * (facInv[k] * facInv[n - k] % N) % N;
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}