#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chkmin(T &a, T b) {
  a = min(a, b);
}
template <typename T>
void chkmax(T &a, T b) {
  a = max(a, b);
}
inline long long fread(void) {
  long long ret = 0, op = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') op = -1;
  for (; isdigit(ch); ch = getchar()) ret = (ret << 1) + (ret << 3) - '0' + ch;
  return ret * op;
}
const long long MAXN = 2000 + 10;
const long long mod = 1e9 + 7;
const long long MAXM = +10;
long long S(long long x) { return (x % mod + mod) % mod; }
long long fpow(long long base, long long top) {
  long long ret = 1;
  base %= mod;
  for (; top; top >>= 1) {
    if (top & 1) ret = 1ll * ret * base % mod;
    base = 1ll * base * base % mod;
  }
  return ret;
}
struct Complex {
  long long re, im;
  Complex() { re = im = 0; }
  Complex(long long _re, long long _im) : re(_re % mod), im(_im % mod) {}
  Complex operator+(const Complex &you) {
    return Complex(S(re + you.re) % mod, S(im + you.im));
  }
  Complex operator-(const Complex &you) {
    return Complex(S(re - you.re), S(im - you.im));
  }
  Complex operator*(const Complex &you) {
    return Complex(S(1ll * re * you.re % mod + 5ll * im % mod * you.im % mod),
                   S(1ll * re * you.im % mod + 1ll * you.re * im % mod));
  }
  Complex operator-(long long k) { return Complex(S(re - k), im); }
  Complex operator/(const Complex &you) {
    Complex ret(0, 0);
    long long iv =
        fpow(S(1ll * you.re * you.re % mod - 5ll * you.im % mod * you.im % mod),
             mod - 2);
    ret.re = 1ll * S(1ll * re * you.re % mod - 5ll * im % mod * you.im % mod) *
             iv % mod;
    ret.im =
        1ll * S(1ll * im * you.re % mod - 1ll * re * you.im % mod) * iv % mod;
    return ret;
  }
  void pt(void) { printf("re is %d, im is %d\n", re, im); }
};
long long fac[MAXN], ifac[MAXN];
long long L, R, k, S1[MAXN][MAXN];
long long binom(long long n, long long m) {
  return 1ll * fac[n] * ifac[m] % mod * ifac[n - m] % mod;
}
Complex Fpow(Complex base, long long top) {
  Complex ret = Complex(1, 0);
  for (; top; top >>= 1) {
    if (top & 1) ret = ret * base;
    base = base * base;
  }
  return ret;
}
Complex A, B, X, Y;
inline void init(void) {
  k = fread();
  L = fread() + 2, R = fread() + 2;
  S1[0][0] = 1;
  for (long long i = 1; i <= k; ++i) {
    S1[i][0] = 0;
    S1[i][i] = 1;
    for (long long j = 1; j < i; ++j) {
      S1[i][j] = (S1[i - 1][j - 1] + 1ll * (i - 1) * S1[i - 1][j]) % mod;
    }
  }
  fac[0] = 1;
  for (long long i = 1; i <= k; ++i) fac[i] = 1ll * fac[i - 1] * i % mod;
  ifac[k] = fpow(fac[k], mod - 2);
  for (long long i = k - 1; i >= 0; --i)
    ifac[i] = 1ll * ifac[i + 1] * (i + 1) % mod;
}
Complex getSum(Complex p, long long l, long long r) {
  if (p.re == 1 && p.im == 0) return Complex(S((r - l + 1) % mod), 0);
  return (Fpow(p, r + 1) - Fpow(p, l)) / (p - 1);
}
inline void work(void) {
  long long inv2 = fpow(2, mod - 2), inv5 = fpow(5, mod - 2);
  A = Complex(0, inv5);
  B = Complex(0, mod - inv5);
  X = Complex(inv2, inv2);
  Y = Complex(inv2, mod - inv2);
  long long Ans = 0;
  for (long long i = 1; i <= k; ++i) {
    Complex res(0, 0);
    for (long long j = 0; j <= i; ++j) {
      Complex tmp = Complex(binom(i, j), 0) * Fpow(A, j) * Fpow(B, i - j);
      tmp = tmp * getSum(Fpow(X, j) * Fpow(Y, i - j), L, R);
      res = res + tmp;
    }
    res.re = 1ll * res.re * S1[k][i] % mod;
    if ((k - i) & 1)
      Ans = S(Ans - res.re);
    else
      Ans = (Ans + res.re) % mod;
  }
  Ans = 1ll * Ans * ifac[k] % mod;
  cout << Ans;
}
int main() {
  init();
  work();
  return 0;
}
