#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  char ch = getchar();
  bool positive = 1;
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') positive = 0;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  return positive ? x : -x;
}
const int MOD = 1000000007, MaxN = 17;
struct matrix {
  long long tmp[MaxN][MaxN];
  long long a[MaxN][MaxN];
  int N, M;
  matrix(int n = 0, int m = 0) { build(n, m); }
  void build(int n, int m) {
    N = n, M = m;
    memset(a, 0, sizeof(a));
  }
  matrix operator*(matrix &b) {
    memset(tmp, 0, sizeof(tmp));
    for (int i = 0; i < N; ++i)
      for (int j = 0; j < M; ++j)
        for (int k = 0; k < b.M; ++k)
          tmp[i][k] = (tmp[i][k] + a[i][j] * b.a[j][k]) % MOD;
    matrix T;
    T.N = N, T.M = b.M;
    memcpy(T.a, tmp, sizeof(tmp));
    return T;
  }
  bool operator==(matrix A) {
    if (N != A.N || M != A.M) return 0;
    for (int i = 0; i < N; ++i)
      for (int j = 0; j < M; ++j)
        if (a[i][j] != A.a[i][j]) return 0;
    return 1;
  }
  bool operator!=(matrix A) { return !((*this) == A); }
  void print() {
    for (int i = 0; i < N; ++i) {
      for (int j = 0; j < M; ++j) printf("%d ", a[i][j]);
      printf("\n");
    }
  }
} I;
inline matrix power(matrix A, long long x) {
  matrix B = I;
  for (; x; x >>= 1) {
    if (x & 1) B = A * B;
    A = A * A;
  }
  return B;
}
inline matrix power(matrix A, matrix B, long long x) {
  for (; x; x >>= 1) {
    if (x & 1) A = A * B;
    B = B * B;
  }
  return A;
}
inline long long power(long long x, int y) {
  long long ans = 1;
  for (; y; y >>= 1) {
    if (y & 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
matrix A, B;
inline long long f(int x) {
  if (x == 0) return 1;
  return power(A, B, x - 1).a[0][16];
}
int main() {
  I.build(17, 17);
  for (int i = 0; i < 17; ++i) I.a[i][i] = 1;
  A.build(1, 17);
  for (int i = 0; i < 4; ++i) A.a[0][3 * 4 + i] = 1;
  A.a[0][16] = 5;
  B.build(17, 17);
  for (int i = 0; i < 4; ++i)
    for (int j = 0; j < 4; ++j)
      for (int k = 0; k < 4; ++k)
        if (j != k && j * 4 + k != 3 && k * 4 + j != 3 && j * 4 + k != 9 &&
            k * 4 + j != 9 && i * 4 * 4 + j * 4 + k != 6 &&
            i * 4 * 4 + j * 4 + k != 9 && i * 4 * 4 + j * 4 + k != 18 &&
            i * 4 * 4 + j * 4 + k != 24 && i * 4 * 4 + j * 4 + k != 33 &&
            i * 4 * 4 + j * 4 + k != 36)
          B.a[i * 4 + j][j * 4 + k]++, B.a[i * 4 + j][16]++;
  B.a[16][16] = 1;
  int L = read() - 1, R = read();
  long long ans = f(R) - f(L);
  int l = (L + 1) / 2, r = (R + 1) / 2;
  ans = (ans + f(r) - f(l)) % MOD;
  ans = ans * power(2, MOD - 2) % MOD;
  ans = (ans + MOD) % MOD;
  cout << ans << endl;
  return 0;
}
