#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : (-x);
}
template <class T>
T sqr(T x) {
  return x * x;
}
const long long mod = 1000000007;
bool check2(int m) {
  int m1 = m % 4;
  m /= 4;
  int m2 = m % 4;
  m /= 4;
  if (m1 == m2) return false;
  if (m1 == 0 && m2 == 3) return false;
  if (m1 == 3 && m2 == 0) return false;
  if (m1 == 2 && m2 == 1) return false;
  if (m1 == 1 && m2 == 2) return false;
  return true;
}
bool check3(int m) {
  int m1 = m % 4;
  m /= 4;
  int m2 = m % 4;
  m /= 4;
  int m3 = m % 4;
  m /= 4;
  if (!check2(m1 * 4 + m2)) return false;
  if (!check2(m2 * 4 + m3)) return false;
  if (m1 == 1 && m2 == 0 && m3 == 2) return false;
  if (m1 == 2 && m2 == 0 && m3 == 1) return false;
  return true;
}
const int N = 16;
struct M {
  long long a[N][N];
  M() { memset(a, 0, sizeof(a)); }
  long long* operator[](int ind) { return a[ind]; }
  M operator*(M m) {
    M res;
    for (int i = 0; i < N; ++i)
      for (int j = 0; j < N; ++j)
        for (int k = 0; k < N; ++k)
          res[i][j] = (res[i][j] + a[i][k] * m[k][j]) % mod;
    return res;
  }
  vector<long long> operator*(vector<long long> v) {
    vector<long long> res(((int)(v).size()), 0);
    for (int i = 0; i < ((int)(v).size()); ++i)
      for (int j = 0; j < ((int)(v).size()); ++j)
        res[i] = (res[i] + a[i][j] * v[j]) % mod;
    return res;
  }
};
M pw(M a, long long y) {
  M res;
  for (int i = 0; i < N; ++i) res[i][i] = 1;
  while (y) {
    if (y % 2 == 1)
      --y, res = res * a;
    else
      y /= 2, a = a * a;
  }
  return res;
}
long long pw(long long a, long long y) {
  long long res = 1;
  while (y) {
    if (y % 2 == 1)
      --y, res = (res * a) % mod;
    else
      y /= 2, a = (a * a) % mod;
  }
  return res;
}
long long inv(long long x) { return pw(x, mod - 2); }
bool ok(int m, int ind) {
  if (ind == 0) return false;
  return true;
}
long long calc(long long n) {
  if (n == 0) return 0;
  if (n == 1) return 4;
  vector<int> vm;
  for (int i = 0; i < (1 << 6); ++i)
    if (check3(i)) vm.push_back(i);
  vector<int> v2;
  for (int i = 0; i < (1 << 4); ++i)
    if (check2(i)) v2.push_back(i);
  sort((v2).begin(), (v2).end());
  M a;
  for (int i = 0; i < ((int)(v2).size()); ++i) {
    for (int j = 0; j < 4; ++j) {
      int x = v2[i] * 4 + j;
      if (!check3(x)) continue;
      x %= 16;
      ++a[i][lower_bound((v2).begin(), (v2).end(), x) - v2.begin()];
    }
  }
  for (int i = 0; i <= ((int)(v2).size()); ++i) a[((int)(v2).size())][i] = 1;
  vector<long long> v(((int)(v2).size()) + 1, 0LL);
  for (int i = 0; i < ((int)(v2).size()); ++i) v[i] = 1;
  vector<long long> tmp;
  tmp = pw(a, n - 1) * v;
  long long res = tmp[((int)(tmp).size()) - 1];
  M b = pw(a, (n + 1) / 2 - 1);
  tmp = b * v;
  res += tmp[((int)(tmp).size()) - 1];
  res += 8LL;
  res *= inv(2LL);
  res %= mod;
  return res;
}
int main() {
  long long l, r;
  cin >> l >> r;
  long long res = calc(r) - calc(l - 1);
  res %= mod;
  res += mod;
  res %= mod;
  cout << res << "\n";
  return 0;
}
