#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T abs(T x) {
  return x < 0 ? -x : x;
}
const int P = 1000 * 1000 * 1000 + 7;
vector<int> bad[5];
struct Matrix {
  long long data[16][16];
};
int sum(int a, int b) { return (a + b) % P; }
int mult(long long a, long long b) { return (a * b) % P; }
int pow(int a, int n) {
  if (n == 0) return 1;
  int res = pow(a, n / 2);
  res = mult(res, res);
  if (n % 2 == 1) res = mult(res, a);
  return res;
}
int inv(int a) { return pow(a, P - 2); }
Matrix operator+(Matrix a, Matrix b) {
  Matrix c;
  for (int i = 0; i < 16; ++i) {
    for (int j = 0; j < 16; ++j) {
      c.data[i][j] = sum(a.data[i][j], b.data[i][j]);
    }
  }
  return c;
}
Matrix operator-(Matrix a, Matrix b) {
  Matrix c;
  for (int i = 0; i < 16; ++i) {
    for (int j = 0; j < 16; ++j) {
      c.data[i][j] = sum(a.data[i][j], P - b.data[i][j]);
    }
  }
  return c;
}
Matrix operator*(Matrix a, Matrix b) {
  Matrix c;
  for (int i = 0; i < 16; ++i) {
    for (int j = 0; j < 16; ++j) {
      c.data[i][j] = 0;
      for (int k = 0; k < 16; ++k) {
        c.data[i][j] = sum(c.data[i][j], mult(a.data[i][k], b.data[k][j]));
      }
    }
  }
  return c;
}
Matrix e, a;
Matrix pow(Matrix a, long long n) {
  if (n == 0) {
    return e;
  }
  Matrix res = pow(a, n / 2);
  res = res * res;
  if (n % 2 == 1) res = res * a;
  return res;
}
Matrix sum_pow(Matrix a, long long n) {
  Matrix res;
  if (n <= 0) {
    for (int i = 0; i < 16; ++i) {
      for (int j = 0; j < 16; ++j) {
        res.data[i][j] = 0;
      }
    }
    return res;
  }
  res = sum_pow(a, n / 2);
  res = res * pow(a, n / 2) + res;
  if (n % 2 == 1) {
    res = res * a + e;
  }
  return res;
}
int sum_ans_0(int l, int r) {
  int res = 0;
  if (l == 1 && r >= 1) {
    res += 4;
    l++;
  }
  if (l == 2 && r >= 2) {
    res += 8;
    l++;
  }
  if (l > r) {
    return res;
  }
  l -= 2;
  r -= 2;
  Matrix tmp = pow(a, l) * sum_pow(a, r - l + 1);
  for (int i = 0; i < 16; ++i) {
    for (int j = 0; j < 16; ++j) {
      res = sum(res, tmp.data[i][j]);
    }
  }
  return res;
}
int sum_ans(int l, int r) {
  int res = sum_ans_0(l, r);
  int ll = (l % 2 == 1 ? l : l + 1);
  int rr = (r % 2 == 1 ? r : r - 1);
  if (ll <= rr) {
    res = sum(res, sum_ans_0((ll + 1) / 2, (rr + 1) / 2));
  }
  res = mult(res, inv(2));
  return res;
}
int main() {
  bad[2].push_back(0);
  bad[2].push_back(5);
  bad[2].push_back(10);
  bad[2].push_back(15);
  bad[2].push_back(3);
  bad[2].push_back(12);
  bad[2].push_back(6);
  bad[2].push_back(9);
  bad[3].push_back(18);
  bad[3].push_back(33);
  for (int i = 0; i < 16; ++i) {
    for (int j = 0; j < 16; ++j) {
      e.data[i][j] = (i == j ? 1 : 0);
    }
  }
  for (int i = 0; i < 16; ++i) {
    for (int j = 0; j < 16; ++j) {
      a.data[i][j] = 0;
      if (i % 4 == j / 4) {
        int tmp = (i * 4) + (j % 4);
        bool key = true;
        for (int k = 0; k < ((int)(bad[2]).size()); ++k) {
          if (tmp / 4 == bad[2][k] || tmp % 16 == bad[2][k]) {
            key = false;
            break;
          }
        }
        if (key) {
          for (int k = 0; k < ((int)(bad[3]).size()); ++k) {
            if (tmp == bad[3][k]) {
              key = false;
              break;
            }
          }
        }
        if (key) {
          a.data[i][j] = 1;
        }
      }
    }
  }
  int l, r;
  cin >> l >> r;
  cout << sum_ans(l, r) << endl;
  return 0;
}
