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;
long long shin[25];
long long seto(void);
void ayano(long long x, char spliter = '\n');
int p, phip, phipm;
int prims[10], primdeg[10], primcnt = 0;
int kasumi(int a, int b);
int comb(int a, int b);
struct Num {
  int x, xinv, degs[10];
  Num(void) : x(1), xinv(1) {
    for (int i = 1; i <= primcnt; i++) this->degs[i] = 0;
  }
  Num(int y) {
    for (int i = 1; i <= primcnt; i++) {
      int ip = prims[i];
      int d = y / ip;
      this->degs[i] = 0;
      while (d * ip == y) this->degs[i]++, y = d, d = y / ip;
    }
    y %= p;
    this->x = y, this->xinv = kasumi(y, phipm);
  }
  Num(const Num& tn) : x(tn.x), xinv(tn.xinv) {
    for (int i = 1; i <= primcnt; i++) this->degs[i] = tn.degs[i];
  }
  int output(void) {
    int oans = this->x;
    for (int i = 1; i <= primcnt; i++)
      oans = 1ll * oans * kasumi(prims[i], this->degs[i]) % p;
    return oans;
  }
  friend Num operator*(const Num& lhs, const Num& rhs);
  friend Num operator/(const Num& lhs, const Num& rhs);
};
Num factors[100005];
int main(void) {
  int n, l, r;
  n = seto(), p = seto(), l = seto(), r = seto();
  if (p == 1) {
    ayano(0);
    return 0;
  }
  int tp = p;
  phip = p;
  for (int ip = 2; ip * ip <= tp; ip++) {
    int d = tp / ip;
    if (!(d * ip == tp)) continue;
    primcnt++, prims[primcnt] = ip, phip = phip / ip * (ip - 1);
    while (d * ip == tp) primdeg[primcnt]++, tp = d, d = tp / ip;
  }
  if (tp > 1)
    primcnt++, prims[primcnt] = tp, primdeg[primcnt] = 1,
               phip = phip / tp * (tp - 1);
  phipm = phip - 1;
  factors[0] = Num(1);
  for (int i = 1; i <= n; i++) factors[i] = Num(i) * factors[i - 1];
  long long ans = 0;
  for (int i = l; i <= n; i++) {
    int lb = l;
    ((lb ^ i) & 1) ? (lb++) : (0);
    int rb = min(i, r);
    ((rb ^ i) & 1) ? (rb--) : (0);
    if (lb > rb) continue;
    long long tans =
        1ll * comb(i, (i + lb) / 2) + p - comb(i, (i + rb + 2) / 2);
    (((tans) >= (p)) ? ((tans) -= (p)) : (0));
    tans = 1ll * tans * comb(n, i) % p;
    ans += tans, (((ans) >= (p)) ? ((ans) -= (p)) : (0));
  }
  ayano(ans);
  return 0;
}
int comb(int a, int b) {
  if (b > a) return 0;
  Num cansn = factors[a] / factors[b];
  cansn = cansn / factors[a - b];
  return cansn.output();
}
int kasumi(int a, int b) {
  int kans = 1;
  while (b)
    (b & 1) ? (kans = 1ll * kans * a % p) : (0), b >>= 1, a = 1ll * a * a % p;
  return kans;
}
Num operator*(const Num& lhs, const Num& rhs) {
  Num mans(lhs);
  mans.x = 1ll * mans.x * rhs.x % p;
  mans.xinv = 1ll * mans.xinv * rhs.xinv % p;
  for (int i = 1; i <= primcnt; i++) mans.degs[i] += rhs.degs[i];
  return mans;
}
Num operator/(const Num& lhs, const Num& rhs) {
  Num mans(lhs);
  mans.x = 1ll * mans.x * rhs.xinv % p;
  mans.xinv = 1ll * mans.xinv * rhs.x % p;
  for (int i = 1; i <= primcnt; i++) mans.degs[i] -= rhs.degs[i];
  return mans;
}
long long seto(void) {
  long long seto_x = 0;
  int symbol = 0;
  char ch = getchar();
  while (!isdigit(ch)) (ch == '-') ? (symbol = 1) : (0), ch = getchar();
  while (isdigit(ch)) (seto_x = seto_x * 10 + (ch - '0')), ch = getchar();
  return (symbol) ? (-seto_x) : (seto_x);
}
void ayano(long long ayano_x, char spliter) {
  if (!ayano_x) {
    putchar('0'), putchar(spliter);
    return;
  }
  if (ayano_x < 0) putchar('-'), ayano_x = -ayano_x;
  int ayano_len = 0;
  while (ayano_x) {
    long long ayano_d = ayano_x / 10;
    shin[ayano_len++] = ayano_x - ayano_d * 10;
    ayano_x = ayano_d;
  }
  while (ayano_len--) putchar(shin[ayano_len] + '0');
  putchar(spliter);
}