#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
const int N = 9;
const int mod = 1000000007;
int l, r, st[4][4], ts[N];
struct mtx {
  long long a[N][N];
};
mtx m;
mtx operator*(const mtx& a, const mtx& b) {
  mtx ans;
  memset(ans.a, 0, sizeof(ans.a));
  for (int i = 0; i < (int)(N); ++i)
    for (int j = 0; j < (int)(N); ++j)
      for (int k = 0; k < (int)(N); ++k)
        ans.a[i][j] = (ans.a[i][j] + a.a[i][k] * b.a[k][j]) % mod;
  return ans;
}
mtx power(mtx a, int k) {
  mtx r;
  memset(r.a, 0, sizeof(r.a));
  for (int i = 0; i < (int)(N); ++i) r.a[i][i] = 1;
  while (k) {
    if (k & 1) r = r * a;
    a = a * a;
    k >>= 1;
  }
  return r;
}
long long f(int x) {
  mtx z = power(m, x - 1);
  long long ans = 0;
  for (int i = 0; i < (int)(N - 1); ++i) ans = (ans + z.a[8][i]) % mod;
  return ans;
}
long long gao(int x) {
  if (x == 0) return 0;
  if (x == 1) return 4;
  if (x == 2) return 8;
  long long ans = f(x) + f((x + 1) / 2);
  ans = ans * (mod + 1) / 2 % mod;
  return (ans + 4) % mod;
}
void solve() {
  int tot = 0;
  for (int i = 0; i < (int)(4); ++i)
    for (int j = 0; j < (int)(4); ++j)
      if (i / 2 != j / 2) {
        st[i][j] = tot;
        ts[tot++] = i * 4 + j;
      }
  memset(m.a, 0, sizeof(m.a));
  for (int i = 0; i < (int)(tot); ++i)
    for (int k = 0; k < (int)(4); ++k) {
      int a = ts[i] / 4;
      int b = ts[i] % 4;
      if (k / 2 == b / 2) continue;
      if (a == 1 && b == 2 && k == 0) continue;
      if (a == 0 && b == 2 && k == 1) continue;
      m.a[i][st[b][k]] = 1;
    }
  for (int i = 0; i < (int)(N); ++i) m.a[8][i] = 1;
  long long ans = gao(r) - gao(l - 1);
  ans = (ans % mod + mod) % mod;
  printf(
      "%lld"
      "\n",
      ans);
}
int main() {
  while (scanf("%d%d", &l, &r) != EOF) {
    solve();
  }
  return 0;
}
