#P10154. Product Sequence Calculation

    ID: 12143 Type: Default 1000ms 256MiB

Product Sequence Calculation

Product Sequence Calculation

Given two positive integers \(n\) and \(a\). Define two sequences \(\{h_i\}\) and \(\{s_i\}\) as follows:

[ \begin{cases} s_1 = a, \ s_i = \left\lceil \frac{h_{i-1}}{i} \right\rceil, \quad \text{for } i \ge 2, \ h_i = i \times s_i, \quad \text{for } i \ge 1, \ W = \prod_{i=1}^{n} h_i. \end{cases} ]

Your task is to compute \(W\) modulo \(10^9+7\).

inputFormat

The input consists of a single line containing two positive integers \(n\) and \(a\) separated by a space.

outputFormat

Output a single integer which is \(W\) modulo \(10^9+7\).

sample

1 5
5