#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int WYMIAR = 17;
int mod = MOD;
struct M {
  int t[WYMIAR][WYMIAR];
  M() {
    for (int i = 0; i < (WYMIAR); ++i)
      for (int j = 0; j < (WYMIAR); ++j) t[i][j] = 0;
    for (int i = 0; i < (WYMIAR); ++i) t[i][i] = 1;
  }
};
M operator*(const M &a, const M &b) {
  M res;
  for (int i = 0; i < (WYMIAR); ++i)
    for (int j = 0; j < (WYMIAR); ++j) {
      long long acc = 0;
      for (int k = 0; k < (WYMIAR); ++k)
        acc += (long long)a.t[i][k] * b.t[k][j] % mod;
      res.t[i][j] = acc % mod;
    }
  return res;
}
M potega(M x, long long n) {
  M res, acc = x;
  for (int i = 0; i < (WYMIAR); ++i) res.t[i][i] = 1;
  while (n) {
    if (n & 1) res = res * acc;
    acc = acc * acc;
    n /= 2;
  }
  return res;
}
pair<int, int> rozloz(int x) { return make_pair(x / 4, x % 4); }
int zabron(int a, int b) {
  if (a > b) return zabron(b, a);
  if (a == b) return 1;
  if (a == 0 && b == 3) return 1;
  if (a == 1 && b == 2) return 1;
  return 0;
}
int dobra_para(int aa, int bb) {
  pair<int, int> a = rozloz(aa);
  pair<int, int> b = rozloz(bb);
  if (a.second != b.first) return 0;
  if (zabron(b.first, b.second)) return 0;
  if (a.first == 1 && b.first == 0 && b.second == 2) return 0;
  if (a.first == 2 && b.first == 0 && b.second == 1) return 0;
  return 1;
}
int licz(int n) {
  if (n == 0) return 0;
  if (n == 1) return 4;
  M m;
  for (int i = 0; i < (16); ++i)
    for (int j = 0; j < (16); ++j) m.t[i][j] = dobra_para(i, j);
  for (int i = 0; i < (17); ++i) m.t[i][16] = 1;
  int stan[17];
  stan[16] = 4;
  for (int i = 0; i < (16); ++i) {
    pair<int, int> p = rozloz(i);
    stan[i] = !zabron(p.first, p.second);
  }
  M tmp = potega(m, n - 1);
  int acc = 0;
  for (int i = 0; i < (17); ++i)
    acc = (acc + (long long)stan[i] * tmp.t[i][16]) % MOD;
  return acc % MOD;
}
int licz2(int n) {
  if (n == 0) return 0;
  if (n == 1) return 4;
  int res = licz(n);
  int palindromy = licz((n + 1) / 2);
  int niepal = ((MOD + res - palindromy) % MOD) * (long long)500000004 % MOD;
  return (palindromy + niepal) % MOD;
}
int main() {
  int l, r;
  scanf("%d %d", &l, &r);
  printf("%d\n", (licz2(r) + MOD - licz2(l - 1)) % MOD);
  return 0;
}
