#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
struct Matrix {
  long long dp[20][20];
  void init() { memset(dp, 0, sizeof(dp)); }
  Matrix operator*(const Matrix &b) const {
    Matrix ans;
    ans.init();
    for (int i = 1; i <= 9; i++)
      for (int j = 1; j <= 9; j++) {
        for (int k = 1; k <= 9; k++)
          ans.dp[i][j] += dp[i][k] * 1LL * b.dp[k][j] % mod,
              ans.dp[i][j] %= mod;
      }
    return ans;
  }
  Matrix operator^(const int &k) const {
    Matrix E, a = (*this);
    int n = k;
    E.init();
    for (int i = 1; i <= 9; i++) E.dp[i][i] = 1;
    while (n) {
      if (n & 1) E = E * a;
      a = a * a;
      n >>= 1;
    }
    return E;
  }
} A;
long long solve(int lim) {
  Matrix B = A ^ lim;
  long long ans = 0;
  for (int i = 1; i <= 4; i++) ans += B.dp[9][i], ans %= mod;
  B = A ^ ((lim + 1) / 2);
  for (int i = 1; i <= 4; i++) ans += B.dp[9][i], ans %= mod;
  return (ans * 500000004 % mod + mod) % mod;
}
int main() {
  int L, R;
  A.init();
  scanf("%d%d", &L, &R);
  A.dp[1][3] = 1, A.dp[1][4] = 1, A.dp[1][6] = -1;
  A.dp[2][3] = 1, A.dp[2][4] = 1, A.dp[2][5] = -1;
  A.dp[3][1] = 1, A.dp[3][2] = 1;
  A.dp[4][1] = 1, A.dp[4][2] = 1;
  A.dp[5][1] = 1;
  A.dp[6][2] = 1;
  A.dp[7][3] = 1;
  A.dp[8][4] = 1;
  A.dp[9][1] = 1, A.dp[9][2] = 1, A.dp[9][3] = 1, A.dp[9][4] = 1,
  A.dp[9][9] = 1;
  printf("%lld\n", (solve(R) - solve(L - 1) + mod) % mod);
}
