#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007, dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
const double eps = 1e-8;
void read(int &k) {
  k = 0;
  char x = getchar();
  while (x < '0' || x > '9') x = getchar();
  while (x >= '0' && x <= '9') {
    k = k * 10 - 48 + x;
    x = getchar();
  }
}
long long mul[40][40], tmp[40][40], now[40], nxt[40];
int L, R, no[10][10];
long long powe(long long a, long long b) {
  long long ret = 1;
  for (; b; b >>= 1, a = a * a % MOD)
    if (b & 1) ret = ret * a % MOD;
  return ret;
}
long long solve1(int x) {
  if (x == 0) return 0;
  memset(mul, 0, sizeof mul);
  for (int i = 0; i < 5; i++)
    for (int j = 0; j < 5; j++)
      if (!no[i][j])
        for (int k = 1; k < 5; k++)
          if (!no[j][k])
            if ((i != 4 || j != 1 || k != 3) && (i != 3 || j != 1 || k != 4))
              mul[i * 6 + j][j * 6 + k] = 1;
  for (int i = 0; i < 5; i++)
    for (int j = 0; j < 5; j++) mul[i * 6 + j][35] = 1;
  mul[35][35] = 1;
  memset(now, 0, sizeof now);
  now[0] = 1;
  for (; x; x >>= 1) {
    if (x & 1) {
      memset(nxt, 0, sizeof nxt);
      for (int k = 0; k < 36; k++)
        if (now[k])
          for (int j = 0; j < 36; j++)
            nxt[j] = (nxt[j] + now[k] * mul[k][j]) % MOD;
      memcpy(now, nxt, sizeof now);
    }
    memset(tmp, 0, sizeof tmp);
    for (int i = 0; i < 36; i++)
      for (int k = 0; k < 36; k++)
        if (mul[i][k])
          for (int j = 0; j < 36; j++)
            tmp[i][j] = (tmp[i][j] + mul[i][k] * mul[k][j]) % MOD;
    memcpy(mul, tmp, sizeof mul);
  }
  long long ret = 0;
  for (int i = 0; i < 36; i++) ret = (ret + now[i]) % MOD;
  return (ret + MOD - 1) % MOD;
}
long long solve2(int x) {
  long long ret = 0;
  x--;
  int y = x;
  for (int T = 1; T <= 4; T++) {
    x = y;
    memset(mul, 0, sizeof mul);
    for (int i = 0; i < 5; i++)
      for (int j = 0; j < 5; j++)
        if (!no[i][j])
          for (int k = 1; k < 5; k++)
            if (!no[j][k])
              if ((i != 4 || j != 1 || k != 3) && (i != 3 || j != 1 || k != 4))
                mul[i * 6 + j][j * 6 + k] = 1;
    for (int i = 0; i < 5; i++)
      for (int j = 0; j < 5; j++) mul[i * 6 + j][35] = 1;
    mul[35][35] = 1;
    memset(now, 0, sizeof now);
    now[T] = 1;
    for (; x; x >>= 1) {
      if (x & 1) {
        memset(nxt, 0, sizeof nxt);
        for (int k = 0; k < 36; k++)
          if (now[k])
            for (int j = 0; j < 36; j++)
              nxt[j] = (nxt[j] + now[k] * mul[k][j]) % MOD;
        memcpy(now, nxt, sizeof now);
      }
      memset(tmp, 0, sizeof tmp);
      for (int i = 0; i < 36; i++)
        for (int k = 0; k < 36; k++)
          if (mul[i][k])
            for (int j = 0; j < 36; j++)
              tmp[i][j] = (tmp[i][j] + mul[i][k] * mul[k][j]) % MOD;
      memcpy(mul, tmp, sizeof mul);
    }
    for (int i = 0; i < 36; i++) ret = (ret + now[i]) % MOD;
  }
  return (ret + MOD) % MOD;
}
long long calc(int x) {
  if (x == 0) return 0;
  return (solve1(x) + solve2((x + 1) / 2)) % MOD * powe(2, MOD - 2) % MOD;
}
int main() {
  cin >> L >> R;
  no[1][1] = no[2][2] = no[3][3] = no[4][4] = no[1][2] = no[3][4] = no[2][1] =
      no[4][3] = 1;
  cout << (calc(R) - calc(L - 1) + MOD) % MOD << endl;
  return 0;
}
