#include <bits/stdc++.h>
typedef long long mat[9][9];
const mat gen = {{},
                 {1},
                 {1, 0, 0, 0, 1},
                 {1, 0, 0, 0, 1, 0, 0, 0, 1},
                 {1, 0, 1, 1, 0, 1, 1},
                 {0, 1, 0, 0, 0, 0, 0, 1},
                 {0, 1},
                 {0, 0, 1, 0, 0, 1},
                 {0, 0, 0, 1, 0, 0, 1}};
const long long MOD = 1000000007;
void makei(mat &a) {
  memset(a, 0, sizeof(a));
  for (int i = 0; i < 9; i++) a[i][i] = 1;
}
void mul(const mat &a, const mat &b, mat &c) {
  mat ret;
  memset(ret, 0, sizeof(mat));
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++)
      for (int k = 0; k < 9; k++)
        ret[i][j] = (ret[i][j] + a[i][k] * b[k][j]) % MOD;
  memcpy(c, ret, sizeof(mat));
}
void pow(const mat &a, long long p, mat &b) {
  mat ret, t;
  makei(ret);
  memcpy(t, a, sizeof(mat));
  for (; p; p >>= (long long)1, mul(t, t, t))
    if (p & (long long)1) mul(t, ret, ret);
  memcpy(b, ret, sizeof(mat));
}
void inc(const mat &a, const mat &b, mat &c) {
  mat ret;
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) ret[i][j] = (a[i][j] + b[i][j]) % MOD;
  memcpy(c, ret, sizeof(mat));
}
void sum(const mat &a, long long p, mat &b) {
  mat aa;
  if (p == 1) {
    makei(b);
    return;
  }
  mat t1, t2;
  mul(a, a, aa);
  sum(aa, p / 2, t1);
  mul(a, t1, t2);
  inc(t1, t2, t1);
  if (p & (long long)1) pow(a, p - 1, t2), inc(t1, t2, t1);
  memcpy(b, t1, sizeof(mat));
}
long long calc(const mat &a) {
  long long ret = 0;
  for (int i = 0; i < 9; i++) ret = (ret + a[i][0]) % MOD;
  return ret;
}
long long L, R;
const long long inv2 = 500000004;
long long calc(long long x) {
  mat t;
  long long ret = 0;
  return x & (long long)1
             ? (pow(gen, x, t), ret += calc(t), pow(gen, x / 2 + 1, t),
                ret += calc(t), ret * inv2 % MOD)
             : (pow(gen, x, t), calc(t) * inv2 % MOD);
}
int main() {
  scanf("%I64d%I64d", &L, &R);
  long long ret = 0;
  if (L == R)
    ret = calc(L);
  else if (R - L == 1)
    ret = (calc(L) + calc(R)) % MOD;
  else {
    if (L & (long long)1) ret += calc(L), L++;
    if (!(R & (long long)1)) ret = (ret + calc(R)) % MOD, R--;
    mat t, a, b;
    mul(gen, gen, a);
    pow(gen, L, t);
    long long len = R - L + 1;
    sum(a, len / 2, b);
    mul(t, b, b);
    ret = (ret + calc(b) * inv2) % MOD;
    mul(gen, b, b);
    long long x = calc(b);
    pow(gen, L / 2 + 1, t);
    sum(gen, len / 2, b);
    mul(t, b, b);
    ret = (ret + (x + calc(b)) * inv2) % MOD;
  }
  printf("%I64d\n", ret);
  return 0;
}
