#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1000000007;   void print_mat(vector<vector<long long> > mat) {     for (long long y = 0; y < (long long)((long long)((mat).size())); ++y) {       for (long long x = 0; x < (long long)((long long)((mat[y]).size())); ++x)         printf( %lld  , mat[y][x]);       puts(  );     }   }   vector<vector<long long> > I;   vector<vector<long long> > add(vector<vector<long long> > mat1,                                  vector<vector<long long> > mat2) {     int h = (long long)((mat1).size()), w = (long long)((mat1[0]).size());     assert((long long)((mat2).size()) == h && (long long)((mat2[0]).size()) == w);     vector<vector<long long> > ret(h, vector<long long>(w, 0));     for (long long y = 0; y < (long long)(h); ++y)       for (long long x = 0; x < (long long)(w); ++x)         ret[y][x] = mat1[y][x] + mat2[y][x];     return ret;   }   vector<long long> mul(vector<vector<long long> > mat, vector<long long> vec) {     int h = (long long)((mat).size()), w = (long long)((mat[0]).size());     assert((long long)((vec).size()) == w);     vector<long long> ret(h, 0);     for (long long y = 0; y < (long long)(h); ++y)       for (long long x = 0; x < (long long)(w); ++x)         ret[y] = (ret[y] + mat[y][x] * vec[x] % MOD) % MOD;     return ret;   }   vector<vector<long long> > mul(vector<vector<long long> > mat1,                                  vector<vector<long long> > mat2) {     int h = (long long)((mat1).size()), in = (long long)((mat1[0]).size()),         w = (long long)((mat2[0]).size());     assert((long long)((mat2).size()) == in);     vector<vector<long long> > ret(h, vector<long long>(w, 0));     for (long long y = 0; y < (long long)(h); ++y)       for (long long x = 0; x < (long long)(w); ++x)         for (long long i = 0; i < (long long)(in); ++i) {           ret[y][x] = (ret[y][x] + mat1[y][i] * mat2[i][x] % MOD) % MOD;         }     return ret;   }   vector<vector<long long> > pow(vector<vector<long long> > mat,                                  long long power) {     int n = (long long)((mat).size());     vector<vector<long long> > ret(n, vector<long long>(n, 0));     for (long long i = 0; i < (long long)(n); ++i) ret[i][i] = 1;     while (power > 0) {       if (power & 1) ret = mul(ret, mat);       mat = mul(mat, mat);       power >>= 1;     }     return ret;   }   vector<vector<long long> > powadd(vector<vector<long long> > mat,                                     long long power) {     int n = (long long)((mat).size());     vector<vector<long long> > ret(n, vector<long long>(n, 0));     for (long long i = 0; i < (long long)(n); ++i) ret[i][i] = 1;     if (power == 0) return ret;     if (power % 2 == 1) {       ret = powadd(mat, power / 2);       ret = mul(ret, add(I, pow(mat, power / 2 + 1)));     } else {       ret = add(pow(mat, power), powadd(mat, power - 1));     }     return ret;   }   long long solve(long long L) {     if (L == 0) return 0LL;     if (L == 1) return 4;     vector<vector<long long> > mat =         vector<vector<long long> >(5, vector<long long>(5, 0));     for (long long i = 0; i < (long long)(5); ++i)       for (long long j = 0; j < (long long)(5); ++j)         if (abs(i - j) == 1) mat[i][j] = 1;     vector<long long> vec = vector<long long>(5, 0);     vec[0] = vec[4] = 1;     vec[1] = vec[2] = vec[3] = 2;     vector<long long> piyo = mul(powadd(mat, L - 2), vec);     long long res = 4;     for (long long i = 0; i < (long long)(5); ++i) res = (res + piyo[i]) % MOD;     return res;   }   long long solve2(long long L) {     return (solve(L) + solve((L + 1) / 2)) * ((MOD + 1) / 2) % MOD;   }   int main() {     I = vector<vector<long long> >(5, vector<long long>(5, 0));     for (long long i = 0; i < (long long)(5); ++i) I[i][i] = 1;     long long L, R;     while (cin >> L >> R) {       cout << (solve2(R) - solve2(L - 1) + MOD) % MOD << endl;     }   }