#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
struct Matrix {
  long long base[15][15];
  void init() {
    memset(base, 0, sizeof(base));
    base[1][3] = base[1][4] = base[2][3] = base[2][4] = base[3][1] =
        base[3][2] = base[4][1] = base[4][2] = base[5][1] = base[6][2] =
            base[7][3] = base[8][4] = base[9][1] = base[9][2] = base[9][3] =
                base[9][4] = base[9][9] = 1;
    base[1][6] = base[2][5] = mod - 1;
  }
  Matrix operator*(const Matrix &a) const {
    Matrix c;
    memset(c.base, 0, sizeof(c.base));
    for (int i = 1; i <= 9; ++i)
      for (int j = 1; j <= 9; ++j)
        for (int k = 1; k <= 9; ++k)
          c.base[i][j] = (c.base[i][j] + base[i][k] * a.base[k][j]) % mod;
    return c;
  }
  Matrix operator^(const long long &a) const {
    long long tmp = a;
    Matrix E = *this, P = *this;
    tmp--;
    while (tmp) {
      if (tmp & 1) E = E * P;
      P = P * P;
      tmp >>= 1;
    }
    return E;
  }
};
long long solv(long long n) {
  if (n == 0) return 0;
  if (n == 1) return 4;
  Matrix B;
  B.init();
  B = B ^ n;
  long long ans = 0;
  for (int i = 1; i <= 4; ++i) ans = (ans + B.base[9][i]) % mod;
  B.init();
  B = B ^ ((n + 1) / 2);
  for (int i = 1; i <= 4; ++i) ans = (ans + B.base[9][i] + mod) % mod;
  return ans * 500000004LL % mod;
}
int main() {
  long long l, r;
  scanf("%lld%lld", &l, &r);
  printf("%lld\n", ((solv(r) - solv(l - 1)) % mod + mod) % mod);
}
