#include <bits/stdc++.h>
const int mod = 1000000007;
int A[13][13], B[13][13], C[13][13];
int ID[4][4];
int L, R, r1, r2;
void mul(int A[][13], int B[][13]) {
  for (int i = 0; i < 13; i++)
    for (int j = 0; j < 13; j++) C[i][j] = 0;
  for (int k = 0; k < 13; k++)
    for (int i = 0; i < 13; i++)
      for (int j = 0; j < 13; j++)
        C[i][j] = (C[i][j] + (long long)A[i][k] * B[k][j] % mod) % mod;
  for (int i = 0; i < 13; i++)
    for (int j = 0; j < 13; j++) A[i][j] = C[i][j];
}
int calc1(int R) {
  if (R < 1) return 0;
  for (int i = 0; i < 13; i++)
    for (int j = 0; j < 13; j++) A[i][j] = 0, B[i][j] = (i == j);
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++)
      if (i != j) {
        if (i / 2 == j / 2) continue;
        A[ID[i][j]][12]++;
        for (int k = 0; k < 4; k++)
          if (j != k) {
            if (j / 2 == k / 2) continue;
            if (i == 0 && j == 2 && k == 1) continue;
            if (i == 1 && j == 2 && k == 0) continue;
            A[ID[i][j]][ID[j][k]]++;
          }
      }
  A[12][12] = 1;
  for (int i = R - 1; i > 0; i /= 2) {
    if (i & 1) mul(B, A);
    mul(A, A);
  }
  int res = 4;
  for (int i = 0; i < 12; i++) res = (res + B[i][12]) % mod;
  return res;
}
int calc2(int R) {
  if (R < 1) return 0;
  for (int i = 0; i < 13; i++)
    for (int j = 0; j < 13; j++) A[i][j] = 0, B[i][j] = (i == j);
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++)
      if (i != j) {
        if (i / 2 == j / 2) continue;
        for (int k = 0; k < 4; k++)
          if (j != k) {
            if (j / 2 == k / 2) continue;
            if (i == 0 && j == 2 && k == 1) continue;
            if (i == 1 && j == 2 && k == 0) continue;
            A[ID[i][j]][ID[j][k]]++;
          }
        A[ID[i][j]][12]++;
      }
  A[12][12] = 1;
  for (int i = (R - 1) / 2; i; i /= 2) {
    if (i & 1) mul(B, A);
    mul(A, A);
  }
  int res = 4;
  for (int i = 0; i < 12; i++) res = (res + B[i][12]) % mod;
  return res;
}
int main() {
  scanf("%d%d", &L, &R);
  for (int i = 0, k = 0; i < 4; i++)
    for (int j = 0; j < 4; j++)
      if (i != j) ID[i][j] = k++;
  r1 = calc1(R) - calc1(L - 1);
  if (r1 < 0) r1 += mod;
  r2 = calc2(R) - calc2(L - 1);
  if (r2 < 0) r2 += mod;
  printf("%d\n", (long long)(r1 + r2) * 500000004 % mod);
}
