#include <bits/stdc++.h>
using namespace std;
const int Mod = 1000000007;
const int N = 17;
const int A[N][N] = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                     {1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0},
                     {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0},
                     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                     {0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0},
                     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                     {0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0},
                     {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0},
                     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                     {0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0},
                     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                     {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0},
                     {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0},
                     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                     {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
const int X[N] = {0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 4};
int L, R, B[N][N], C[N][N];
void Qck(int p) {
  if (p == 1) {
    memcpy(B, A, sizeof(B));
    return;
  }
  Qck(p >> 1);
  memset(C, 0, sizeof(C));
  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] + ((long long)B[i][k] * (long long)B[k][j]) % Mod) % Mod;
  memcpy(B, C, sizeof(C));
  if (p & 1) {
    memset(B, 0, sizeof(B));
    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++)
        for (int k = 0; k < N; k++)
          B[i][j] =
              (B[i][j] + ((long long)A[i][k] * (long long)C[k][j]) % Mod) % Mod;
  }
}
long long QCK(int p) {
  if (p == 0) return 1;
  long long ret = QCK(p >> 1);
  ret = ret * ret % Mod;
  if (p & 1) ret = (ret + ret) % Mod;
  return ret;
}
long long Calc(int K) {
  if (K == 0) return 0;
  if (K == 1) return 4;
  if (K == 2) return 12;
  Qck(K - 2);
  long long ret = 0;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++)
      ret = (ret + ((long long)B[i][j] * (long long)X[j]) % Mod) % Mod;
  return ret;
}
int main() {
  scanf("%d%d", &L, &R);
  long long Ans =
      (Calc(R) + Calc((R + 1) / 2) - Calc(L - 1) - Calc(L / 2) + Mod + Mod) %
      Mod;
  Ans = Ans * QCK(Mod - 2) % Mod;
  printf("%I64d\n", Ans);
  return 0;
}
