#include <bits/stdc++.h>
using namespace std;
struct matrix {
  long long a[51][51];
};
matrix mat_prod(matrix &A, matrix &B) {
  int i, j, k;
  matrix ans;
  for ((i) = 0; (i) < (int)(51); (i)++)
    for ((j) = 0; (j) < (int)(51); (j)++) ans.a[i][j] = 0;
  for ((i) = 0; (i) < (int)(51); (i)++)
    for ((k) = 0; (k) < (int)(51); (k)++)
      for ((j) = 0; (j) < (int)(51); (j)++)
        ans.a[i][j] = (ans.a[i][j] + A.a[i][k] * B.a[k][j]) % 1000000007ll;
  return ans;
}
matrix mat_pow(matrix &A, long long N) {
  int i, j;
  matrix ans;
  for ((i) = 0; (i) < (int)(51); (i)++)
    for ((j) = 0; (j) < (int)(51); (j)++) ans.a[i][j] = ((i == j) ? 1 : 0);
  for (i = 62; i >= 0; i--)
    if (N & (1ll << i)) break;
  for (; i >= 0; i--) {
    ans = mat_prod(ans, ans);
    if (N & (1ll << i)) ans = mat_prod(ans, A);
  }
  return ans;
}
long long func(int N) {
  int i, j, k;
  matrix A;
  for ((i) = 0; (i) < (int)(51); (i)++)
    for ((j) = 0; (j) < (int)(51); (j)++) A.a[i][j] = 0;
  for ((i) = 0; (i) < (int)(5); (i)++)
    for ((j) = 0; (j) < (int)(5); (j)++)
      for ((k) = 0; (k) < (int)(4); (k)++)
        if (j / 2 != k / 2 && (j != 2 || i >= 2 || k >= 2 || i == k)) {
          A.a[i * 5 + j][j * 5 + k]++;
          A.a[i * 5 + j][50]++;
        }
  A.a[50][50]++;
  matrix B = mat_pow(A, N);
  return B.a[24][50];
}
long long func2(int N) { return (func(N) + func((N + 1) / 2)) % 1000000007ll; }
int main(void) {
  int L, R;
  cin >> L >> R;
  long long ans = func2(R);
  if (L > 1) ans -= func2(L - 1);
  ans = (ans + 1000000007ll) % 1000000007ll;
  ans = ans * ((1000000007ll + 1) / 2) % 1000000007ll;
  cout << ans << endl;
  return 0;
}
