Problem: Lakhesh loves to make movies, so Nephren helps her run a cinema. We may call it No. 68 Cinema.

<image>

However, one day, the No. 68 Cinema runs out of changes (they don't have 50-yuan notes currently), but Nephren still wants to start their business. (Assume that yuan is a kind of currency in Regulu Ere.)

There are three types of customers: some of them bring exactly a 50-yuan note; some of them bring a 100-yuan note and Nephren needs to give a 50-yuan note back to him/her; some of them bring VIP cards so that they don't need to pay for the ticket.

Now n customers are waiting outside in queue. Nephren wants to know how many possible queues are there that they are able to run smoothly (i.e. every customer can receive his/her change), and that the number of 50-yuan notes they have after selling tickets to all these customers is between l and r, inclusive. Two queues are considered different if there exists a customer whose type is different in two queues. As the number can be large, please output the answer modulo p.

Input

One line containing four integers n (1 ≤ n ≤ 105), p (1 ≤ p ≤ 2·109), l and r (0 ≤ l ≤ r ≤ n). 

Output

One line indicating the answer modulo p.

Examples

Input

4 97 2 3


Output

13


Input

4 100 0 4


Output

35

Note

We use A, B and C to indicate customers with 50-yuan notes, customers with 100-yuan notes and customers with VIP cards respectively.

For the first sample, the different possible queues that there are 2 50-yuan notes left are AAAB, AABA, ABAA, AACC, ACAC, ACCA, CAAC, CACA and CCAA, and the different possible queues that there are 3 50-yuan notes left are AAAC, AACA, ACAA and CAAA. So there are 13 different queues satisfying the first sample. Similarly, there are 35 different queues satisfying the second sample.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int c = 200002, k = 30;
long long n, mod, mod2, l, r;
long long cnt, pr[k], t[k], fakt[c][k], sum = 0;
int phi(int n) {
  int result = n;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      pr[++cnt] = i;
      while (n % i == 0) n /= i;
      result -= result / i;
    }
  }
  if (n > 1) {
    pr[++cnt] = n;
    result -= result / n;
  }
  return result;
}
long long oszt(long long a) {
  long long ans = 1, p = mod2 - 1;
  while (p) {
    if (p % 2) {
      ans *= a, ans %= mod;
    }
    a *= a, a %= mod;
    p /= 2;
  }
  return ans;
}
long long alatt(int a, int b) {
  if (a < b || a < 0) {
    return 0;
  }
  for (int i = 1; i <= cnt; i++) {
    t[i] = fakt[a][i] - fakt[b][i] - fakt[a - b][i];
  }
  long long ans =
      fakt[a][0] * oszt(fakt[b][0]) % mod * oszt(fakt[a - b][0]) % mod;
  for (int i = 1; i <= cnt; i++) {
    for (int j = 1; j <= t[i]; j++) {
      ans *= pr[i];
      ans %= mod;
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> mod >> l >> r;
  mod2 = phi(mod);
  fakt[0][0] = 1;
  for (int i = 1; i <= 2 * n; i++) {
    int s = i;
    for (int j = 1; j <= cnt; j++) {
      fakt[i][j] = fakt[i - 1][j];
      while (s % pr[j] == 0) {
        fakt[i][j]++;
        s /= pr[j];
      }
    }
    fakt[i][0] = fakt[i - 1][0] * s % mod;
  }
  for (int ossz = 0; ossz <= n; ossz++) {
    int kis = (ossz + l + 1) / 2, nagy = (ossz + r + 2) / 2;
    sum += alatt(n, ossz) * (alatt(ossz, kis) - alatt(ossz, nagy) + mod) % mod;
  }
  cout << sum % mod << "\n";
  return 0;
}