#include <bits/stdc++.h>
using namespace std;
const int N = 504, P = 1000000007, i2 = 500000004;
int fpow(int a, int b) {
  long long w(1), o(a);
  while (b) {
    if (b & 1) w = w * o % P;
    o = o * o % P;
    b >>= 1;
  }
  return w;
}
int Inv(int x) { return fpow(x, P - 2); }
struct cp {
  int x, y;
  cp(int dx = 0, int dy = 0) {
    x = dx;
    y = dy;
  }
};
cp operator+(const cp& a, const cp& b) {
  return cp((a.x + b.x) % P, (a.y + b.y) % P);
}
cp operator-(const cp& a, const cp& b) {
  return cp((a.x + P - b.x) % P, (a.y + P - b.y) % P);
}
cp operator*(const cp& a, const cp& b) {
  return cp(((long long)a.x * b.x + (long long)a.y * b.y * 5) % P,
            ((long long)a.x * b.y + (long long)a.y * b.x) % P);
}
cp operator*(const cp& a, const int T) {
  return cp((long long)a.x * T % P, (long long)a.y * T % P);
}
cp operator/(const cp& a, const cp& b) {
  return a * cp(b.x, P - b.y) *
         Inv((((long long)b.x * b.x - (long long)b.y * b.y * 5) % P + P) % P);
}
cp fexp(cp a, long long b) {
  cp o(1, 0);
  while (b) {
    if (b & 1) o = o * a;
    a = a * a;
    b >>= 1;
  }
  return o;
}
const cp f1(i2, i2), f2(i2, P - i2);
long long L, R;
int K, fac[N], ifac[N], S[N][N];
int C(int n, int m) {
  return (long long)fac[n] * ifac[m] % P * ifac[n - m] % P;
}
int solve(long long n, int k) {
  cp o(0, 0);
  for (int l = 0; l <= k; l++) {
    cp u = fexp(f1, k - l) * fexp(f2, l), v;
    if (u.x == 1 && u.y == 0) {
      v = cp((n + 1) % P, 0);
    } else {
      cp t = fexp(u, n + 1);
      v = cp(t.x - 1, t.y) / cp(u.x - 1, u.y);
    }
    v = v * C(k, l);
    if (l & 1)
      o = o - v;
    else
      o = o + v;
  }
  o = o * fexp(cp(0, Inv(5)), k);
  return o.x;
}
int calc(long long n) {
  int o = 0;
  for (int i = 0; i <= K; i++)
    o = (o + (long long)S[K][i] * (solve(n + 2, i) + P - 2)) % P;
  o = (long long)o * ifac[K] % P;
  return o;
}
int main() {
  fac[0] = 1;
  for (int i = 1; i < N; i++) fac[i] = (long long)fac[i - 1] * i % P;
  ifac[N - 1] = Inv(fac[N - 1]);
  for (int i = N - 2; ~i; i--) ifac[i] = (long long)ifac[i + 1] * (i + 1) % P;
  S[0][0] = 1;
  for (int i = 1; i < N; i++)
    for (int j = 1; j <= i; j++)
      S[i][j] =
          ((S[i - 1][j - 1] - (long long)S[i - 1][j] * (i - 1)) % P + P) % P;
  scanf("%d %I64d %I64d", &K, &L, &R);
  printf("%d", ((calc(R) - calc(L - 1)) % P + P) % P);
  return 0;
}
