#include <bits/stdc++.h>
using namespace std;
long long tmp[6][6];
long long base[6][6];
long long matrix[6][6];
void calc(int v) {
  if (v == 0) {
    memset(matrix, 0, sizeof(matrix));
    for (int i = 0; i < 6; i++) matrix[i][i] = 1;
    return;
  }
  calc(v / 2);
  for (int i = 0; i < 6; i++)
    for (int j = 0; j < 6; j++) {
      tmp[i][j] = 0;
      for (int k = 0; k < 6; k++) tmp[i][j] += matrix[i][k] * matrix[k][j];
      tmp[i][j] %= 1000000007;
    }
  if (v & 1)
    for (int i = 0; i < 6; i++)
      for (int j = 0; j < 6; j++) {
        matrix[i][j] = 0;
        for (int k = 0; k < 6; k++) matrix[i][j] += tmp[i][k] * base[k][j];
        matrix[i][j] %= 1000000007;
      }
  else
    for (int i = 0; i < 6; i++)
      for (int j = 0; j < 6; j++) matrix[i][j] = tmp[i][j];
}
long long power(int v) {
  if (v == 0) return 1;
  long long ret = power(v / 2);
  ret = (ret * ret) % 1000000007;
  if (v & 1) ret = (ret * 2) % 1000000007;
  return ret;
}
long long work(int v) {
  long long inv = power(1000000007 - 2);
  if (v == 0) return 0;
  calc(v);
  long long total = 0;
  for (int j = 0; j < 5; j++) total += matrix[j][5];
  total += 1000000007 - matrix[5][5];
  total %= 1000000007;
  calc((v + 1) / 2);
  long long palindrome = 0;
  for (int j = 0; j < 5; j++) palindrome += matrix[j][5];
  palindrome += 1000000007 - matrix[5][5];
  palindrome %= 1000000007;
  total = (total - palindrome + 1000000007) % 1000000007;
  total = (total * inv) % 1000000007;
  total = (total + palindrome) % 1000000007;
  return total;
}
int main() {
  memset(base, 0, sizeof(base));
  base[0][3] = 1;
  base[0][2] = 1;
  base[1][4] = 1;
  base[1][2] = 1;
  base[2][0] = 1;
  base[2][1] = 1;
  base[3][0] = 1;
  base[4][1] = 1;
  base[0][5] = 1;
  base[1][5] = 1;
  base[2][5] = 1;
  base[3][5] = 1;
  base[4][5] = 1;
  base[5][5] = 1;
  int L, R;
  cin >> L >> R;
  long long res = work(R) - work(L - 1);
  res = (res + 1000000007) % 1000000007;
  cout << res << endl;
  return 0;
}
