#include <bits/stdc++.h>
const int fin = 0, maxk = 17;
const int MC = 1000000007;
struct mat {
  int n, m, a[maxk][maxk];
  mat() { memset(a, 0, sizeof(a)); }
  mat(const int &n, const int &m) : n(n), m(m) { memset(a, 0, sizeof(a)); }
  int &operator()(const int &x, const int &y) { return a[x][y]; }
} A, T;
mat operator*(mat a, mat b) {
  mat c(a.n, b.m);
  for (int i = 0; i < a.n; ++i)
    for (int j = 0; j < b.m; ++j)
      for (int k = 0; k < a.m; ++k)
        c(i, j) = ((long long)a(i, k) * b(k, j) + c(i, j)) % MC;
  return c;
}
mat pow(mat a, int n) {
  mat b(a.n, a.n);
  for (int i = 0; i < a.n; ++i) b(i, i) = 1;
  while (n) {
    if (n & 1) b = b * a;
    a = a * a;
    n >>= 1;
  }
  return b;
}
void pre() {
  int i, j, k;
  A.n = 1, A.m = T.n = T.m = 17;
  for (i = 0; i < 4; ++i)
    for (j = 0; j < 4; ++j)
      if (i != j && i + j != 3) {
        A(0, (4 * (i) + (j))) = 1, ++A(0, 16);
        for (k = 0; k < 4; ++k)
          if (j != k && j + k != 3 && !(j == 0 && i + k == 3)) {
            T((4 * (i) + (j)), (4 * (j) + (k))) = 1, ++T((4 * (i) + (j)), 16);
          }
      }
  T(16, 16) = 1;
}
int _sol(int n) {
  int t = (A * pow(T, n))(0, 16);
  return t;
}
int sol(int n) {
  if (!n) return 0;
  if (n == 1) return 4;
  int s = _sol(n - 2);
  if (n >= 3) s = (s + _sol((n - 1) / 2 - 1)) % MC;
  s = ((long long)s * (MC / 2 + 1) + 4) % MC;
  return s;
}
int main() {
  if (fin) {
    freopen("t.in", "r", stdin);
    freopen("t.out", "w", stdout);
  }
  pre();
  int l, r;
  scanf("%d%d", &l, &r);
  printf("%d", (sol(r) - sol(l - 1) + MC) % MC);
  return 0;
}
