#include <bits/stdc++.h>
const int mo = 1000000007,
          x[9][9] = {{0, 0, 0, 0, 1, 1, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 1, 1, 1},
                     {0, 0, 0, 0, 1, 1, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 1, 1, 1},
                     {1, 0, 0, 0, 0, 0, 0, 0, 1}, {0, 0, 1, 1, 0, 0, 0, 0, 1},
                     {0, 1, 0, 0, 0, 0, 0, 0, 1}, {0, 0, 1, 1, 0, 0, 0, 0, 1},
                     {0, 0, 0, 0, 0, 0, 0, 0, 1}};
int a[9], t[9], b[9][9], c[9][9], l, r, ans;
void mul(int a[][9], int b[][9], int c[][9]) {
  int i, j, k;
  for (i = 0; i <= 8; ++i)
    for (j = 0; j <= 8; ++j) {
      c[i][j] = 0;
      for (k = 0; k <= 8; ++k)
        c[i][j] = (c[i][j] + (long long)a[i][k] * b[k][j]) % mo;
    }
}
int calc(int n) {
  if (!n) return 0;
  int i, j, v;
  for (i = 0; i <= 8; ++i) a[i] = 1;
  a[8] = 4;
  memcpy(b, x, sizeof x);
  --n;
  while (n) {
    if (n % 2) {
      for (i = 0; i <= 8; ++i) {
        t[i] = 0;
        for (j = 0; j <= 8; ++j) t[i] = (t[i] + (long long)a[j] * b[j][i]) % mo;
      }
      memcpy(a, t, sizeof t);
    }
    mul(b, b, c);
    memcpy(b, c, sizeof c);
    memcpy(c, t, sizeof t);
    n /= 2;
  }
  return a[8];
}
int query(int n) { return (calc(n) + calc((n + 1) / 2)) % mo; }
int main() {
  scanf("%d%d", &l, &r);
  ans = ((long long)(query(r) - query(l - 1)) * ((mo + 1) / 2) % mo + mo) % mo;
  printf("%d\n", ans);
  return 0;
}
