#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f, maxn = 100001;
typedef long long M[9][9];
const int p = 1e9 + 7, inv2 = 500000004;
void Mul(M &A, M B) {
  M C;
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) {
      C[i][j] = 0;
      for (int k = 0; k < 9; k++) C[i][j] += A[i][k] * B[k][j] % p;
    }
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) A[i][j] = C[i][j] % p;
}
void Pow(M &A, long long k) {
  M B;
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) B[i][j] = (i == j);
  while (k) {
    if (k & 1) Mul(B, A);
    Mul(A, A);
    k >>= 1;
  }
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) A[i][j] = B[i][j];
}
M A = {{0, 0, 1, 1, 0, p - 1, 0, 0, 0}, {0, 0, 1, 1, p - 1, 0, 0, 0, 0},
       {1, 1, 0, 0, 0, 0, 0, 0, 0},     {1, 1, 0, 0, 0, 0, 0, 0, 0},
       {1, 0, 0, 0, 0, 0, 0, 0, 0},     {0, 1, 0, 0, 0, 0, 0, 0, 0},
       {0, 0, 1, 0, 0, 0, 0, 0, 0},     {0, 0, 0, 1, 0, 0, 0, 0, 0},
       {1, 1, 1, 1, 0, 0, 0, 0, 1}};
int Solve(long long n) {
  M B;
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) B[i][j] = A[i][j];
  Pow(B, n);
  int ans = 0;
  for (int i = 0; i < 4; i++) ans = (ans + B[8][i]) % p;
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) B[i][j] = A[i][j];
  Pow(B, (n + 1) / 2);
  for (int i = 0; i < 4; i++) ans = (ans + B[8][i] + p) % p;
  return (long long)ans * inv2 % p;
}
int main() {
  long long L, R;
  while (~scanf("%I64d%I64d", &L, &R)) {
    int ans = (Solve(R) - Solve(L - 1) + p) % p;
    printf("%d\n", ans);
  }
  return 0;
}
