#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 17;
const int M = 1e9 + 7;
const int R2 = 5e8 + 4;
int mat[N][N], x[N];
bool ok(int a, int b) {
  if (a == b) return false;
  return abs(a - b) != 2;
}
bool ok(int a, int b, int c) {
  if (!ok(a, b) || !ok(b, c)) return false;
  int t[] = {a, b, c};
  sort(t, t + 3);
  return !(t[0] == 0 && t[1] == 1 && t[2] == 2);
}
void init() {
  for (int i = 0; i < 16; ++i) {
    int a = i >> 2, b = i & 3;
    for (int c = 0; c < 4; ++c) {
      int j = (b << 2) + c;
      mat[i][j] = ok(c, b, a);
    }
  }
  for (int i = 0; i < 17; ++i) mat[16][i] = 1;
  for (int i = 0; i < 16; ++i) {
    int a = i >> 2, b = i & 3;
    x[i] = ok(min(a, b), max(a, b));
  }
  x[16] = 4;
}
void mul(int A[][N], int B[N][N], int n = N) {
  int C[N][N] = {0};
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < n; ++k) {
        C[i][j] = (C[i][j] + 1ll * A[i][k] * B[k][j]) % M;
      }
    }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) A[i][j] = C[i][j];
}
int f(int n) {
  if (n <= 0) return 0;
  if (n == 1) return 4;
  int A[N][N] = {0}, B[N][N];
  for (int i = 0; i < N; ++i) {
    A[i][i] = 1;
    for (int j = 0; j < N; ++j) B[i][j] = mat[i][j];
  }
  for (int e = n - 2; e; e >>= 1) {
    if (e & 1) mul(A, B);
    mul(B, B);
  }
  int ret = 0;
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < N; ++j) {
      ret = (ret + 1ll * A[i][j] * x[j]) % M;
    }
  return ret;
}
int main() {
  init();
  int l, r, tot = 0;
  scanf("%d%d", &l, &r);
  tot = 1ll * (f(r) - f(l - 1)) * R2 % M;
  if (!(l & 1)) ++l;
  if (!(r & 1)) --r;
  l = (l + 1) >> 1, r = (r + 1) >> 1;
  if (l <= r) tot = (tot + 1ll * (f(r) - f(l - 1)) * R2) % M;
  if (tot < 0) tot += M;
  printf("%d\n", tot);
  return 0;
}
