#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
struct node {
  int n, m;
  int a[20][20];
  node operator*(const node &b) {
    node c;
    c.n = n;
    c.m = b.m;
    memset(c.a, 0, sizeof(c.a));
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        for (int k = 0; k < b.m; k++) {
          c.a[i][k] += (long long)a[i][j] * b.a[j][k] % mod;
          c.a[i][k] %= mod;
        }
      }
    }
    return c;
  }
} x, e, yuan;
bool ok(int i, int j, int k) {
  if (i == j || j == k) return false;
  if (i + j == 3 || j + k == 3) return false;
  if (((1 << i) | (1 << j) | (1 << k)) == 7) return false;
  return true;
}
node cal1(int t) {
  if (t == 0) return e;
  if (t == 1) return x;
  node tmp = cal1(t / 2);
  if (t % 2)
    return tmp * tmp * x;
  else
    return tmp * tmp;
}
int cal(int x) {
  if (x == 0) return 0;
  if (x == 1) return 4;
  if (x == 2) return 12;
  node tmp = yuan * cal1(x - 2);
  if (x >= 3) return tmp.a[0][16] % mod;
}
int main() {
  e.n = e.m = 17;
  memset(e.a, 0, sizeof(e.a));
  for (int i = 0; i < 17; i++) {
    e.a[i][i] = 1;
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      if (i == j || (i + j) == 3) yuan.a[0][i * 4 + j] = 0;
      yuan.a[0][i * 4 + j] = 1;
    }
  }
  yuan.n = 1;
  yuan.m = 17;
  yuan.a[0][16] = 12;
  memset(x.a, 0, sizeof(x.a));
  x.n = 17;
  x.m = 17;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 4; k++) {
        if (ok(i, j, k)) {
          x.a[i * 4 + j][j * 4 + k]++;
          x.a[i * 4 + j][16]++;
        }
      }
    }
  }
  x.a[16][16] = 1;
  int l, r;
  scanf("%d%d", &l, &r);
  printf("%d\n",
         (int)(((long long)((long long)(cal(r) + cal((r + 1) / 2)) % mod -
                            (long long)(cal(l - 1) + cal(l / 2)) % mod + mod) %
                mod) *
               500000004 % mod));
  return 0;
}
