#include <bits/stdc++.h>
using namespace std;
struct matrix {
  int a[25][25];
};
struct matrix g, b, e;
int l, r, mod = 1000000007;
int ans;
void init() {
  int i, j;
  g.a[7][2] = 1;
  g.a[10][3] = 1;
  g.a[11][3] = 1;
  g.a[8][5] = 1;
  g.a[10][6] = 1;
  g.a[11][6] = 1;
  g.a[2][7] = 1;
  g.a[3][7] = 1;
  g.a[5][8] = 1;
  g.a[6][8] = 1;
  g.a[2][10] = 1;
  g.a[3][10] = 1;
  g.a[5][11] = 1;
  g.a[6][11] = 1;
  for (i = 1; i <= 12; i++)
    for (j = 13; j <= 24; j++) g.a[i][j] = g.a[i][j - 12];
  for (i = 13; i <= 24; i++) g.a[i][i] = 1;
  b.a[1][2] = 1;
  b.a[1][3] = 1;
  b.a[1][5] = 1;
  b.a[1][6] = 1;
  b.a[1][7] = 1;
  b.a[1][8] = 1;
  b.a[1][10] = 1;
  b.a[1][11] = 1;
  b.a[1][14] = 1;
  b.a[1][15] = 1;
  b.a[1][17] = 1;
  b.a[1][18] = 1;
  b.a[1][19] = 1;
  b.a[1][20] = 1;
  b.a[1][22] = 1;
  b.a[1][23] = 1;
  for (i = 1; i <= 24; i++) e.a[i][i] = 1;
}
matrix operator*(matrix aa, matrix bb) {
  int i, j, k;
  matrix ret;
  for (i = 1; i <= 24; i++)
    for (j = 1; j <= 24; j++) ret.a[i][j] = 0;
  for (i = 1; i <= 24; i++)
    for (k = 1; k <= 24; k++)
      if (aa.a[i][k]) {
        for (j = 1; j <= 24; j++)
          ret.a[i][j] =
              (ret.a[i][j] + (long long)aa.a[i][k] * bb.a[k][j] % mod) % mod;
      }
  return ret;
}
matrix fpow(int j) {
  matrix d, ret;
  ret = e;
  d = g;
  while (j != 0) {
    if (j & 1) ret = ret * d;
    d = d * d;
    j = j / 2;
  }
  return ret;
}
int calc(int n) {
  matrix s;
  int i, ret = 0;
  if (n == 0) return 0;
  if (n == 1) return 4;
  s = b * fpow(n - 2);
  for (i = 13; i <= 24; i++) ret = (ret + s.a[1][i]) % mod;
  return ret + 4;
}
int main() {
  int i, j;
  init();
  scanf("%d%d", &l, &r);
  ans = (((long long)calc(r) + calc((r + 1) / 2)) % mod -
         ((long long)calc(l - 1) + calc(l / 2)) % mod) %
        mod;
  if (ans % 2 != 0) ans += mod;
  ans /= 2;
  ans = (ans + mod) % mod;
  cout << ans << endl;
  return 0;
}
