#include <bits/stdc++.h>
using namespace std;
template <class T>
void rdn(T& x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
const int mod = 1000000007;
const int inv = 500000004;
int L, R;
struct matrix {
  long long a[9][9];
  matrix() { memset(a, 0, sizeof(a)); }
};
matrix S, E;
void pre() {
  for (int i = 0; i < 9; ++i) {
    E.a[i][i] = 1;
  }
  S.a[0][2] = 1, S.a[0][3] = 1, S.a[0][5] = -1;
  S.a[1][2] = 1, S.a[1][3] = 1, S.a[1][4] = -1;
  S.a[2][0] = 1, S.a[2][1] = 1;
  S.a[3][0] = 1, S.a[3][1] = 1;
  S.a[4][0] = 1;
  S.a[5][1] = 1;
  S.a[6][2] = 1;
  S.a[7][3] = 1;
  S.a[8][0] = 1, S.a[8][1] = 1, S.a[8][2] = 1, S.a[8][3] = 1, S.a[8][8] = 1;
}
matrix operator*(matrix x, matrix y) {
  matrix res;
  for (int i = 0; i < 9; ++i) {
    for (int j = 0; j < 9; ++j) {
      for (int h = 0; h < 9; ++h) {
        res.a[i][j] = (res.a[i][j] + x.a[i][h] * y.a[h][j] % mod) % mod;
      }
    }
  }
  return res;
}
matrix power(matrix x, int y) {
  matrix res = E;
  while (y) {
    if (y & 1) res = res * x;
    x = x * x, y >>= 1;
  }
  return res;
}
long long calc(matrix x) {
  long long ans = 0;
  for (int i = 0; i < 4; ++i) ans += x.a[8][i];
  return ans;
}
long long solve(long long n) {
  matrix res1 = power(S, n), res2 = power(S, (n + 1) >> 1);
  return (calc(res1) + calc(res2)) % mod * inv % mod;
}
int main() {
  pre();
  rdn(L), rdn(R);
  printf("%lld\n", (solve(R) - solve(L - 1) + mod) % mod);
}
