#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int N = 505;
struct QF {
  int a, b;
  QF(int _a = 0, int _b = 0) { a = _a, b = _b; }
  friend QF operator+(QF x, QF y) {
    return QF((x.a + y.a) % mod, (x.b + y.b) % mod);
  }
  friend QF operator-(QF x, QF y) {
    return QF((x.a - y.a + mod) % mod, (x.b - y.b + mod) % mod);
  }
  friend QF operator*(QF x, QF y) {
    return QF((1ll * x.a * y.a + 5ll * x.b * y.b) % mod,
              (1ll * x.a * y.b + 1ll * x.b * y.a) % mod);
  }
};
int C[N][N];
inline int inv(int x, long long p = mod - 2) {
  int res = 1;
  while (p) {
    if (p & 1) res = 1ll * res * x % mod;
    x = 1ll * x * x % mod;
    p >>= 1;
  }
  return res;
}
inline QF power(QF x, long long n, int ty = 0) {
  QF p = 1, s = 0;
  int cur = 0;
  while (n >> cur) ++cur;
  while (cur--) {
    s = s * (p + 1), p = p * p;
    if (n >> cur & 1) s = s + p, p = p * x;
  }
  return ty ? s : p;
}
int A[N], B[N];
void init(int k) {
  A[0] = 1;
  for (int i = 0; i < (k); i++) {
    for (int j = (0); j <= (k); j++) B[j] = A[j];
    A[0] = 0;
    for (int j = (0); j <= (k); j++) {
      A[j + 1] = B[j];
      A[j] = (A[j] - 1ll * i * B[j] % mod + mod) % mod;
    }
  }
  for (int i = (1); i <= (k); i++)
    for (int j = (0); j <= (k); j++) A[j] = 1ll * A[j] * inv(i) % mod;
  C[0][0] = 1;
  for (int i = (1); i <= (k); i++) {
    C[i][0] = 1;
    for (int j = (1); j <= (i); j++)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
  }
}
int calc(long long n, int i) {
  QF res = 0, base, tmp;
  QF a = QF(inv(2), inv(2));
  QF b = QF(inv(2), mod - inv(2));
  for (int k = (0); k <= (i); k++) {
    base = power(a, k) * power(b, i - k);
    tmp = QF((i - k) & 1 ? mod - C[i][k] : C[i][k], 0);
    res = res + tmp * power(base, n, 1);
  }
  res = res * power(QF(0, inv(5)), i);
  return res.a;
}
int solve(long long n, int K) {
  int res = 0;
  for (int i = (0); i <= (K); i++) res = (res + 1ll * A[i] * calc(n, i)) % mod;
  return res;
}
int main() {
  long long k, l, r;
  cin >> k >> l >> r;
  init(k);
  cout << (solve(r + 3, k) - solve(l + 2, k) + mod) % mod << endl;
  return 0;
}
