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 Ruby (2.3.3) (judge verdict: Runtime Error)

MOD = 1_000_000_007

class Combination
  def initialize
    @fact = (1..10**5+1).to_a
    @fact.each_with_index do |e, idx|
      @fact[idx] = @fact[idx] * @fact[idx-1] % MOD if idx > 0
    end
  end

  def choose(n, r)
    return 0 if not (0 <= r and r <= n)
    return 1 if r == 0 or r == n
    fact(n) * inverse( fact(r) * fact(n-r) )
  end

  def fact(n)
    @fact[n-1]
  end

  def inverse(x)
    pow(x, MOD-2)
  end

  def pow(x, n)
    ans = 1
    while n > 0
      ans = ans * x % MOD if n.odd?
      x = x * x % MOD
      n >>= 1
    end
    ans
  end
end

lines = $stdin.read
array = lines.split("\n")
H,W,A,B = array[0].split(" ").map(&:to_i)

@comb = Combination.new

minus = 0

for y in 0...A
  for x in 0...B
    #puts "#{x},#{y}"
    #puts "compare with (0,#{H-1}), x dist = #{x}, y dist = #{H-1-y}"
    n1,r1 = x+(H-1-y),x
    ans1  = @comb.choose(n1,r1) % MOD
    #puts " => #{n1}C#{r1} = #{@comb.choose(n1,r1)%MOD}"

    #puts "compare with (#{W-1},0), x dist = #{W-1-x}, y dist = #{y}"
    n2,r2 = y+(W-1-x),y
    ans2  = @comb.choose(n2,r2) % MOD
    #puts " => #{n2}C#{r2} = #{@comb.choose(n2,r2)%MOD}"

    #puts "minus = #{ans1*ans2}"
    minus += ans1*ans2 %MOD
  end
end

puts @comb.choose(H-1+W-1,H-1)% MOD - minus % MOD