Under construction

Still being built. Things may change

Cutting a Hypertriangle

Time limit1sMemory limit1024 MB

Summary
Counts the ways to pick cut pieces of an M-dimensional hypertriangle of edge N that form a solid hypertriangle block, modulo 1e9+7.
Level

Medium6 of 10

Topics
Combinatorics, Math, Geometry
Solved
No attempts yet

Problem

An MM-dimensional hypertriangle is a regular MM-dimensional polytope with (M+1)(M+1) vertices. For M=2M=2 it is an equilateral triangle, and for M=3M=3 it is a regular tetrahedron.

A block shaped like an MM-dimensional hypertriangle with edge length NN is given. Cut the block parallel to each (M−1)(M-1)-dimensional face so that every edge is divided into NN equal parts. Then select some of the pieces and combine them into an MM-dimensional hypertriangle block without moving or rotating them from their original positions. The original block is solid, and the new block must also have no empty space inside. Write a program that counts the number of ways to form an MM-dimensional hypertriangle block.

Input

Two integers MM and NN are given, separated by a space. (2≤M,N≤100 000)(2\leq M,N\leq 100\,000)

Output

Print the number of ways to form an MM-dimensional hypertriangle block. Since the number can be very large, print the remainder when divided by 109+710^{9}+7. Note that 109+710^{9}+7 is prime.

Hint

In this problem, two (M−1)(M-1)-dimensional figures aa and bb in MM-dimensional Euclidean space are called parallel when the following holds. Set an infinite (M−1)(M-1)-dimensional space AA that contains aa and an infinite (M−1)(M-1)-dimensional space BB that contains bb. Every point of AA has the same distance to its orthogonal projection onto BB, and that distance is not 0.

Examples3

  1. Example 1

    Input
    2 4
    
    Expected output
    27
    
  2. Example 2

    Input
    3 2
    
    Expected output
    5
    
  3. Example 3

    Input
    2023 1105
    
    Expected output
    329435584