#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
inline int add(int a, int b) {
  a += b;
  return a >= MOD ? a - MOD : a;
}
inline int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + MOD : a;
}
inline int mul(int a, int b) { return 1LL * a * b % MOD; }
int ksm(int a, long long b) {
  int ans = 1;
  for (; b; b >>= 1, a = mul(a, a))
    if (b & 1LL) ans = mul(ans, a);
  return ans;
}
struct dt {
  int x, y;
  dt() {}
  dt(int a, int b) { x = a, y = b; }
  void W() { printf("%d %d Pr!\n", x, y); }
  dt Inv() {
    int a = x, b = y;
    int val = ksm(sub(mul(a, a), 5LL * b * b % MOD), MOD - 2);
    b = mul(sub(0, b), val);
    a = mul(val, a);
    return dt(a, b);
  }
} Zero(0, 0), One(1, 0);
dt operator+(dt a, dt b) { return dt(add(a.x, b.x), add(a.y, b.y)); }
dt operator-(dt a, dt b) { return dt(sub(a.x, b.x), sub(a.y, b.y)); }
dt operator*(dt a, dt b) {
  return dt(add(mul(a.x, b.x), 5LL * a.y * b.y % MOD),
            add(mul(a.x, b.y), mul(a.y, b.x)));
}
dt operator*(dt a, int b) { return dt(mul(a.x, b), mul(a.y, b)); }
dt operator*(int b, dt a) { return dt(mul(a.x, b), mul(a.y, b)); }
dt ksm(dt a, long long b) {
  dt ans = One;
  for (; b; b >>= 1, a = a * a)
    if (b & 1LL) ans = ans * a;
  return ans;
}
const int Q = 1 << 10;
int fac[Q], ifac[Q];
int C(int n, int m) {
  return n < m ? 0 : mul(fac[n], mul(ifac[m], ifac[n - m]));
}
int A[Q], tmp[Q];
const int i2 = (MOD + 1) / 2;
dt Gs(dt q, long long n) {
  if (q.x == 1 && q.y == 0) return q * (n % MOD);
  return q * (One - ksm(q, n)) * ((One - q).Inv());
}
const int i5 = ksm(5, MOD - 2);
const dt g1(i2, i2), g2(i2, sub(0, i2));
dt pg1[Q], pg2[Q];
int solve(int k, long long n) {
  for (int i = 0; i <= k; i++) A[i] = 0;
  A[0] = 1;
  for (int p = 0; p < k; p++) {
    for (int j = 0; j <= k; j++) tmp[j] = A[j], A[j] = 0;
    for (int j = 0; j < k; j++)
      A[j + 1] = tmp[j], A[j] = sub(A[j], mul(tmp[j], p));
  }
  dt als = Zero;
  dt ii5(0, i5);
  for (int i = 0; i <= k; i++) {
    dt tmp = Zero;
    for (int x = 0; x <= i; x++)
      tmp = tmp + (((i - x) & 1) ? (MOD - 1) : 1) * Gs(pg1[x] * pg2[i - x], n) *
                      C(i, x);
    als = als + tmp * A[i] * ksm(ii5, i);
  }
  return mul(als.x, ifac[k]);
}
int main() {
  fac[0] = 1;
  for (int i = 1; i <= 500; i++) fac[i] = mul(i, fac[i - 1]);
  ifac[500] = ksm(fac[500], MOD - 2);
  for (int i = 500; i; --i) ifac[i - 1] = mul(i, ifac[i]);
  pg1[0] = pg2[0] = One;
  for (int i = 1; i <= 500; i++)
    pg1[i] = pg1[i - 1] * g1, pg2[i] = pg2[i - 1] * g2;
  long long a, b, c;
  cin >> a >> b >> c;
  printf("%d", sub(solve(a, c + 2), solve(a, b + 1)));
}
