#include <bits/stdc++.h>
struct mat {
  long long arr[25][25];
  mat() { memset(arr, 0, sizeof(arr)); }
  inline long long *operator[](const int &x) { return arr[x]; }
  inline const long long *operator[](const int &x) const { return arr[x]; }
  inline mat operator*(const mat &a) const {
    mat res;
    for (int i = 0; i < 25; i++) {
      for (int j = 0; j < 25; j++) {
        for (int k = 0; k < 25; k++)
          (res[i][j] += arr[i][k] * a[k][j]) %= 1000000007;
      }
    }
    return res;
  }
  inline mat operator*=(const mat &a) { return *this = *this * a; }
};
inline mat quick_pow(mat a, int n) {
  mat res;
  for (int i = 0; i < 25; i++) res[i][i] = 1;
  while (n) {
    if (n & 1) res *= a;
    a *= a;
    n >>= 1;
  }
  return res;
}
inline long long sum(int n) {
  if (!n) return 0;
  mat dp;
  for (int i = 0; i < 16; i++) {
    int x = i >> 2, y = i & 3;
    if ((x ^ y) <= 1) continue;
    dp[i][16]++;
    for (int z = 0; z < 4; z++) {
      if ((y ^ z) <= 1 || (!y && (x ^ z) == 1)) continue;
      dp[i][y << 2 | z]++;
    }
  }
  dp[16][16]++;
  mat res = quick_pow(dp, n - 1);
  long long ans = 4;
  for (int i = 0; i < 16; i++) (ans += res[i][16]) %= 1000000007;
  return ans;
}
inline long long calc(int n) {
  return (sum(n) + sum(n + 1 >> 1)) % 1000000007 * (1000000007 + 1) / 2 %
         1000000007;
}
int main() {
  int l, r;
  scanf("%d%d", &l, &r);
  printf("%lld\n", (calc(r) - calc(l - 1) + 1000000007) % 1000000007);
  return 0;
}
