#include <bits/stdc++.h>
const int K = 9;
const long long mod = 1000000007, inv = 500000004;
const long long C[K][K] = {
    {1, 0, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 1, 1, 0, 0, 0, 0},
    {1, 0, 0, 0, 0, 1, 1, 0, 0}, {1, 1, 0, 0, 0, 0, 0, 0, 0},
    {1, 0, 0, 0, 0, 0, 0, 1, 1}, {1, 0, 1, 0, 0, 0, 0, 0, 0},
    {1, 0, 0, 0, 0, 0, 0, 1, 1}, {1, 0, 0, 1, 1, 0, 0, 0, 0},
    {1, 0, 0, 0, 0, 1, 1, 0, 0}};
int L, R;
long long A[K], B[K][K], a[K], b[K][K];
void Mul1() {
  memset(a, 0, sizeof(a));
  for (int i = 0; i < K; ++i)
    for (int j = 0; j < K; ++j) a[j] = (a[j] + A[i] * B[i][j]) % mod;
  memcpy(A, a, sizeof(a));
}
void Mul2() {
  memset(b, 0, sizeof(b));
  for (int i = 0; i < K; ++i)
    for (int j = 0; j < K; ++j)
      for (int k = 0; k < K; ++k) b[i][k] = (b[i][k] + B[i][j] * B[j][k]) % mod;
  memcpy(B, b, sizeof(b));
}
void Mul(int N) {
  for (; N; N >>= 1) {
    if (N & 1) Mul1();
    Mul2();
  }
}
int Get(int N) {
  if (N == 0) return 0;
  memcpy(B, C, sizeof(C));
  A[0] = 4;
  for (int i = 1; i < K; ++i) A[i] = 1;
  Mul(N - 1);
  return A[0];
}
int calc(int N) { return (Get(N) + Get((N + 1) / 2)) % mod * inv % mod; }
int main() {
  scanf("%d%d", &L, &R);
  printf("%d\n", (calc(R) - calc(L - 1) + mod) % mod);
  return 0;
}
