#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MOD = 1e9 + 7;
const int MAX = 25;
const int MAXD = 4;
const int R2 = 5e8 + 4;
enum { W = 0, B, R, Y };
int BS = MAXD * MAXD, PS = MAX - 1, EM = MAX - 2;
struct mT {
  mT() { clear(); }
  void clear() { memset(a, 0, sizeof(a)); }
  void setunit() {
    clear();
    for (int i = 0; i < MAX; ++i) a[i][i] = 1;
  }
  mT operator*(const mT &x) const {
    mT ans;
    for (int i = 0; i < MAX; ++i)
      for (int j = 0; j < MAX; ++j)
        for (int k = 0; k < MAX; ++k)
          ans.a[i][j] = (ans.a[i][j] + a[i][k] * x.a[k][j]) % MOD;
    return ans;
  }
  void operator*=(const mT &x) { (*this) = (*this) * x; }
  long long a[MAX][MAX];
};
int l, r;
mT bs, b2;
void init();
void input();
void work();
int getans(int nb);
int geto(int nb);
int gete(int nb);
int _geto(int nb);
int _gete(int nb);
mT qpow(mT a, int b);
int main() {
  init();
  input();
  work();
}
void init() { ios::sync_with_stdio(false); }
void input() { scanf("%d%d", &l, &r); }
void work() {
  for (int i = 0; i < MAXD; ++i) {
    for (int j = 0; j < MAXD; ++j) {
      for (int k = 0; k < MAXD; ++k) {
        if (j == k || j == W && k == Y || j == Y && k == W ||
            j == R && k == B || j == B && k == R ||
            i == B && j == W && k == R || i == R && j == W && k == B)
          continue;
        bs.a[((j)*MAXD + (k))][((i)*MAXD + (j))] = 1;
      }
    }
  }
  for (int i = 0; i < MAX; ++i)
    if (i ^ EM) bs.a[PS][i] = 1;
  for (int i = 0; i < MAXD; ++i) bs.a[i + BS][EM] = 1;
  for (int i = 0; i < MAXD; ++i) {
    for (int j = 0; j < MAXD; ++j) {
      if (i == j || i == W && j == Y || i == Y && j == W || i == R && j == B ||
          i == B && j == R)
        continue;
      bs.a[((i)*MAXD + (j))][i + BS] = 1;
    }
  }
  b2 = bs * bs;
  for (int i = 0; i < MAX; ++i)
    if (i ^ EM)
      b2.a[PS][i] = 1;
    else
      b2.a[PS][i] = 0;
  printf("%d\n", ((getans(r) - getans(l - 1) + MOD) % MOD));
}
int getans(int nb) {
  return (static_cast<long long>(geto(nb) + gete(nb)) * R2) % MOD;
}
int geto(int nb) {
  if (nb && (!(nb & 1))) --nb;
  if (!nb) return 0;
  int ret =
      (_geto(nb) + ((_geto((nb + 1) >> 1) + gete((nb + 1) >> 1)) % MOD)) % MOD;
  return ret;
}
int gete(int nb) {
  if (nb & 1) --nb;
  if (!nb) return 0;
  int ret = _gete(nb);
  return ret;
}
int _geto(int nb) {
  if (nb && !(nb & 1)) --nb;
  if (!nb) return 0;
  mT ret = bs * qpow(b2, nb >> 1) * bs;
  return ret.a[PS][EM];
}
int _gete(int nb) {
  if (nb & 1) --nb;
  if (!nb) return 0;
  mT ret = bs * qpow(b2, nb >> 1);
  return ret.a[PS][EM];
}
mT qpow(mT a, int b) {
  mT base = a, ans;
  ans.setunit();
  while (b) {
    if (b & 1) ans *= base;
    base *= base;
    b >>= 1;
  }
  return ans;
}
