#include <bits/stdc++.h>
using namespace std;
const int mm = 1000000007;
long long qm(long long x, int y) {
  if (y == 0) return 1;
  long long tmp = qm(x, y / 2);
  if (y % 2)
    return (tmp * tmp % mm) * x % mm;
  else
    return tmp * tmp % mm;
}
long long S(int x) {
  if (x == 0) return 0;
  if (x == 1) return 4;
  if (x % 2)
    return (11 * qm(3, x / 2) - 7 + mm) % mm;
  else
    return (19 * qm(3, x / 2 - 1) - 7 + mm) % mm;
}
long long G(int x) { return (S(x) + S((x + 1) >> 1)) * qm(2, mm - 2) % mm; }
int main() {
  int l, r;
  scanf("%d%d", &l, &r);
  long long ans = (G(r) - G(l - 1) + mm) % mm;
  printf("%I64d", ans);
  return 0;
}
