#include <bits/stdc++.h>
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) {
    if (c == '-') flag = true;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();
  if (flag) x = -x;
}
using namespace std;
const int P = 1e9 + 7;
const int inv2 = (P + 1) / 2;
inline long long quickpow(long long x, long long k) {
  long long res = 1;
  x %= P;
  while (k) {
    if (k & 1) res = res * x % P;
    x = x * x % P;
    k >>= 1;
  }
  return res;
}
int k;
long long s[230][230], tri[230][230], jie[230], jieni[230];
inline void init() {
  s[0][0] = 1;
  for (int i = 1; i <= k; ++i)
    for (int j = 1; j <= i; ++j)
      s[i][j] = (s[i - 1][j - 1] + s[i - 1][j] * (i - 1)) % P;
  tri[1][1] = 1;
  for (int i = 2; i <= k + 1; ++i)
    for (int j = 1; j <= i; ++j)
      tri[i][j] = (tri[i - 1][j - 1] + tri[i - 1][j]) % P;
  jie[0] = jieni[0] = 1;
  for (int i = 1; i <= k; ++i) jie[i] = jie[i - 1] * i % P;
  jieni[k] = quickpow(jie[k], P - 2);
  for (int i = k - 1; i; --i) jieni[i] = jieni[i + 1] * (i + 1) % P;
}
inline long long get_c(int n, int m) {
  if (n < 0 || m < 0 || n - m < 0) return 0;
  return tri[n + 1][m + 1];
}
struct Complex {
  long long a, b;
  Complex() { a = 0, b = 0; }
  Complex(long long jzp, long long zzz) { a = jzp, b = zzz; }
} phi, phihat;
inline Complex operator+(const Complex &a, const Complex &b) {
  return Complex((a.a + b.a) % P, (a.b + b.b) % P);
}
inline Complex operator-(const Complex &a, const Complex &b) {
  return Complex((a.a - b.a) % P, (a.b - b.b) % P);
}
inline Complex operator*(const Complex &a, const Complex &b) {
  return Complex((a.a * b.a + 5 * a.b * b.b) % P, (a.a * b.b + a.b * b.a) % P);
}
inline Complex get_inv(Complex x) {
  long long a = x.a, b = x.b;
  if (!b) return Complex(quickpow(a, P - 2), 0);
  long long d = b * quickpow((5ll * b * b - a * a) % P, P - 2) % P;
  long long c = -a * quickpow(b, P - 2) % P * d % P;
  Complex res = Complex(c, d);
  return res;
}
inline Complex Pow(Complex x, long long k) {
  Complex res(1, 0);
  while (k) {
    if (k & 1) res = res * x;
    x = x * x;
    k >>= 1;
  }
  return res;
}
inline long long work(long long n) {
  Complex ans;
  for (int j = 0; j <= k; ++j) {
    Complex res;
    for (int d = 0; d <= j; ++d) {
      Complex A = Pow(phi, d) * Pow(phihat, j - d);
      if (A.a == 1 && A.b == 0) {
        if ((j - d) & 1)
          res = res - Complex(n % P * get_c(j, d) % P, 0);
        else
          res = res + Complex(n % P * get_c(j, d) % P, 0);
      }
      A = A * (Complex(1, 0) - Pow(A, n)) * get_inv(Complex(1, 0) - A);
      if ((j - d) & 1)
        res = res - Complex(get_c(j, d), 0) * A;
      else
        res = res + Complex(get_c(j, d), 0) * A;
    }
    if ((k - j) & 1)
      ans = ans - Complex(s[k][j], 0) * Pow(get_inv(Complex(0, 1)), j) * res;
    else
      ans = ans + Complex(s[k][j], 0) * Pow(get_inv(Complex(0, 1)), j) * res;
  }
  ans = ans * Complex(jieni[k], 0);
  return ans.a;
}
int main() {
  phi = Complex(inv2, inv2);
  phihat = Complex(inv2, P - inv2);
  read(k);
  init();
  long long l, r;
  read(l), read(r);
  l += 2;
  r += 2;
  long long ans = work(r) - work(l - 1);
  printf("%lld\n", (ans % P + P) % P);
  return 0;
}
