#include <bits/stdc++.h>
using namespace std;
const long long N = 505, mod = 1e9 + 7;
long long c[N][N], s[N][N], p[N], inv[N];
long long l, r;
long long k, ans;
long long add(long long a, long long b) {
  return a + b >= mod ? a + b - mod : a + b;
}
long long dec(long long a, long long b) {
  return a - b < 0 ? a - b + mod : a - b;
}
long long ksm(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = 1ll * ans * a % mod;
    a = 1ll * a * a % mod;
    b >>= 1;
  }
  return ans;
}
struct node {
  long long a, b;
  node() {}
  node(long long aa, long long bb) { a = aa, b = bb; }
  inline node operator+(const node& x) const {
    return node(add(a, x.a), add(b, x.b));
  }
  inline node operator+(const long long& x) const { return node(add(a, x), b); }
  inline node operator-(const node& x) const {
    return node(dec(a, x.a), dec(b, x.b));
  }
  inline node operator-(const long long& x) const { return node(dec(a, x), b); }
  inline node operator*(const node& x) const {
    node ans;
    ans.a = (a * x.a + b * x.b * 5) % mod;
    ans.b = (a * x.b + b * x.a) % mod;
    return ans;
  }
  inline node operator*(const long long& x) const {
    return node(a * x % mod, b * x % mod);
  }
  friend inline node operator/(const node& x, const node& y) {
    node ans, z = y;
    if (z.b != 0) z.b = mod - z.b;
    ans = x * z;
    return ans * ksm(dec(y.a * y.a % mod, y.b * y.b * 5 % mod), mod - 2);
  }
};
node ksm(node a, long long b) {
  node ans = node(1, 0);
  while (b) {
    if (b & 1) ans = ans * a;
    a = a * a;
    b >>= 1;
  }
  return ans;
}
node sum(node a, long long b) { return (ksm(a, b + 1) - a) / (a - 1); }
node query(node x, long long l, long long r) {
  if (x.a == 1 && x.b == 0) return x * (r - l + 1);
  return sum(x, r) - sum(x, l - 1);
}
signed main() {
  scanf("%d%lld%lld", &k, &l, &r);
  l += 2, r += 2;
  p[0] = p[1] = inv[1] = 1;
  for (long long i = 2; i <= max(k, 5ll); i++) {
    p[i] = p[i - 1] * i % mod;
    inv[i] = (mod - mod / i) * inv[mod % i] % mod;
  }
  c[0][0] = c[1][0] = c[1][1] = s[0][0] = s[1][1] = 1;
  for (long long i = 2; i <= k; i++) {
    c[i][0] = 1, s[i][0] = 0;
    for (long long j = 1; j <= i; j++)
      c[i][j] = add(c[i - 1][j], c[i - 1][j - 1]),
      s[i][j] = dec(s[i - 1][j - 1], (i - 1) * s[i - 1][j] % mod);
  }
  node a = node(0, inv[5]), b = node(0, mod - inv[5]);
  node x = node(inv[2], inv[2]), y = node(inv[2], mod - inv[2]);
  for (long long i = 0; i <= k; i++) {
    node sum = node(0, 0);
    for (long long j = 0; j <= i; j++) {
      node ss = ksm(a, j) * ksm(b, i - j) *
                query(ksm(x, j) * ksm(y, i - j), l, r) * c[i][j];
      sum = sum + ss;
    }
    sum = sum * s[k][i];
    ans = add(ans, sum.a);
  }
  ans = ans * ksm(p[k], mod - 2) % mod;
  printf("%lld", ans);
}
