Under construction

Still being built. Things may change

Amazing Images

Interview

Time limit0.6sMemory limit1024 MB

Summary
Count the colorings of an M by N pixel grid where every K consecutive columns include a column with at least F black pixels, modulo 1,000,000,007.
Level

Medium5 of 10

Topics
Dynamic programming, Prefix sum, Combinatorics
Solved
No attempts yet

Problem

Fourier has an image of M×NM \times N pixels (MM lines, NN columns). All the pixels are initially white. Fourier wants to color some pixels black to obtain an amazing image. He considers an image amazing if, in every contiguous group of KK pixel columns, at least one column contains at least FF black pixels.

Fourier wants to know how many ways he can color the image, and he asks you to compute this count.

Input

The input contains a single line with four integers MM, NN, KK, and FF, in that order.

Output

Print a single integer, the number of amazing images modulo 1,000,000,007.

Constraints

1≤K≤N1 \le K \le N

1≤F≤M1 \le F \le M

Examples2

  1. Example 1

    Input
    2 6 2 2
    
    Expected output
    217
    
  2. Example 2

    Input
    2 6 2 1
    
    Expected output
    3105