#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool checkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool checkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const long long MOD = 1000000007LL;
const int MAXN = 18;
inline long long div(long long num = 2) {
  long long ret = 1, n = MOD - 2;
  while (n) {
    if (n & 1LL) ret = (ret * num) % MOD;
    num = (num * num) % MOD;
    n >>= 1;
  }
  return ret;
}
inline void pow(long long a[MAXN][MAXN], long long b[MAXN][MAXN],
                long long c[MAXN][MAXN]) {
  static long long t[MAXN][MAXN];
  for (int i = 0; i < (MAXN); ++i) {
    for (int j = 0; j < (MAXN); ++j) {
      t[i][j] = 0;
      for (int k = 0; k < (MAXN); ++k) {
        t[i][j] += a[i][k] * b[k][j];
        t[i][j] %= MOD;
      }
    }
  }
  memcpy(c, t, sizeof(t));
}
inline long long solve(long long n) {
  static long long mat[MAXN][MAXN], ans[MAXN][MAXN];
  memset(mat, 0, sizeof(mat));
  mat[0][1] = mat[0][3] = mat[0][5] = mat[0][7] = 1;
  mat[1][13] = mat[1][7] = mat[3][15] = mat[3][7] = 1;
  mat[5][1] = mat[5][3] = mat[7][1] = mat[7][3] = 1;
  mat[13][1] = mat[15][3] = 1;
  for (int i = 0; i < (MAXN); ++i) {
    mat[i][MAXN - 1] = 1;
  }
  memset(ans, 0, sizeof(ans));
  for (int i = 0; i < (MAXN); ++i) {
    ans[i][i] = 1;
  }
  while (n) {
    if (n & 1) {
      pow(ans, mat, ans);
    }
    pow(mat, mat, mat);
    n >>= 1;
  }
  long long ret = 0;
  for (int i = 0; i < (MAXN); ++i) {
    ret = (ret + ans[0][i]) % MOD;
  }
  return ret;
}
int main() {
  long long L, R;
  while (cin >> L >> R) {
    long long ans = ((solve(R) + (solve((R + 1) >> 1))) % MOD -
                     (solve(L - 1) + solve(L >> 1)) % MOD + MOD) %
                    MOD;
    ans = (ans * div()) % MOD;
    cout << ans << endl;
  }
  return 0;
}
