#include <bits/stdc++.h>
using namespace std;
const int mo = 1000000007;
class mat {
 public:
  long long a[10][10];
  void init() { memset(a, 0, sizeof(a)); }
  mat operator*(mat& b) {
    mat c;
    for (int i = 1; i <= 9; i++)
      for (int j = 1; j <= 9; j++) {
        long long res = 0;
        for (int k = 1; k <= 9; k++) {
          res += a[i][k] * b.a[k][j];
          if (res >= mo) res %= mo;
        }
        c.a[i][j] = res;
      }
    return c;
  }
};
int l, r;
mat g;
int power(long long a, int b) {
  long long tmp = 1;
  while (b)
    if (b & 1) {
      --b;
      tmp = tmp * a % mo;
    } else {
      b /= 2;
      a = a * a % mo;
    }
  return tmp;
}
long long calc(int n) {
  if (n == 0) return 0;
  if (n == 1) return 4;
  if (n == 2) return 12;
  n -= 3;
  mat tmp = g, a = g;
  while (n)
    if (n & 1) {
      --n;
      tmp = tmp * a;
    } else {
      n /= 2;
      a = a * a;
    }
  int res = 0;
  for (int s = 1; s <= 9; s++)
    for (int s1 = 1; s1 <= 8; s1++) {
      res = (res + tmp.a[s][s1]) % mo;
    }
  return res + 4;
}
int main() {
  g.init();
  for (int s = 1; s <= 8; s++) {
    g.a[9][s] = 1;
    int i = (s + 1) / 2, a;
    if (i == 1 || i == 2)
      a = 3;
    else
      a = 1;
    if (s % 2 == 0) ++a;
    for (int b = 1; b <= 4; b++) {
      if (a == b || a + b == 3 || a + b == 7) continue;
      if (i == 1 && a == 3 && b == 2 || i == 2 && a == 3 && b == 1) continue;
      ++g.a[s][(a - 1) * 2 + (b >= 3 ? b - 2 : b)];
    }
  }
  g.a[9][9] = 1;
  cin >> l >> r;
  cout << (((calc(r) - calc(l - 1) + calc((r + 1) / 2) - calc(l / 2)) % mo) *
               power(2, mo - 2) % mo +
           mo) %
              mo
       << endl;
  return 0;
}
