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 long long N = 1e5;
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar(), f = 0;
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = 1;
  for (; c >= '0' && c <= '9'; c = getchar())
    x = (x << 1) + (x << 3) + (c ^ 48);
  if (f) x = -x;
}
long long P, n, m, pc, p[15], php, pt, res, l, r;
inline long long ksm(long long x, long long q) {
  long long r = 1;
  for (; q; q >>= 1, x = 1ll * x * x % P)
    if (q & 1) r = 1ll * x * r % P;
  return r;
}
inline long long gph(long long x) {
  long long r = x;
  for (long long i = 2; i * i <= x; i++) {
    if (x % i == 0) r = r / i * (i - 1);
    while (x % i == 0) x /= i;
  }
  return (x ^ 1) ? r / x * (x - 1) : r;
}
struct num {
  long long fc, iv, a[15];
  inline void Pt() {
    printf("%d , %lld : ", fc, 1ll * fc * iv % P);
    for (long long i = 1; i <= pc; i++)
      printf("%d%c", a[i], i == pc ? '\n' : ' ');
  }
  inline long long get() {
    long long r = fc;
    for (long long i = 1; i <= pc; i++) r = 1ll * r * ksm(p[i], a[i]) % P;
    return r;
  }
  inline void add(long long v) {
    for (long long i = 1; i <= pc; i++)
      while (v % p[i] == 0) v /= p[i], a[i]++;
    fc = 1ll * fc * v % P, iv = 1ll * iv * ksm(v, php - 1) % P;
  }
  inline num operator/(num b) {
    num x = *this;
    for (long long i = 1; i <= pc; i++) x.a[i] -= b.a[i];
    x.fc = 1ll * x.fc * b.iv % P;
    return x;
  }
} fc[N + 5];
inline long long C(long long n, long long m) {
  if (n < m || m < 0)
    return 0;
  else
    return (fc[n] / fc[m] / fc[n - m]).get();
}
signed main() {
  read(n), read(P), read(l), read(r), php = gph(P), fc[0].fc = fc[0].iv = 1,
                                      pc = 0, r = min(r, n);
  pt = P;
  for (long long i = 2; i * i <= pt; i++)
    for (pt % i == 0 ? p[++pc] = i : 0; pt % i == 0;) pt /= i;
  if (pt ^ 1) p[++pc] = pt;
  memset(fc[0].a + 1, 0, sizeof(long long) * 14);
  for (long long i = 1; i <= N; i++) fc[i] = fc[i - 1], fc[i].add(i);
  res = 0;
  for (long long i = 0; i <= n - l; i++)
    res = (res + 1ll *
                     (C(n - i, (n - i - l) >> 1) -
                      C(n - i, (n - i - r - 1) >> 1) + P) %
                     P * C(n, i) % P) %
          P;
  return printf("%lld\n", (res + P) % P), 0;
}