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;
void factorize(long long v, std::map<long long, int> &result) {
  long long p = 2;
  while (v > 1 && p * p <= v) {
    int cnt = 0;
    while (v % p == 0) {
      cnt++;
      v /= p;
    }
    if (cnt > 0) {
      if (result.count(p) == 0) {
        result[p] = 0;
      }
      result[p] += cnt;
    }
    p += p == 2 ? 1 : 2;
  }
  if (v > 1) {
    if (result.count(v) == 0) {
      result[v] = 0;
    }
    result[v] += 1;
  }
}
long long int ex_gcd(long long int x, long long int y, long long int &a,
                     long long int &b) {
  if (y == 0) {
    a = 1;
    b = 0;
    return x;
  }
  long long int q = x / y;
  long long int r = x % y;
  long long int res = ex_gcd(y, r, a, b);
  long long int tmp = a - q * b;
  a = b;
  b = tmp;
  return res;
}
const int N = 123456;
int n;
long long int p;
vector<long long int> q;
vector<int> e;
long long int fact[N];
long long int invfact[N];
vector<int> fact_e[N];
void init(void) {
  map<long long int, int> factor;
  factorize(p, factor);
  for (map<long long int, int>::iterator it = factor.begin();
       it != factor.end(); ++it) {
    q.push_back(it->first);
    e.push_back(it->second);
  }
  int l = e.size();
  fact_e[0] = vector<int>(l, 0);
  fact[0] = invfact[0] = 1;
  for (int i = (int)(1); i < (int)(N); i++) {
    int v = i;
    fact_e[i] = fact_e[i - 1];
    for (int j = (int)(0); j < (int)(l); j++) {
      while (v % q[j] == 0) {
        fact_e[i][j] += 1;
        v /= q[j];
      }
    }
    fact[i] = fact[i - 1] * v % p;
    long long int dummy2;
    long long int dummy = ex_gcd(fact[i], p, invfact[i], dummy2);
    assert(dummy == 1);
    invfact[i] = (invfact[i] % p + p) % p;
  }
}
long long int tri_comb(int x, int y) {
  long long int t = 1;
  int len = e.size();
  t = (fact[n] * invfact[x]) % p;
  t = t * invfact[y] % p;
  t = t * invfact[n - x - y] % p;
  vector<int> es(len);
  for (int i = (int)(0); i < (int)(len); i++) {
    es[i] = fact_e[n][i] - fact_e[x][i] - fact_e[y][i] - fact_e[n - x - y][i];
    for (int j = (int)(0); j < (int)(es[i]); j++) {
      t = t * q[i] % p;
    }
  }
  return t;
}
long long int calc(int l) {
  long long int tot = 0;
  for (int i = (int)(0); i < (int)(n - l + 1); i++) {
    if ((n + i + l) % 2 == 0) {
      tot = (tot + tri_comb(i, (n - i - l) / 2)) % p;
    }
  }
  return tot;
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int l, r;
  cin >> n >> p >> l >> r;
  init();
  cout << (calc(l) + calc(l + 1) - calc(r + 1) - calc(r + 2) + 2 * p) % p
       << "\n";
}