#include <bits/stdc++.h>
using namespace std;
const long long M = 1000000007;
const long long inv2 = 500000004;
int L, R;
long long A[9][9] = {{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, 1},
                     {0, 0, 0, 0, 0, 0, 0, 0, 1}};
long long v1[9];
void mul(long long x[9][9], long long y[9][9], long long z[9][9]) {
  long long tm[9][9];
  memset(tm, 0, sizeof(tm));
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++)
      for (int k = 0; k < 9; k++) tm[i][j] = (tm[i][j] + x[i][k] * y[k][j]) % M;
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) z[i][j] = tm[i][j];
}
void power(long long ret[9][9], int x) {
  if (x == 0) {
    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) ret[i][j] = 0;
      ret[i][i] = 1;
    }
  } else if (x == 1) {
    for (int i = 0; i < 9; i++)
      for (int j = 0; j < 9; j++) ret[i][j] = A[i][j];
  } else {
    long long d[9][9];
    power(d, x / 2);
    mul(d, d, ret);
    if (x & 1) {
      mul(ret, A, ret);
    }
  }
}
long long f(int N) {
  if (N == 0) return 0;
  N--;
  for (int i = 0; i < 8; i++) v1[i] = 1;
  v1[8] = 4;
  long long ret[9][9];
  power(ret, N);
  long long tot = 0;
  for (int i = 0; i < 9; i++) tot = (tot + v1[i] * ret[i][8]) % M;
  return tot;
}
long long cal(int N) { return ((f(N) + f((N + 1) / 2)) % M) * inv2 % M; }
int main() {
  while (scanf("%d%d", &L, &R) != EOF) {
    long long ans = ((cal(R) - cal(L - 1)) % M + M) % M;
    cout << ans << endl;
  }
  return 0;
}
