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 std::cerr;
using std::cin;
using std::max;
using std::min;
int n, a, b, mod, cntp, pri[100005], isp[100005], ans;
std::vector<int> S;
long long cal(long long x) {
  x -= x < mod ? 0 : mod;
  return x;
}
long long Pow(int x, int y) {
  int res = 1;
  for (; y; x = (long long)x * x % mod, y >>= 1)
    if (y & 1) res = (long long)res * x % mod;
  return res;
}
void doPrime(int x) {
  for (int i = 2; i <= x; i++) {
    if (!isp[i]) pri[++cntp] = i;
    for (int j = i + i; j <= x; j += i) isp[j] = 1;
  }
}
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 t = x;
  x = y, y = t - a / b * y;
}
long long inverse(int v) {
  long long x, y;
  exgcd(v, mod, x, y);
  return cal(x + mod);
}
struct info {
  int cnt[100005], val;
  void add(int x, int v) {
    for (int i : S)
      for (; x % pri[i] == 0; x /= pri[i], cnt[i] += v)
        ;
    if (x > 1) val = (long long)val * (v > 0 ? x : inverse(x)) % mod;
  }
  long long ask() {
    long long res = val;
    if (!res) return res;
    for (int i : S)
      if (cnt[i]) res = res * Pow(pri[i], cnt[i]) % mod;
    return res;
  }
} A, B, C;
int main() {
  scanf("%d%d%d%d", &n, &mod, &a, &b), doPrime((int)sqrt(mod));
  int tmp = mod;
  for (int i = 1; i <= cntp; i++)
    if (tmp % pri[i] == 0) {
      S.push_back(i);
      for (; tmp % pri[i] == 0; tmp /= pri[i])
        ;
    }
  if (tmp > 1) pri[0] = tmp, S.push_back(0);
  A.val = 1;
  for (int i = 0, v1, v2; i <= n; i++) {
    v1 = a + i + 1 >> 1, v2 = (b + i >> 1) + 1;
    if (i >= v1 && i - 1 < (a + i >> 1)) {
      B.val = 1;
      for (int j = 1; j <= v1; j++) B.add(i - j + 1, 1), B.add(j, -1);
    } else if (i >= v1) {
      B.add(i, 1);
      if (a + i & 1)
        B.add(v1, -1);
      else
        B.add(i - v1, -1);
    }
    if (i >= v2 && i - 1 < (b + i - 1 >> 1) + 1) {
      C.val = 1;
      for (int j = 1; j <= v2; j++) C.add(i - j + 1, 1), C.add(j, -1);
    } else if (i >= v2) {
      C.add(i, 1);
      if (b + i & 1)
        C.add(i - v2, -1);
      else
        C.add(v2, -1);
    }
    ans = cal(ans + A.ask() * cal(B.ask() - C.ask() + mod) % mod);
    if (i < n) A.add(n - i, 1), A.add(i + 1, -1);
  }
  printf("%d\n", ans);
  return 0;
}