#include <bits/stdc++.h>
using namespace std;
const int mo = 1000000007 * 2;
int a[17][17], ans[17][17], b[17][17], l, r;
int P(int x, int y) { return y + x * 4; }
void pret() {
  int j, k, l;
  for (j = 0; j < 4; ++j)
    for (k = 0; k < 4; ++k) {
      for (l = 0; l < 4; ++l) {
        if (k == l) continue;
        if (k == 0 && l == 3) continue;
        if (k == 3 && l == 0) continue;
        if (k == 2 && l == 1) continue;
        if (k == 1 && l == 2) continue;
        if (j == 1 && k == 0 && l == 2) continue;
        if (j == 2 && k == 0 && l == 1) continue;
        a[P(j, k)][P(k, l)]++;
      }
      a[P(j, k)][16] = 1;
    }
  a[16][16] = 1;
}
void cheng(int a[17][17], int b[17][17]) {
  int c[17][17] = {0}, i, j, k;
  for (i = 0; i <= 16; ++i)
    for (j = 0; j <= 16; ++j)
      for (k = 0; k <= 16; ++k)
        c[i][k] = ((long long)a[i][j] * b[j][k] + c[i][k]) % mo;
  for (i = 0; i <= 16; ++i)
    for (j = 0; j <= 16; ++j) a[i][j] = c[i][j];
}
long long calc(int x) {
  memset(ans, 0, sizeof(ans));
  ans[0][P(0, 0)] = ans[0][P(1, 1)] = ans[0][P(2, 2)] = ans[0][P(3, 3)] = 1;
  memcpy(b, a, sizeof(b));
  while (x) {
    if (x & 1) cheng(ans, b);
    cheng(b, b);
    x /= 2;
  }
  return ans[0][16];
}
long long work(int x) {
  if (!x) return 0;
  return (calc(x) + calc((x + 1) / 2)) / 2;
}
int main() {
  pret();
  scanf("%d%d", &l, &r);
  printf("%d\n", (work(r) - work(l - 1) + 1000000007ll * 4) % 1000000007);
}
