#include <bits/stdc++.h>
using namespace std;
const int MAXN = 510;
const int MOD = 1e9 + 7;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) (ch == '-') && (f = -f), ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
template <typename Type>
inline Type expow(Type n, long long k) {
  Type ans(1);
  for (; k; k >>= 1ll, n *= n) (k & 1ll) && (ans *= n, 1);
  return ans;
}
struct modint {
  int data;
  modint(int data = 0) : data(data){};
  inline modint operator+(const modint &tmp) const {
    return tmp.data + data >= MOD ? tmp.data + data - MOD : tmp.data + data;
  }
  inline void operator+=(const modint &tmp) {
    data += tmp.data;
    if (data >= MOD) data -= MOD;
  }
  inline modint operator-(const modint &tmp) const {
    return data < tmp.data ? data - tmp.data + MOD : data - tmp.data;
  }
  inline modint operator-() const { return data != 0 ? MOD - data : 0; }
  inline void operator-=(const modint &tmp) {
    data -= tmp.data;
    if (data < 0) data += MOD;
  }
  inline modint operator*(const modint &tmp) const {
    return 1ll * data * tmp.data % MOD;
  }
  inline void operator*=(const modint &tmp) {
    data = 1ll * data * tmp.data % MOD;
  }
  inline bool operator==(const modint &tmp) const { return data == tmp.data; }
};
struct Complex {
  modint real, imag;
  Complex(modint real = 0, modint imag = 0) : real(real), imag(imag){};
  inline Complex operator+(const Complex &tmp) const {
    return Complex(real + tmp.real, imag + tmp.imag);
  }
  inline Complex &operator+=(const Complex &tmp) {
    real += tmp.real;
    imag += tmp.imag;
    return *this;
  }
  inline Complex operator-(const Complex &tmp) const {
    return Complex(real - tmp.real, imag - tmp.imag);
  }
  inline Complex &operator-=(const Complex &tmp) {
    real -= tmp.real;
    imag -= tmp.imag;
    return *this;
  }
  inline Complex operator*(const Complex &tmp) const {
    return Complex(real * tmp.real + imag * tmp.imag * 5,
                   real * tmp.imag + imag * tmp.real);
  }
  inline Complex &operator*=(const Complex &tmp) {
    Complex rg(real * tmp.real + imag * tmp.imag * 5,
               real * tmp.imag + imag * tmp.real);
    *this = rg;
    return *this;
  }
  inline Complex operator/(const Complex &tmp) const {
    modint rg = expow(tmp.real * tmp.real - tmp.imag * tmp.imag * 5, MOD - 2);
    return Complex((real * tmp.real - imag * tmp.imag * 5) * rg,
                   (imag * tmp.real - real * tmp.imag) * rg);
  }
};
modint fac[MAXN], ifac[MAXN], S[MAXN][MAXN];
inline void init(int n = MAXN - 5) {
  int i, j;
  for (fac[0] = i = 1; i <= n; ++i) fac[i] = fac[i - 1] * i;
  for (ifac[i = n] = expow(fac[n], MOD - 2); i; --i) ifac[i - 1] = ifac[i] * i;
  for (i = 0; i <= n; ++i) S[i][i] = 1;
  for (i = 1; i <= n; ++i) S[0][i] = 0;
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= n; ++j) S[i][j] = S[i - 1][j - 1] + S[i - 1][j] * (i - 1);
}
inline modint C(int n, int m) {
  if (n < m || m < 0) return 0;
  return fac[n] * ifac[m] * ifac[n - m];
}
inline modint solve2(long long l, long long r, int m) {
  int j, k, i;
  l += 2;
  r += 2;
  Complex A(0, expow(modint(5), MOD - 2));
  Complex B(0, expow(modint(MOD - 5), MOD - 2));
  Complex alpha(expow(modint(2), MOD - 2), expow(modint(2), MOD - 2)),
      beta(expow(modint(2), MOD - 2), expow(modint(MOD - 2), MOD - 2));
  modint ans = 0;
  for (j = 1; j <= m; ++j) {
    Complex tmp(0, 0);
    for (k = 0; k <= j; ++k) {
      Complex q = expow(alpha, k) * expow(beta, j - k), rg = modint(0), now;
      now = (expow(q, r + 1) - expow(q, l));
      rg = (q.real == 1 && q.imag == 0) ? modint((r - l + 1) % MOD)
                                        : now / (q - Complex(1));
      rg *= expow(A, k) * expow(B, j - k) * C(j, k);
      tmp += rg;
    }
    assert(tmp.imag == 0);
    if ((m - j) & 1)
      ans -= tmp.real * S[m][j];
    else
      ans += tmp.real * S[m][j];
  }
  return ans * ifac[m];
}
int main() {
  init();
  int k = read();
  long long l = read(), r = read();
  printf("%d\n", solve2(l, r, k).data);
  return 0;
}
