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;
int IN() {
  int c, f, x;
  while (!isdigit(c = getchar()) && c != '-')
    ;
  c == '-' ? (f = 1, x = 0) : (f = 0, x = c - '0');
  while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + c - '0';
  return !f ? x : -x;
}
const int N = 100000 + 19;
int A[N], B[N], C[N];
int n, p, l, r, ans, m, t, x, y;
vector<pair<int, int> > V;
void exgcd(int a, int b, long long &x, long long &y) {
  if (!b) {
    x = 1, y = 0;
    return;
  }
  exgcd(b, a % b, x, y);
  long long tmp = x;
  x = y;
  y = tmp - a / b * y;
}
int inv(int a) {
  long long x, y;
  exgcd(a, p, x, y);
  return (0ll + x + p) % p;
}
struct num {
  int val;
  vector<int> c;
  num() {}
  num(int x) {
    c.resize(m);
    for (int i = 0; i < m; i++) {
      while (x % V[i].first == 0) x /= V[i].first, c[i]++;
    }
    val = x;
  }
  int value() {
    int res = val;
    for (int i = 0; i < m; i++)
      for (int j = 0; j < c[i]; j++) res = 1ll * res * V[i].first % p;
    return res;
  }
} T[N], tmp;
num operator*(const num &A, const num &B) {
  static num C;
  C.val = 1ll * A.val * B.val % p;
  C.c.resize(m);
  for (int i = 0; i < m; i++) C.c[i] = A.c[i] + B.c[i];
  return C;
}
num operator/(const num &A, const num &B) {
  static num C;
  C.val = 1ll * A.val * inv(B.val) % p;
  C.c.resize(m);
  for (int i = 0; i < m; i++) C.c[i] = A.c[i] - B.c[i];
  return C;
}
void work(int n, int m) {
  for (; x < n; x++) tmp = tmp * T[x + 1] / T[x + 1 - y];
  for (; y < m; y++) tmp = tmp * T[x - y] / T[y + 1];
}
void Init() {
  int x = p;
  for (int i = 2; 1ll * i * i <= x; i++)
    if (x % i == 0) {
      pair<int, int> tmp = make_pair(i, 0);
      while (x % i == 0) x /= i, tmp.second++;
      V.push_back(tmp);
    }
  if (x > 1) V.push_back(make_pair(x, 1));
  m = V.size();
  for (int i = 1; i < n + 1; i++) T[i] = num(i);
}
int main() {
  n = IN(), p = IN(), l = IN(), r = IN();
  Init();
  A[0] = 1;
  tmp = 1;
  x = n, y = 0;
  for (int c = 1; c < n + 1; c++) {
    work(n, c);
    A[c] = tmp.value();
  }
  for (t = 0; t <= n && t < (t + l + 1) / 2; t++)
    ;
  B[t] = 1;
  tmp = 1;
  x = t;
  y = (t + l + 1) / 2;
  for (int c = t + 1; c < n + 1; c++) {
    work(c, (c + l + 1) / 2);
    B[c] = tmp.value();
  }
  for (t = 0; t <= n && t < (t + r) / 2 + 1; t++)
    ;
  C[t] = 1;
  tmp = 1;
  x = t;
  y = (t + r) / 2 + 1;
  for (int c = t + 1; c < n + 1; c++) {
    work(c, (c + r) / 2 + 1);
    C[c] = tmp.value();
  }
  for (int c = 0; c < n + 1; c++) {
    ans = (ans + 1ll * A[c] * (0ll + B[c] - C[c] + p)) % p;
  }
  printf("%d\n", ans);
}