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;
class Integer {
 public:
  static void SetModulo(int mod) {
    mod_ = mod;
    phi_ = mod;
    divisors_.clear();
    for (int i = 2; i * i <= mod; i += 1) {
      if (mod % i == 0) {
        divisors_.push_back(i);
        phi_ /= i;
        phi_ *= i - 1;
        while (mod % i == 0) {
          mod /= i;
        }
      }
    }
    if (mod > 1) {
      divisors_.push_back(mod);
      phi_ /= mod;
      phi_ *= mod - 1;
    }
  }
  Integer() {}
  Integer(int n) : n_(n), exponents_(divisors_.size()) {
    for (int idx = 0; idx < (int)divisors_.size(); idx += 1) {
      while (n % divisors_[idx] == 0) {
        exponents_[idx] += 1;
        n /= divisors_[idx];
      }
    }
    n_ = n % mod_;
  }
  Integer& operator*=(const Integer& rhs) {
    for (int i = 0; i < (int)exponents_.size(); i += 1) {
      exponents_[i] += rhs.exponents_[i];
    }
    n_ = (int64_t)n_ * rhs.n_ % mod_;
    return *this;
  }
  Integer& operator/=(const Integer& rhs) {
    for (int i = 0; i < (int)exponents_.size(); i += 1) {
      exponents_[i] -= rhs.exponents_[i];
    }
    n_ = (int64_t)n_ * FindInverse(rhs.n_) % mod_;
    return *this;
  }
  int64_t Get() const {
    int64_t answer = n_;
    for (int i = 0; i < (int)divisors_.size(); i += 1) {
      answer = answer * Pow(divisors_[i], exponents_[i]) % mod_;
    }
    return answer;
  }
  friend Integer operator*(const Integer& lhs, const Integer& rhs) {
    return Integer(lhs) *= rhs;
  }
  friend Integer operator/(const Integer& lhs, const Integer& rhs) {
    return Integer(lhs) /= rhs;
  }

 private:
  int n_;
  vector<int> exponents_;
  static int mod_, phi_;
  static vector<int> divisors_;
  static int Pow(int base, int exponent) {
    int answer = 1;
    while (exponent) {
      if (exponent & 1) {
        answer = (int64_t)answer * base % mod_;
      }
      base = (int64_t)base * base % mod_;
      exponent >>= 1;
    }
    return answer;
  }
  static int FindInverse(int number) { return Pow(number, phi_ - 1); }
};
int Integer::mod_, Integer::phi_;
vector<int> Integer::divisors_;
int main() {
  int n, mod, l_bound, r_bound;
  cin >> n >> mod >> l_bound >> r_bound;
  Integer::SetModulo(mod);
  vector<Integer> factorial(n + 1);
  factorial[0] = Integer(1);
  for (int i = 1; i <= n; i += 1) {
    factorial[i] = factorial[i - 1] * Integer(i);
  }
  vector<Integer> inverse_factorial(n + 1);
  inverse_factorial[n] = Integer(1) / factorial[n];
  for (int i = n - 1; i >= 0; i -= 1) {
    inverse_factorial[i] = inverse_factorial[i + 1] * Integer(i + 1);
  }
  function<int64_t(int, int)> Binomial = [&](int n, int m) {
    if (m < 0) {
      return (int64_t)0;
    }
    return (factorial[n] * inverse_factorial[n - m] * inverse_factorial[m])
        .Get();
  };
  int64_t answer = 0;
  for (int non_vip = l_bound; non_vip <= n; non_vip += 1) {
    int64_t fixed_answer = Binomial(n, non_vip);
    fixed_answer = fixed_answer *
                   (Binomial(non_vip, (non_vip - l_bound) / 2) -
                    Binomial(non_vip, (non_vip - r_bound + 1) / 2 - 1) + mod) %
                   mod;
    answer += fixed_answer;
    if (answer >= mod) {
      answer -= mod;
    }
  }
  cout << answer << endl;
  return 0;
}