#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
const int N = 105;
const int M = 1005;
struct Matrix {
  long long m[9][9];
  void debug() {
    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) cout << m[i][j] << " ";
      cout << endl;
    }
  }
} init, unit;
Matrix mut(Matrix a, Matrix b) {
  Matrix ret;
  for (int i = 0; i < 9; i++) {
    for (int j = 0; j < 9; j++) {
      ret.m[i][j] = 0;
      for (int k = 0; k < 9; k++) {
        ret.m[i][j] = (ret.m[i][j] + a.m[i][k] * b.m[k][j]) % MOD;
      }
    }
  }
  return ret;
}
Matrix powmod(Matrix a, long long b) {
  Matrix ret;
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) ret.m[i][j] = i == j;
  while (b) {
    if (b & 1) ret = mut(ret, a);
    a = mut(a, a);
    b >>= 1;
  }
  return ret;
}
long long powmod(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return ret;
}
long long L, R;
long long gao(long long n) {
  if (n == 0) return 0;
  if (n == 1) return 4;
  unit = powmod(init, n - 1);
  long long ans = 0;
  for (int i = 0; i < 8; i++) {
    ans = (ans + unit.m[i][8]) % MOD;
  }
  if (n >= 3) {
    unit = powmod(init, (n + 1) / 2 - 1);
    for (int i = 0; i < 8; i++) {
      ans = (ans + unit.m[i][8]) % MOD;
    }
  }
  ans = (4 + ans * powmod(2, MOD - 2) % MOD) % MOD;
  return ans;
}
int main() {
  init.m[2][0] = init.m[3][0] = 1LL;
  init.m[4][1] = init.m[5][1] = 1LL;
  init.m[0][2] = 1LL;
  init.m[6][3] = init.m[7][3] = 1LL;
  init.m[1][4] = 1LL;
  init.m[6][5] = init.m[7][5] = 1LL;
  init.m[4][6] = init.m[5][6] = 1LL;
  init.m[2][7] = init.m[3][7] = 1LL;
  for (int i = 0; i < 9; i++) init.m[i][8] = 1LL;
  cin >> L >> R;
  cout << (gao(R) - gao(L - 1) + MOD) % MOD << endl;
  return 0;
}
