Iterated Sums

Compute S(k, n) mod 1,000,000,007, where S iterates prefix sums k times starting from S(0, n) = n.

Medium6CombinatoricsMathDynamic programmingNo attempts yetTime limit2sMemory limit512 MB

Problem

The function SS is defined as follows.

  • S(0,n)=nS(0, n) = n for every positive integer nn
  • S(k,n)=S(k1,1)+S(k1,2)++S(k1,n)S(k, n) = S(k-1, 1) + S(k-1, 2) + \dots + S(k-1, n) for all positive integers kk and nn

In other words, S(k,n)S(k, n) adds up the values of the function one level below, from 11 through nn.

Given kk and nn, write a program that computes S(k,n)S(k, n) modulo 1,000,000,007.

Input

The first line contains kk and nn, separated by a space. (1k501 \le k \le 50, 1n1,000,000,0001 \le n \le 1{,}000{,}000{,}000)

Output

Print S(k,n)S(k, n) modulo 1,000,000,007 on the first line.