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 inf = 1e9;
const long long Inf = 1e18;
const long long N = 1e5 + 10;
long long mod;
long long gi() {
  long long x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
template <typename T>
bool chkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
};
template <typename T>
bool chkmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
};
long long add(long long a, long long b) {
  return a + b >= mod ? a + b - mod : a + b;
}
long long sub(long long a, long long b) {
  return a - b < 0 ? a - b + mod : a - b;
}
void inc(long long &a, long long b) {
  a = (a + b >= mod ? a + b - mod : a + b);
}
void dec(long long &a, long long b) { a = (a - b < 0 ? a - b + mod : a - b); }
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + "," + to_string(p.second) + ")";
}
template <typename T>
string to_string(T v) {
  long long fst = 1;
  string ret = "{";
  for (auto x : v) {
    if (!fst) ret += ",";
    fst = 0, ret += to_string(x);
  }
  ret += "}";
  return ret;
}
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  dbg_out(T...);
}
long long fac[N], ifac[N], inv[N], n, l, r, pri[N], m = 0, sum[20][N], phi;
long long qpow(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % mod;
    a = 1ll * a * a % mod, b >>= 1;
  }
  return ret;
}
void init() {
  phi = mod;
  long long k = mod;
  for (long long i = 2; i * i <= k; i++)
    if (k % i == 0) {
      pri[++m] = i;
      phi = phi / i * (i - 1);
      while (k % i == 0) k /= i;
    }
  if (k > 1) pri[++m] = k, phi = phi / k * (k - 1);
  fac[0] = 1;
  for (long long j = 1; j <= n; j++) {
    long long k = j;
    for (long long i = 1; i <= m; i++) {
      sum[i][j] = sum[i][j - 1];
      while (k % pri[i] == 0) k /= pri[i], ++sum[i][j];
    }
    fac[j] = 1ll * fac[j - 1] * k % mod;
  }
}
long long div_floor(long long x, long long y) {
  if (x >= 0 || x % y == 0) return x / y;
  return x / y - 1;
}
long long C(long long n, long long m) {
  if (m < 0 || n < m) return 0;
  long long ret = 1ll * fac[n] * qpow(fac[m], phi - 1) % mod *
                  qpow(fac[n - m], phi - 1) % mod;
  for (long long i = 1; i <= ::m; i++)
    ret = 1ll * ret * qpow(pri[i], sum[i][n] - sum[i][m] - sum[i][n - m]) % mod;
  return ret;
}
long long calc(long long n) {
  return sub(C(n, div_floor(n - l, 2)), C(n, div_floor(n - r + 1, 2) - 1));
}
signed main() {
  n = gi(), mod = gi(), l = gi(), r = gi();
  init();
  long long ans = 0;
  for (long long i = 0; i <= n; i++) inc(ans, 1ll * C(n, i) * calc(i) % mod);
  cout << ans;
  return 0;
}