#include <bits/stdc++.h>
using namespace std;
int L, r;
struct Matrix {
  int r, c;
  long long a[16][16];
  Matrix() {
    r = c = 0;
    memset(a, 0, sizeof(a));
  }
};
Matrix f, D;
Matrix mul(const Matrix A, const Matrix B) {
  Matrix C;
  C.r = A.r;
  C.c = B.c;
  for (int i = 0; i < C.r; ++i)
    for (int j = 0; j < C.c; ++j)
      for (int k = 0; k < A.c; ++k) {
        C.a[i][j] += A.a[i][k] * B.a[k][j] % 1000000007;
        if (C.a[i][j] >= 1000000007) C.a[i][j] -= 1000000007;
      }
  return C;
}
Matrix quick_pow(const Matrix A, int k) {
  if (k == 1) return A;
  Matrix tmp = quick_pow(A, k / 2);
  Matrix ret = mul(tmp, tmp);
  if (k & 1) ret = mul(ret, A);
  return ret;
}
Matrix sum(const Matrix A, const Matrix B) {
  Matrix C;
  C.r = A.r;
  C.c = A.c;
  for (int i = 0; i < C.r; ++i)
    for (int j = 0; j < C.c; ++j)
      C.a[i][j] = (A.a[i][j] + B.a[i][j]) % 1000000007;
  return C;
}
Matrix calc(const Matrix A, int k) {
  if (k == 1) return A;
  Matrix tmp = calc(A, k / 2);
  Matrix ret = sum(tmp, mul(quick_pow(A, k / 2), tmp));
  if (k & 1) ret = sum(ret, quick_pow(A, k));
  return ret;
}
long long query(int L, int r) {
  long long s = 0;
  if (L > 3) {
    Matrix ans = mul(mul(f, quick_pow(D, L - 3)), calc(D, r - L + 1));
    for (int i = 0; i < 16; ++i) s = (s + ans.a[0][i]) % 1000000007;
  } else {
    if (L == 1 && r == 1) s = 4;
    if (L == 1 && r == 2) s = 12;
    if (L == 1 && r == 3) s = 26;
    if (L == 2 && r == 2) s = 8;
    if (L == 2 && r == 3) s = 22;
    if (L == 3 && r == 3) s = 14;
    if (r > 3) {
      Matrix ans = mul(mul(f, quick_pow(D, 1)), calc(D, r - 3));
      for (int i = 0; i < 16; ++i) s = (s + ans.a[0][i]) % 1000000007;
      if (L == 1) s = (s + 26) % 1000000007;
      if (L == 2) s = (s + 22) % 1000000007;
      if (L == 3) s = (s + 14) % 1000000007;
    }
  }
  return s % 1000000007;
}
int main() {
  scanf("%d%d", &L, &r);
  D.r = 16;
  D.c = 16;
  D.a[8][2] = 1;
  D.a[12][3] = 1;
  D.a[9][6] = 1;
  D.a[13][6] = 1;
  D.a[13][7] = 1;
  D.a[9][7] = 1;
  D.a[6][8] = 1;
  D.a[2][8] = 1;
  D.a[6][9] = 1;
  D.a[2][9] = 1;
  D.a[3][12] = 1;
  D.a[7][12] = 1;
  D.a[3][13] = 1;
  D.a[7][13] = 1;
  f.r = 1;
  f.c = 16;
  f.a[0][2] = 1;
  f.a[0][3] = 1;
  f.a[0][6] = 1;
  f.a[0][7] = 1;
  f.a[0][8] = 1;
  f.a[0][9] = 1;
  f.a[0][12] = 1;
  f.a[0][13] = 1;
  long long ans = 0;
  if (L == r && !(L & 1))
    ans = query(L, r) * 500000004 % 1000000007;
  else {
    int tmpL = L, tmpr = r;
    if (!(tmpL & 1)) ++tmpL;
    if (!(tmpr & 1)) --tmpr;
    ans = (query(L, r) + query(tmpL / 2 + 1, tmpr / 2 + 1)) % 1000000007 *
          500000004 % 1000000007;
  }
  printf("%I64d\n", ans);
  return 0;
}
