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 AtCoders {
	class Program {
		static void Main(string[] args) {

			var inputArray = retreiveLongArray();
			var inputCount = 3;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}

			var N = inputArray[0];
			var a = inputArray[1];
			var b = inputArray[2];

			//答えの出力
			var ans = getAns(N,a,b);
			Console.WriteLine(ans);

		}

		/// <summary>
		/// 答えを求める
		/// </summary>
		/// <param name="N"></param>
		/// <param name="a"></param>
		/// <param name="b"></param>
		/// <returns></returns>
		private static long getAns(long N, long a, long b) {

			if (N == 2) {
				return 0;
			}

			long limit = 1000000000 + 7;
			//a,bの条件を考えない場合 2n-1通り。(-1は一本も選ばないとき)
			var pattern = repeatNijou(2, N, limit)-1;
			//Console.WriteLine($"合計{pattern}");
			var num_a = calcCombination(N, a, limit);
			var num_b = calcCombination(N, b, limit);
			var ans = pattern - num_a - num_b;
			//nCaをlimitで割ったあまりは,
			while (ans < 0) {
				//Console.WriteLine($"途中経過{ans}");
				ans = ans + limit;
			}

			return ans;
		}

		/// <summary>
		/// 繰り返し2乗法
		/// </summary>
		/// <param name="tei"></param>
		/// <param name="beki"></param>
		/// <param name="limit"></param>
		/// <returns></returns>
		private static long repeatNijou(long tei,long beki, long limit) {

			if (beki == 1) {
				return tei;
			}

			var result = repeatNijou(tei, beki / 2, limit) % limit;
			//べきが偶数のときは、半分同士をかける
			if (beki%2 == 0) {
				var ans = result*result;
				return (ans % limit);
			}//べきが奇数の時
			else {
				var ans = ((result * result)%limit) * tei;
				return (ans % limit);
			}

		}

		/// <summary>
		/// n個からp個を選ぶ組み合わせの数をlimitで割ったあまりを求める
		/// X*Y(limit-2)
		/// </summary>
		/// <param name="n"></param>
		/// <param name="p"></param>
		/// <returns></returns>
		private static long calcCombination(long N, long p,long limit) {

			long x = 1;
			long y = 1;


			for (long i = 0; i < p; i++) {
				x = (x * (N - i) )% limit;//分子
				y=(y*(i+1)) % limit;//分母
				//Console.WriteLine($"p={p},combi={combinationNum}");
			}

			var longAns = x * repeatNijou(y, limit - 2, limit);
			return longAns % limit;
		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray =  Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}