#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int rmax = 60;
bool bit(long long mask, int pos) { return (mask >> pos) & 1; }
void mul(long long& a, long long b) {
  a *= b;
  if (a >= mod) {
    a %= mod;
  }
}
void add(long long& a, long long b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}
void sub(long long& a, long long b) {
  a -= b;
  if (a < 0) {
    a += mod;
  }
}
long long binpow(long long a, long long n) {
  long long ans = 1;
  while (n) {
    if (n & 1) {
      mul(ans, a);
    }
    n >>= 1;
    mul(a, a);
  }
  return ans;
}
struct data {
  long long a, b;
  data() : a(0), b(0) {}
  data(long long a, long long b) : a(a), b(b) {}
  data operator+(const data& other) const {
    long long new_a = a;
    add(new_a, other.a);
    long long new_b = b;
    add(new_b, other.b);
    return {new_a, new_b};
  }
  data operator*(const data& other) const {
    long long val1 = a;
    mul(val1, other.b);
    long long val2 = b;
    mul(val2, other.a);
    add(val1, val2);
    long long new_b = val1;
    val1 = a;
    mul(val1, other.a);
    val2 = b;
    mul(val2, other.b);
    mul(val2, 5);
    add(val1, val2);
    return {val1, new_b};
  }
  data operator-(const data& other) const {
    long long new_a = a;
    sub(new_a, other.a);
    long long new_b = b;
    sub(new_b, other.b);
    return {new_a, new_b};
  }
};
vector<vector<data> > dp;
vector<vector<long long> > bin;
long long r5 = binpow(5, mod - 2);
data count_magic(long long n, int k) {
  if (n == 0) {
    return {0, 0};
  }
  data res;
  for (int j = 0; j <= k; ++j) {
    data val = dp[k][j];
    vector<data> sum(rmax);
    vector<data> degs(rmax);
    degs[0] = val;
    sum[0] = {1, 0};
    for (int i = 1; i < rmax; ++i) {
      sum[i] = sum[i - 1] + degs[i - 1] * sum[i - 1];
      degs[i] = degs[i - 1] * degs[i - 1];
    }
    data ans;
    data curr = {1, 0};
    for (int r = rmax - 1; r >= 0; --r) {
      if (bit(n + 1, r)) {
        ans = ans + sum[r] * curr;
        curr = curr * degs[r];
      }
    }
    mul(ans.a, bin[k][j]);
    mul(ans.b, bin[k][j]);
    if ((k - j) & 1) {
      ans.a = mod - ans.a;
      ans.b = mod - ans.b;
    }
    long long r = binpow(r5, k / 2);
    mul(ans.a, r);
    mul(ans.b, r);
    if (k & 1) {
      long long new_a = ans.b;
      long long new_b = ans.a;
      mul(new_b, r5);
      ans = {new_a, new_b};
    }
    res = res + ans;
  }
  return res;
}
vector<long long> mul(const vector<long long>& a, const vector<long long>& b) {
  int n = (int)(a).size() - 1, m = (int)(b).size() - 1;
  vector<long long> c(n + m + 1);
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= m; ++j) {
      long long val = a[i];
      mul(val, b[j]);
      add(c[i + j], val);
    }
  }
  return c;
}
int main() {
  int k;
  long long l, r;
  cin >> k >> l >> r;
  l += 2, r += 2;
  dp = vector<vector<data> >(k + 1, vector<data>(k + 1));
  vector<data> degs_plus(k + 1), degs_minus(k + 1);
  degs_plus[0] = degs_minus[0] = {1, 0};
  long long r2 = binpow(2, mod - 2);
  for (int i = 1; i <= k; ++i) {
    data tmp = {r2, r2};
    degs_plus[i] = degs_plus[i - 1] * tmp;
    tmp = {r2, mod - r2};
    degs_minus[i] = degs_minus[i - 1] * tmp;
  }
  for (int i = 0; i <= k; ++i) {
    for (int j = 0; j <= i; ++j) {
      dp[i][j] = degs_plus[j] * degs_minus[i - j];
    }
  }
  bin = vector<vector<long long> >(k + 1, vector<long long>(k + 1));
  bin[0][0] = 1;
  for (int i = 1; i <= k; ++i) {
    bin[i][0] = 1;
    for (int j = 1; j <= k; ++j) {
      bin[i][j] = bin[i - 1][j];
      add(bin[i][j], bin[i - 1][j - 1]);
    }
  }
  if (l > r) {
    cout << "0\n";
    return 0;
  }
  vector<long long> p = {0, 1};
  for (int i = 2; i <= k; ++i) {
    long long t = binpow(i, mod - 2);
    vector<long long> q(2);
    q[1] = t;
    q[0] = mod - t;
    mul(q[0], i - 1);
    vector<long long> r = mul(p, q);
    p = r;
  }
  data ans;
  for (int i = 0; i <= k; ++i) {
    data val = count_magic(r, i);
    mul(val.a, p[i]);
    mul(val.b, p[i]);
    ans = ans + val;
    val = count_magic(l - 1, i);
    mul(val.a, p[i]);
    mul(val.b, p[i]);
    ans = ans - val;
  }
  cout << ans.a << "\n";
}
