#include <bits/stdc++.h>
const int oo = 1000000007, phi = 500000004;
const int e[9][9] = {
    {0, 0, 1, 0, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 0, 1, 0, 0},
    {1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 1, 0, 0, 0, 1, 0}, {0, 0, 0, 1, 0, 0, 0, 1, 0},
    {0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 1, 0, 0, 0, 1, 0, 0, 0},
    {1, 1, 1, 1, 1, 1, 1, 1, 1},
};
int a[9][9], b[9][9], c[9], ans[9];
void mul1() {
  memset(c, 0, sizeof(c));
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) c[i] = (1LL * a[i][j] * ans[j] + c[i]) % oo;
  memcpy(ans, c, sizeof(ans));
}
void mul() {
  memset(b, 0, sizeof(b));
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++)
      for (int k = 0; k < 9; k++)
        b[i][j] = (1LL * a[i][k] * a[k][j] + b[i][j]) % oo;
  memcpy(a, b, sizeof(a));
}
int work(int x) {
  for (int i = 0; i < 9; i++) ans[i] = i < 8;
  memcpy(a, e, sizeof(a));
  while (x) {
    if (x & 1) mul1();
    x /= 2;
    mul();
  }
  return ans[8];
}
int get(int x) { return x < 0 ? 0 : 1LL * phi * (work(x) + work(x / 2)) % oo; }
int main() {
  int L, R;
  scanf("%d%d", &L, &R);
  printf("%d\n", (get(R - 1) - get(L - 2) + (L == 1 ? 4 : 0) + oo) % oo);
  return 0;
}
