Under construction

Still being built. Things may change

Baseball Court

Time limit4sMemory limit1024 MB

Summary
Count the ways to place all N unit tiles in an a by b plot so each outer corner tile lies at the same Manhattan distance from the south-west corner.
Level

Medium7 of 10

Topics
Dynamic programming, Combinatorics, Math
Solved
No attempts yet

Problem

After lengthy meetings on the subject, the NCPC jury decided that getting the contestants' blood pumping would lead to better contests. So they planned a sports competition for bragging rights before the programming contest. A random draw from a hat picked baseball. What remains is building a suitable court to play on. The NCPC jury has a rectangular plot of land aa by bb meters in size. They also have NN square grass tiles, each 11 by 11 meter, which they can place on the plot to build the court. All grass tiles must be placed with their sides parallel to the edges of the plot.

The south-west corner of the land is the batting point. For the tiles to form a valid court, two conditions must hold. First, for every tile, its south and west sides must either lie directly against the edge of the plot or directly against another tile. This keeps the ball from leaving and re-entering the court along a straight trajectory. Second, every tile that has no adjacent tile to its north or east must have the same Manhattan distance from the batting point. This keeps batters from preferring some directions over others.

Find the number of ways to place the tiles so that they form a valid baseball court.

Input

The first line contains a single positive integer NN (1≤N≤1041 \leq N \leq 10^4), the number of grass tiles available. The second line contains two positive integers aa and bb (1≤a,b≤1041 \leq a, b \leq 10^4), the size of the land the court can be made within.

Output

Print the number of valid ways to place the grass tiles to make up a baseball court. All nn grass tiles must be used. Since this number might be very large, print the answer modulo 109+710^9 + 7.

Examples3

  1. Example 1

    Input
    15
    3 8
    
    Expected output
    3
    
  2. Example 2

    Input
    15
    3 5
    
    Expected output
    1
    
  3. Example 3

    Input
    15
    3 4
    
    Expected output
    0