#include <bits/stdc++.h>
const long long mod = 1000000007;
using namespace std;
long long l, r;
long long ans;
long long pow(long long s, long long w) {
  long long ans = 1, o = s;
  while (w != 0) {
    if (w % 2) ans = ans * o % mod;
    o = o * o % mod;
    w /= 2;
  }
  return ans;
}
long long get(long long num) {
  if (num == 0) return 0;
  if (num == 1) return 4;
  if (num % 2 == 0)
    return (19LL * pow(3LL, num / 2 - 1) % mod - 7 + mod) % mod;
  else
    return (11LL * pow(3LL, num / 2) % mod - 7 + mod) % mod;
}
int main() {
  scanf("%lld%lld", &l, &r);
  ans = ((get(r) - get(l - 1)) % mod + mod) % mod;
  ans = (ans + get((r + 1) / 2)) % mod;
  ans = (ans + mod - get(l / 2)) % mod;
  ans = ans * pow(2LL, mod - 2) % mod;
  printf("%lld\n", ans);
}
