#include <bits/stdc++.h>
long long p = 1000000007, l, r;
long long pw(long long x, long long y) {
  long long _ = 1;
  for (; y; y >>= 1, x = x * x % p) y& 1 ? _ = _ * x % p : 0;
  return _;
}
long long S(long long x) {
  if (!x)
    return 0;
  else if (x == 1)
    return 4;
  else if (x & 1)
    return (11 * pw(3, x / 2) - 7) % p;
  else
    return (19 * pw(3, x / 2 - 1) - 7) % p;
}
long long G(long long x) { return (S(x) + S(x + 1 >> 1)) * pw(2, p - 2) % p; }
int main() {
  scanf("%I64d %I64d", &l, &r);
  printf("%I64d\n", (G(r) - G(l - 1) + p) % p);
  return 0;
}
