#include <bits/stdc++.h>
using namespace std;
long long p, l, r;
inline long long power(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % p;
    a = a * a % p;
    b >>= 1;
  }
  return ret;
}
inline long long f(long long n) {
  if (n == 1)
    return 4;
  else if (n == 0)
    return 0;
  else if (n & 1)
    return (11 * power(3, n / 2) - 7) % p;
  else
    return (19 * power(3, n / 2 - 1) - 7) % p;
}
inline long long g(long long x) {
  return ((f(x) + f((x + 1) / 2)) * (p + 1) / 2) % p;
}
int main() {
  p = 1000000007;
  scanf("%I64d%I64d", &l, &r);
  long long ans = 0;
  printf("%I64d\n", (g(r) - g(l - 1) + p) % p);
  return 0;
}
