Problem:
Score : 400 points

Problem Statement

You are given positive integers N and M.

How many sequences a of length N consisting of positive integers satisfy a_1 \times a_2 \times ... \times a_N = M? Find the count modulo 10^9+7.

Here, two sequences a' and a'' are considered different when there exists some i such that a_i' \neq a_i''.

Constraints

All values in input are integers.

1 \leq N \leq 10^5

1 \leq M \leq 10^9

Input

Input is given from Standard Input in the following format:

N M

Output

Print the number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.

Sample Input 1

2 6

Sample Output 1

4

Four sequences satisfy the condition: \{a_1, a_2\} = \{1, 6\}, \{2, 3\}, \{3, 2\} and \{6, 1\}.

Sample Input 2

3 12

Sample Output 2

18

Sample Input 3

100000 1000000000

Sample Output 3

957870001

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)


#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

const ll MOD = 1000000007;

ll fac[200000+10];
ll invfac[200000+10];
ll mypow(ll x, ll n) {
  if(n == 0) return 1;
  if(n % 2 == 0) return mypow(x*x%MOD, n/2);
  return mypow(x*x%MOD, n/2) * x % MOD;
}

ll cmb(ll n, ll r) {
  assert(0 <= r && r <= n);
  return fac[n] * invfac[r] % MOD * invfac[n-r] % MOD;
}

int main(void) {
  fac[0] = 1;
  REP(i, 200000) {
    fac[i+1] = fac[i] * (i+1) % MOD;
  }
  invfac[200000] = mypow(fac[200000], MOD-2);
  for(int i = 200000; i > 0; --i) {
    invfac[i-1] = invfac[i] * i % MOD;
  }
  
  ll n, m;
  cin >> n >> m;
  vector<ll> fs;
  for(ll p = 2; p*p < m; ++p) {
    ll cur = 0;
    while(m % p == 0) {
      ++cur;
      m /= p;
    }
    if(cur > 0) {
      fs.push_back(cur);
    }
  }
  if(m > 1) {
    fs.push_back(1);
  }
  ll res = 1;
  REP(i, fs.size()) {
    res = res * cmb(n+fs[i]-1, n-1) % MOD;
  }
  cout << res << endl;
  
  return 0;
}