#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
struct matr {
  long long a[8][8];
};
matr d, f, e;
int n, l, r;
inline void make() {
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++) f.a[i][j] = d.a[i][j] = e.a[i][j] = 0;
  d.a[0][1] = 1;
  d.a[0][4] = 1;
  d.a[1][0] = 1;
  d.a[2][3] = 1;
  d.a[2][6] = 1;
  d.a[3][2] = 1;
  d.a[4][5] = 1;
  d.a[4][7] = 1;
  d.a[5][1] = 1;
  d.a[5][4] = 1;
  d.a[6][5] = 1;
  d.a[6][7] = 1;
  d.a[7][3] = 1;
  d.a[7][6] = 1;
  for (int i = 0; i < 8; i++) f.a[0][i] = e.a[i][i] = 1;
}
inline matr mul(matr a, matr b) {
  matr c;
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++) {
      c.a[i][j] = 0;
      for (int z = 0; z < 8; z++)
        c.a[i][j] = (c.a[i][j] + a.a[i][z] * b.a[z][j]) % MOD;
    }
  return c;
}
inline matr sum(matr a, matr b) {
  matr c;
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++) c.a[i][j] = (a.a[i][j] + b.a[i][j]) % MOD;
  return c;
}
inline matr sqr(matr a) { return mul(a, a); }
matr pow_(matr p, int n) {
  if (n < 2) return (n < 1 ? e : p);
  if (n % 2 == 0) return sqr(pow_(p, n / 2));
  return mul(p, sqr(pow_(p, n / 2)));
}
inline long long sum(matr a) {
  long long ans = 0;
  for (int i = 0; i < 8; i++) ans += a.a[0][i];
  return ans;
}
inline int log_(int n) {
  int l = 0;
  while ((1 << l) <= n) l++;
  return l - 1;
}
inline int log_less(int n) {
  int l = 0;
  while ((1 << l) - 1 < n) l++;
  return l - 1;
}
inline int step_2(int n) { return (1 << n); }
matr magic_func(int n) {
  if (n == 0) return e;
  if (n == 1) return sum(d, e);
  matr ans = sum(d, e);
  int w = log_less(n);
  for (int i = 1; i < w; i++) ans = mul(ans, sum(pow_(d, step_2(i)), e));
  return sum(ans, mul(pow_(d, step_2(w)), magic_func(n - step_2(w))));
}
long long solve(int n) {
  if (n < 2) return (n < 1 ? 0 : 4);
  matr ans = magic_func(n - 2);
  return sum(mul(f, ans)) + 4;
}
inline long long real_ans(int n) {
  return solve(n) / 2 + solve((n + 1) / 2) / 2;
}
int main() {
  cin >> l >> r;
  make();
  cout << ((real_ans(r) - real_ans(l - 1)) % MOD + MOD) % MOD;
  return 0;
}
