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;
template <class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& p) {
  return o << "(" << p.first << "," << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& vc) {
  o << "sz = " << vc.size() << endl << "[";
  for (const T& v : vc) o << v << ",";
  o << "]";
  return o;
}
unsigned int mod;
struct ModInt {
  using uint = unsigned int;
  using ll = long long;
  using ull = unsigned long long;
  uint v;
  ModInt() : v(0) {}
  ModInt(ll v) : v(normS(v % mod + mod)) {}
  explicit operator bool() const { return v != 0; }
  static uint normS(const uint& x) { return (x < mod) ? x : x - mod; }
  static ModInt make(const uint& x) {
    ModInt m;
    m.v = x;
    return m;
  }
  ModInt operator+(const ModInt& b) const { return make(normS(v + b.v)); }
  ModInt operator-(const ModInt& b) const { return make(normS(v + mod - b.v)); }
  ModInt operator-() const { return make(normS(mod - v)); }
  ModInt operator*(const ModInt& b) const { return make((ull)v * b.v % mod); }
  ModInt operator/(const ModInt& b) const { return *this * b.inv(); }
  ModInt& operator+=(const ModInt& b) { return *this = *this + b; }
  ModInt& operator-=(const ModInt& b) { return *this = *this - b; }
  ModInt& operator*=(const ModInt& b) { return *this = *this * b; }
  ModInt& operator/=(const ModInt& b) { return *this = *this / b; }
  ll extgcd(ll a, ll b, ll& x, ll& y) const {
    ll u[] = {a, 1, 0}, v[] = {b, 0, 1};
    while (*v) {
      ll t = *u / *v;
      for (int i = 0; i < (int)(3); i++) swap(u[i] -= t * v[i], v[i]);
    }
    if (u[0] < 0)
      for (int i = 0; i < (int)(3); i++) u[i] = -u[i];
    x = u[1], y = u[2];
    return u[0];
  }
  ModInt inv() const {
    ll x, y;
    extgcd(v, mod, x, y);
    return make(normS(x + mod));
  }
  bool operator==(const ModInt& b) const { return v == b.v; }
  bool operator!=(const ModInt& b) const { return v != b.v; }
  friend istream& operator>>(istream& o, ModInt& x) {
    ll tmp;
    o >> tmp;
    x = ModInt(tmp);
    return o;
  }
  friend ostream& operator<<(ostream& o, const ModInt& x) { return o << x.v; }
};
using mint = ModInt;
struct precalc_comb {
  using ll = long long;
  ll M;
  vector<ll> ps;
  vector<vector<int>> acc_order_p;
  vector<mint> acc_other;
  precalc_comb() {}
  precalc_comb(ll M, int X) : M(M) {
    mod = M;
    {
      ll x = M;
      for (ll i = 2; i * i <= x; i++)
        if (x % i == 0) {
          ps.push_back(i);
          while (x % i == 0) x /= i;
        }
      if (x > 1) ps.push_back(x);
    }
    int K = ps.size();
    acc_order_p = vector<vector<int>>(X + 1, vector<int>(K, 0));
    acc_other = vector<mint>(X + 1);
    vector<int> n(X + 1);
    for (int i = 0; i < (int)(X + 1); i++) n[i] = i;
    for (int k = 0; k < (int)(K); k++) {
      ll p = ps[k];
      for (ll x = p; x <= X; x += p) {
        while (n[x] % p == 0) {
          n[x] /= p;
          acc_order_p[x][k]++;
        }
      }
    }
    acc_other[0] = 1;
    for (int i = 0; i < (int)(X); i++)
      acc_other[i + 1] = acc_other[i] * n[i + 1];
    for (int k = 0; k < (int)(K); k++) {
      for (int i = 0; i < (int)(X); i++)
        acc_order_p[i + 1][k] += acc_order_p[i][k];
    }
  }
  mint ex(mint x, int p) {
    mint a = 1;
    while (p) {
      if (p % 2) a *= x;
      x *= x;
      p /= 2;
    }
    return a;
  }
  mint C(int x, int y) {
    if (M == 1) return 0;
    if (y < 0 || y > x) return 0;
    int K = ps.size();
    mint c = acc_other[x] / (acc_other[y] * acc_other[x - y]);
    for (int k = 0; k < (int)(K); k++) {
      int r = acc_order_p[x][k] - acc_order_p[y][k] - acc_order_p[x - y][k];
      c *= ex(ps[k], r);
    }
    return c;
  }
} PC;
mint C(int x, int y) { return PC.C(x, y); }
int cnt;
void dfs(int now, int left, int l, int r) {
  if (left == 0) {
    if (l <= now && now <= r) cnt++;
    return;
  }
  dfs(now + 1, left - 1, l, r);
  dfs(now, left - 1, l, r);
  if (now - 1 >= 0) dfs(now - 1, left - 1, l, r);
}
int brute(int N, int M, int l, int r) {
  dfs(0, N, l, r);
  return cnt % M;
}
int main() {
  int N, M, l, r;
  cin >> N >> M >> l >> r;
  l--;
  PC = precalc_comb(M, 100010);
  mint ans = 0;
  for (int stay = 0; stay < (int)(N + 1); stay++) {
    int n = N - stay;
    mint tmp = C(n, (n - l + 1) / 2 - 1) - C(n, (n - r + 1) / 2 - 1);
    ans += tmp * C(N, stay);
  }
  cout << ans << endl;
}