#include <bits/stdc++.h>
using namespace std;
const int maxn = 18;
const int maxp = 1000000007;
long long A[maxn][maxn], C[maxn][maxn], B[maxn][maxn];
int ts, mk[maxn][maxn];
void makeC() {
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++)
      if (i / 2 != j / 2) mk[i][j] = ++ts;
  memset(C, 0, sizeof(C));
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++)
      for (int k = 0; k < 4; k++)
        if (j != 0 || i + k != 5) C[mk[i][j]][mk[j][k]] = 1;
  for (int i = 1; i <= 8; i++) C[i][i + 8] = 1;
  for (int i = 9; i <= 16; i++) C[i][i] = 1;
}
void qck(int x) {
  if (x == 1) {
    memcpy(A, C, sizeof(C));
    return;
  }
  qck(x / 2);
  memcpy(B, A, sizeof(A));
  memset(A, 0, sizeof(A));
  for (int i = 1; i <= 16; i++)
    for (int j = 1; j <= 16; j++)
      for (int k = 1; k <= 16; k++)
        A[i][k] = (A[i][k] + B[i][j] * B[j][k]) % maxp;
  if (x % 2) {
    memcpy(B, A, sizeof(A));
    memset(A, 0, sizeof(A));
    for (int i = 1; i <= 16; i++)
      for (int j = 1; j <= 16; j++)
        for (int k = 1; k <= 16; k++)
          A[i][k] = (A[i][k] + B[i][j] * C[j][k]) % maxp;
  }
}
int Sol(int x) {
  if (x <= 1) return 0;
  if (x == 2) return 8;
  qck(x - 2);
  long long ans = 0;
  for (int i = 1; i <= 8; i++)
    for (int j = 1; j <= 16; j++) ans = (ans + A[i][j]) % maxp;
  return ans;
}
int Calc(int x) {
  if (x <= 0) return 0;
  if (x == 1) return 4;
  if (x == 2) return 8;
  int tmp = (Sol(x) + Sol((x + 1) / 2)) % maxp;
  if (tmp % 2 != 0) tmp += maxp;
  return tmp / 2 + 4;
}
int main() {
  int L, R;
  makeC();
  scanf("%d%d", &L, &R);
  printf("%d\n", (Calc(R) - Calc(L - 1) + maxp) % maxp);
  return 0;
}
