#include <bits/stdc++.h>
using namespace std;
typedef long long M[15][15];
long long l, r;
const int p = 1e9 + 7;
const int inv2 = 500000004;
template <typename T>
inline void read(T &x) {
  x = 0;
  char c;
  int lenp = 1;
  do {
    c = getchar();
    if (c == '-') lenp = -1;
  } while (!isdigit(c));
  do {
    x = x * 10 + c - '0';
    c = getchar();
  } while (isdigit(c));
  x *= lenp;
}
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];
}
long long A[15][15] = {
    {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 C;
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) C[i][j] = A[i][j];
  Pow(C, n);
  long long ans = 0;
  for (int i = 0; i < 4; i++) ans = (ans + C[8][i]) % p;
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) C[i][j] = A[i][j];
  Pow(C, (n + 1) / 2);
  for (int i = 0; i < 4; i++) ans = (ans + C[8][i] + p) % p;
  return (long long)(ans * inv2 % p);
}
int main() {
  read(l);
  read(r);
  long long ans = (((Solve(r) - Solve(l - 1)) + p) % p);
  printf("%lld\n", ans);
  return 0;
}
