#include <bits/stdc++.h>
using namespace std;
void file(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
template <typename Tp>
void read(Tp &x) {
  long long fh = 1;
  char c = getchar();
  x = 0;
  while (c > '9' || c < '0') {
    if (c == '-') {
      fh = -1;
    }
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + (c & 15);
    c = getchar();
  }
  x *= fh;
}
long long ksm(long long b, long long p, long long Mod = 1000000007) {
  long long ret = 1;
  while (p) {
    if (p & 1) {
      ret = 1ll * ret * b % Mod;
    }
    b = b * b % Mod;
    p >>= 1;
  }
  return ret;
}
struct CP {
  long long x, y;
  void mdl() {
    x = (x % 1000000007 + 1000000007) % 1000000007;
    y = (y % 1000000007 + 1000000007) % 1000000007;
  }
  CP operator+(CP z) const {
    CP ret = (CP){(x + z.x) % 1000000007, (y + z.y) % 1000000007};
    ret.mdl();
    return ret;
  }
  CP operator+(long long z) const {
    CP ret = (CP){(x + z) % 1000000007, y};
    ret.mdl();
    return ret;
  }
  CP operator-(CP z) const {
    CP ret = (CP){(x - z.x + 1000000007) % 1000000007,
                  (y - z.y + 1000000007) % 1000000007};
    ret.mdl();
    return ret;
  }
  CP operator-(long long z) const {
    CP ret = (CP){(x - z) % 1000000007, y};
    ret.mdl();
    return ret;
  }
  CP operator*(CP z) const {
    CP ret = (CP){
        (1ll * x * z.x % 1000000007 + 5ll * y * z.y % 1000000007) % 1000000007,
        (1ll * x * z.y % 1000000007 + 1ll * y * z.x % 1000000007) % 1000000007};
    ret.mdl();
    return ret;
  }
  CP operator*(long long z) const {
    CP ret = (CP){1ll * x * z % 1000000007, 1ll * y * z % 1000000007};
    ret.mdl();
    return ret;
  }
  CP operator/(CP z) const {
    CP t = (CP){x, y} * (CP){z.x, (1000000007 - z.y) % 1000000007};
    long long tt = ((1ll * z.x * z.x % 1000000007 -
                     5ll * z.y * z.y % 1000000007 + 1000000007) %
                        1000000007 +
                    1000000007) %
                   1000000007,
              iv = ksm(tt, 1000000007 - 2, 1000000007);
    CP ret = (CP){1ll * t.x * iv % 1000000007, 1ll * t.y * iv % 1000000007};
    ret.mdl();
    return ret;
  }
  CP operator/(long long z) const {
    long long iv = ksm(z, 1000000007 - 2);
    CP ret = (CP){1ll * x * iv % 1000000007, 1ll * y * iv % 1000000007};
    ret.mdl();
    return ret;
  }
  bool operator<(CP z) const { return (x == z.x) ? y < z.y : x < z.x; }
  bool operator==(CP z) const { return (x == z.x) && (y == z.y); }
};
CP ksm(CP b, long long p) {
  CP ret = (CP){1, 0};
  while (p) {
    if (p & 1) ret = ret * b;
    b = b * b;
    p >>= 1;
  }
  return ret;
}
long long S1[505][505], C[505][505], frac[505], frinv[505];
void prep_s1(long long N) {
  S1[0][0] = 1;
  for (long long i = 1; i <= N; ++i) {
    S1[i][0] = 0;
    S1[i][i] = 1;
    for (long long j = 1; j < i; ++j) {
      S1[i][j] =
          (S1[i - 1][j - 1] + 1ll * (i - 1) * S1[i - 1][j] % 1000000007) %
          1000000007;
    }
  }
  for (long long i = 0; i <= N; ++i) {
    C[i][0] = C[i][i] = 1;
    for (long long j = 1; j < i; ++j) {
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % 1000000007;
    }
  }
  frac[0] = 1;
  for (long long i = 1; i <= N; ++i)
    frac[i] = 1ll * frac[i - 1] * i % 1000000007;
  frinv[N] = ksm(frac[N], 1000000007 - 2);
  for (long long i = N; i; --i) frinv[i - 1] = 1ll * frinv[i] * i % 1000000007;
}
CP get_qp(CP x, long long p) {
  x.mdl();
  if (x.x == 1 && x.y == 0) return x * p;
  return (ksm(x, p) - 1) / (x - 1);
}
long long calc(long long n, long long k) {
  long long ret = 0;
  for (long long j = 0; j <= k; ++j) {
    long long ts = S1[k][j];
    if ((k - j) & 1) ts = 1000000007 - ts;
    CP sm = (CP){0, 0};
    for (long long t = 0; t <= j; ++t) {
      CP u1 = (CP){1, 1} / 2, u2 = (CP){1, -1} / 2;
      CP q = ksm(u1, t) * ksm(u2, j - t);
      if ((j - t) & 1)
        sm = sm - get_qp(q, n + 1) * C[j][t];
      else
        sm = sm + get_qp(q, n + 1) * C[j][t];
    }
    sm = sm * ((CP){1, 0} / (ksm((CP){0, 1}, j)));
    ret = (ret + 1ll * ts * sm.x % 1000000007) % 1000000007;
  }
  ret = 1ll * ret * frinv[k] % 1000000007;
  return ret;
}
signed main() {
  long long K, L, R;
  read(K);
  read(L);
  read(R);
  ++L;
  ++R;
  ++L;
  ++R;
  prep_s1(K);
  long long ans = calc(R, K) - calc(L - 1, K);
  printf("%d\n", (ans % 1000000007 + 1000000007) % 1000000007);
  return 0;
}
