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 Haskell (GHC 7.10.3) (judge verdict: Accepted)

module Main where

import Data.List
import Data.Char (digitToInt)
import Control.Monad
import Debug.Trace
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import qualified Data.Map.Strict as M
import qualified Data.Vector.Unboxed as V


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as = let
    (fo, la) = span f as
    las = case la of
        [] -> []
        xs -> split f $ tail xs
    in
        case fo of
            [] -> las
            xs -> xs : las

fastPowerMod :: Int -> Int -> Int -> Int
fastPowerMod b 0 _ = 1
fastPowerMod b 1 modnum = b `mod` modnum
fastPowerMod b n modnum
            | even n = (fastPowerMod b (n `div` 2) modnum ^ 2) `mod` modnum
            | otherwise = (fastPowerMod b (n - 1) modnum * b) `mod` modnum

modInverse :: Int -> Int -> Int
modInverse n modnum = fastPowerMod n (modnum - 2) modnum

combinationM :: Int -> Int -> Int -> Int
combinationM  _ 0 _ = 1
combinationM  n 1 _ = n
combinationM  n k modnum
            | n < k = 0
            | k > (n - k) = combinationM  n (n - k) modnum
            | otherwise = upper * kfinv `mod` modnum where
                upper = prodMod [n,(n-1)..(n - k+1)] modnum
                kfinv = modInverse (prodMod [1..k] modnum) modnum

solve :: [Int] -> Int
solve xs = snd $ head $ sortOn snd $ fmap addV [1..100] where
    addV n = (n, sum $ fmap (\x -> (x - n) ^ 2 ) xs)

prodMod :: [Int] -> Int -> Int
prodMod xs modnum = foldl' (\b a -> b * a `mod` modnum) 1 xs

modSub :: Int -> Int -> Int -> Int
modSub mod a b
            | a < b = a - b + mod
            | otherwise = a - b


main = do
    (n, a, b) <- readTuple3
    let modnum = 1000000007
    let modSuba = modSub modnum
    print $ fastPowerMod 2 n modnum `modSuba` combinationM n a modnum `modSuba` combinationM n b modnum - 1