#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long get(long long k) { return k >= mod ? k - mod : k; }
long long dif(long long k) { return k < 0 ? k + mod : k; }
struct st {
  long long a, b;
  st(void) { a = b = 0; }
  st(long long a, long long b) : a(a), b(b) {}
  st(long long a) : a(a), b(0) {}
};
st operator+(st A, st B) { return st(get(A.a + B.a), get(A.b + B.b)); }
void operator+=(st &A, st B) { A = A + B; }
st operator-(st A, st B) { return st(dif(A.a - B.a), dif(A.b - B.b)); }
void operator-=(st &A, st B) { A = A - B; }
st operator*(st A, st B) {
  return st((5ll * A.b * B.b + 1ll * A.a * B.a) % mod,
            (1ll * A.a * B.b + 1ll * A.b * B.a) % mod);
}
void operator*=(st &A, st B) { A = A * B; }
bool operator==(st a, st b) { return a.a == b.a && a.b == b.b; }
st pow1(st a, long long b) {
  auto ans = st(1, 0);
  while (b) {
    if (b & 1) ans *= a;
    a = a * a;
    b /= 2;
  }
  return ans;
}
long long pow2(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (1ll * ans * a) % mod;
    b /= 2;
    a = (1ll * a * a) % mod;
  }
  return ans;
}
const long long inv = pow2(2, mod - 2);
const auto A = st(inv, inv);
const auto B = st(inv, mod - inv);
const long long Inv = pow2(5, mod - 2);
static long long C[512][512];
static long long F[512];
st iv(st cnt) {
  st ans;
  long long tmp = (5ll * cnt.b * cnt.b) % mod;
  tmp = (mod + 1ll * cnt.a * cnt.a - tmp) % mod;
  tmp = pow2(tmp, mod - 2);
  ans.a = cnt.a;
  ans.b = (mod - cnt.b) % mod;
  ans *= st(tmp);
  assert(ans * cnt == st(1, 0));
  return ans;
}
st geo(st a, long long b) {
  if (a == st(1, 0)) return st(b % mod);
  auto cnt = pow1(a, b + 1) - a;
  return cnt * iv(a - 1);
}
st G(long long l, long long r, st S) { return geo(S, r) - geo(S, l - 1); }
st AA[512];
st BB[512];
long long Fib(long long l, long long r, long long k) {
  st ans = st(0, 0);
  for (long long i = 0; i <= k; ++i) {
    auto cnt = AA[i] * BB[k - i];
    cnt = G(l, r, cnt);
    cnt *= C[k][i];
    if ((k - i) & 1)
      ans -= cnt;
    else
      ans += cnt;
  }
  if (k & 1) return (1ll * ans.b * pow2(Inv, k / 2)) % mod;
  return (1ll * ans.a * pow2(Inv, k / 2)) % mod;
}
int32_t main(void) {
  long long k;
  long long l, r;
  cin >> k >> l >> r;
  l += 2;
  r += 2;
  AA[0] = BB[0] = st(1, 0);
  for (long long i = 1; i <= 500; ++i)
    AA[i] = AA[i - 1] * A, BB[i] = BB[i - 1] * B;
  F[1] = 1;
  for (long long i = 1; i < k; ++i) {
    for (long long j = k; j; --j)
      F[j] = (F[j - 1] + 1ll * F[j] * (mod - i)) % mod;
  }
  for (long long i = 0; i < 512; ++i)
    for (long long j = 0; j <= i; ++j)
      C[i][j] = !i || !j || i == j ? 1 : (C[i - 1][j] + C[i - 1][j - 1]) % mod;
  long long ans = 0;
  for (long long i = 1; i <= k; ++i)
    ans = (ans + 1ll * F[i] * Fib(l, r, i)) % mod;
  long long fact = 1;
  for (long long i = 1; i <= k; ++i) fact = (1ll * fact * i) % mod;
  fact = pow2(fact, mod - 2);
  ans = (1ll * ans * fact) % mod;
  cout << ans << '\n';
  return 0;
}
