#include <bits/stdc++.h>
const int mo = (int)1e9 + 7;
long long L, R, t, Inv[3];
inline long long pw(long long a, long long x) {
  for (t = 1; x; x >>= 1, a = a * a % mo)
    if (x & 1) t = t * a % mo;
  return t;
}
inline long long Geo(long long q, long long a1, long long n) {
  if (!n) return 0;
  return a1 * (pw(q, n) - 1) % mo * Inv[q - 1] % mo;
}
long long Sum(long long n) {
  if (n == 0) return 0;
  long long a = Geo(3, 2, n + 1 >> 1) + Geo(3, 8, n - 1 >> 1) + 2;
  long long m = n + 1 >> 1;
  a += Geo(3, 2, m + 1 >> 1) + Geo(3, 4, m >> 1);
  a += Geo(3, 4, m >> 1) + Geo(3, 8, m - 1 >> 1) + 2;
  a = a * Inv[2] % mo;
  a += Geo(3, 4, n >> 1);
  return a %= mo;
}
int main() {
  scanf("%I64d%I64d", &L, &R);
  Inv[1] = 1;
  Inv[2] = pw(2, mo - 2);
  printf("%I64d\n", (Sum(R) - Sum(L - 1) + mo * 2) % mo);
  return 0;
}
