Problem:
Score : 400 points

Problem Statement

We have a large square grid with H rows and W columns.
Iroha is now standing in the top-left cell.
She will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell.

However, she cannot enter the cells in the intersection of the bottom A rows and the leftmost B columns. (That is, there are A×B forbidden cells.) There is no restriction on entering the other cells.

Find the number of ways she can travel to the bottom-right cell.

Since this number can be extremely large, print the number modulo 10^9+7.

Constraints

1 ≦ H, W ≦ 100,000

1 ≦ A < H

1 ≦ B < W

Input

The input is given from Standard Input in the following format:

H W A B

Output

Print the number of ways she can travel to the bottom-right cell, modulo 10^9+7.

Sample Input 1

2 3 1 1

Sample Output 1

2

We have a 2×3 grid, but entering the bottom-left cell is forbidden. The number of ways to travel is two: "Right, Right, Down" and "Right, Down, Right".

Sample Input 2

10 7 3 4

Sample Output 2

3570

There are 12 forbidden cells.

Sample Input 3

100000 100000 99999 99999

Sample Output 3

1

Sample Input 4

100000 100000 44444 55555

Sample Output 4

738162020

Solution in Rust (1.42.0) (judge verdict: Accepted)

extern crate proconio;
use proconio::input;

mod mint {
    use std::ops::{Add, Div, Mul, Sub};

    type Int = i64;
    pub const MOD: Int = 1_000_000_000 + 7;
    #[derive(Clone, Copy)]
    pub struct Mint {
        x: Int,
    }
    impl Mint {
        pub fn new(x: Int) -> Mint {
            Mint {
                x: (x % MOD + MOD) % MOD,
            }
        }
        pub fn val(&self) -> Int {
            self.x
        }
    }
    impl Add<Int> for Mint {
        type Output = Mint;
        fn add(self, rhs: Int) -> Mint {
            Mint::new(self.val() + (rhs % MOD))
        }
    }
    impl Add for Mint {
        type Output = Mint;
        fn add(self, rhs: Mint) -> Mint {
            self + rhs.val()
        }
    }
    impl Sub<Int> for Mint {
        type Output = Mint;
        fn sub(self, rhs: Int) -> Mint {
            Mint::new(self.val() - (rhs % MOD))
        }
    }
    impl Sub for Mint {
        type Output = Mint;
        fn sub(self, rhs: Mint) -> Mint {
            self - rhs.val()
        }
    }
    impl Mul<Int> for Mint {
        type Output = Mint;
        fn mul(self, rhs: Int) -> Mint {
            Mint::new(self.val() * (rhs % MOD))
        }
    }
    impl Mul for Mint {
        type Output = Mint;
        fn mul(self, rhs: Mint) -> Mint {
            self * rhs.val()
        }
    }
    impl Mint {
        pub fn pow(x: Mint, y: Int) -> Mint {
            assert!(y >= 0);
            let mut res = Mint::new(1);
            let mut base = x;
            let mut exp = y;
            while exp > 0 {
                if (exp & 1) == 1 {
                    res = res * base;
                }
                base = base * base;
                exp = exp / 2;
            }
            res
        }
        pub fn inv(self) -> Mint {
            Mint::pow(self, MOD - 2)
        }
    }
    impl Div<Int> for Mint {
        type Output = Mint;
        fn div(self, rhs: Int) -> Mint {
            self * Mint::new(rhs).inv()
        }
    }
    impl Div for Mint {
        type Output = Mint;
        fn div(self, rhs: Mint) -> Mint {
            self * rhs.val()
        }
    }
    impl std::fmt::Display for Mint {
        fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
            write!(f, "{}", self.val())
        }
    }
}

use mint::Mint;

struct Cmb {
    fac: Vec<Mint>,
    fac_inv: Vec<Mint>,
}

impl Cmb {
    pub fn new(n: usize) -> Cmb {
        let mut fac = vec![Mint::new(0); n];
        let mut fac_inv = vec![Mint::new(0); n];
        fac[0] = Mint::new(1);
        for i in 1..n {
            fac[i] = fac[i - 1] * (i as i64);
        }
        fac_inv[n - 1] = fac[n - 1].inv();
        for i in (0..n - 1).rev() {
            fac_inv[i] = fac_inv[i + 1] * ((i + 1) as i64)
        }
        Cmb { fac, fac_inv }
    }
    pub fn binom(&self, a: usize, b: usize) -> Mint {
        if a < b {
            return Mint::new(0);
        }
        self.fac[a] * self.fac_inv[b] * self.fac_inv[a - b]
    }
}

fn main() {
    // .......
    // .......
    // .......
    // .......
    // .......
    // .......
    // .......
    // ####...
    // ####...
    // ####...
    input! {
        h: usize,
        w: usize,
        a: usize,
        b: usize,
    }
    let cmb = Cmb::new(h + w);
    let count = |x: usize, y: usize| cmb.binom(x + y, x);
    let mut ans = Mint::new(0);
    ans = ans + count(h - 1, w - 1);
    for j in 1..=b {
        // (1, 1) -> (h - a, j)
        // (h - a + 1, j) -> (h, w)
        let s = count(h - a - 1, j - 1) * count(a - 1, w - j);
        ans = ans - s;
    }
    println!("{}", ans);
}