#include <bits/stdc++.h>
using namespace std;
const int mo = 1000000007;
long long mul(long long a, long long b) {
  long long c = 1;
  for (; b; b >>= 1, a = a * a % mo)
    if (b & 1) c = c * a % mo;
  return c;
}
long long solve(int x) {
  if (x == 0) return 0;
  if (x == 1) return 4;
  if (x % 2 == 0)
    return (19 * mul(3, x / 2 - 1) - 7) % mo;
  else
    return (33 * mul(3, x / 2 - 1) - 7) % mo;
}
long long figure(long long x) {
  return (solve(x) + solve((x + 1) / 2)) % mo * mul(2, mo - 2) % mo;
}
int main() {
  int l, r;
  scanf("%d%d", &l, &r);
  printf("%I64d", (figure(r) - figure(l - 1) + mo) % mo);
  return 0;
}
