#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int inf = 1e9 + 7;
inline void read(int &x) {
  x = 0;
  char ch = getchar();
  while (ch < '0') ch = getchar();
  while (ch >= '0') {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
}
const long long M = 1e9 + 7;
inline long long po(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % M;
    x = x * x % M;
    y >>= 1;
  }
  return res;
}
inline long long g(int x) {
  if (!x)
    return 0;
  else if (x == 1)
    return 4;
  else {
    if (x & 1)
      return (((11ll * po(3, (x - 1) >> 1) - 7ll) % M + M) % M);
    else
      return (((19ll * po(3, (x - 1) >> 1) - 7ll) % M + M) % M);
  }
}
inline long long f(int x) {
  return (((g(x) + g((x + 1) / 2)) * (M + 1) / 2ll)) % M;
}
int main() {
  int l, r;
  read(l);
  read(r);
  long long ans = f(r) - f(l - 1);
  ans = ans % M + M;
  ans %= M;
  printf("%d\n", (int)ans);
  return 0;
}
