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;
char getc() {
  char c = getchar();
  while ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9'))
    c = getchar();
  return c;
}
long long gcd(long long n, long long m) { return m == 0 ? n : gcd(m, n % m); }
long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return x * f;
}
long long n, P, l, r, fac[100010], inv[100010], sum[100010][30], p[30], t;
void inc(long long &x, long long y) {
  x += y;
  if (x >= P) x -= P;
}
void exgcd(long long &x, long long &y, long long a, long long b) {
  if (b == 0) {
    x = 1, y = 0;
    return;
  }
  exgcd(x, y, b, a % b);
  long long t = x;
  x = y;
  y = t - a / b * x;
}
long long Inv(long long a) {
  long long x, y;
  exgcd(x, y, a, P);
  return (x % P + P) % P;
}
long long ksm(long long a, long long k) {
  long long s = 1;
  for (; k; k >>= 1, a = 1ll * a * a % P)
    if (k & 1) s = 1ll * s * a % P;
  return s;
}
long long C(long long n, long long m) {
  if (m > n) return 0;
  long long ans = 1ll * fac[n] * inv[m] % P * inv[n - m] % P;
  for (long long i = 1; i <= t; i++)
    ans = 1ll * ans * ksm(p[i], sum[n][i] - sum[m][i] - sum[n - m][i]) % P;
  return ans;
}
long long calc(long long m) {
  long long ans = 0;
  for (long long i = 0; i <= n; i++)
    inc(ans, 1ll * C(n, i) * C(n - i, m + i) % P);
  return ans;
}
signed main() {
  n = read(), P = read(), l = read(), r = read();
  long long u = P;
  for (long long i = 2; i * i <= u; i++)
    if (u % i == 0) {
      p[++t] = i;
      while (u % i == 0) u /= i;
    }
  if (u > 1) p[++t] = u;
  fac[0] = 1;
  for (long long i = 1; i <= n; i++) {
    long long x = i;
    for (long long j = 1; j <= t; j++) {
      sum[i][j] = sum[i - 1][j];
      while (x % p[j] == 0) x /= p[j], sum[i][j]++;
    }
    fac[i] = 1ll * fac[i - 1] * x % P;
  }
  for (long long i = 0; i <= n; i++) inv[i] = Inv(fac[i]);
  cout << ((calc(l) + calc(l + 1) - calc(r + 2) - calc(r + 1)) % P + P) % P;
  return 0;
}