#include<bits/stdc++.h>
#define mode 1000000007
using namespace std;
typedef long long ll;
ll a,b;
struct mm{
ll a[4][4];
}ori,res;
mm init(){
mm E;
for(int i=0;i<4;i++){
for(int j=0;j<4;j++){
if(i==j) E.a[i][j]=1;
else E.a[i][j]=0;
}
}
return E;
}
mm operator *(mm x,mm y){
mm c;
memset(c.a,0,sizeof(mm));
for(int i=0;i<4;i++){
for(int j=0;j<4;j++){
for(int k=0;k<4;k++)
c.a[i][j]=c.a[i][j]%mode+x.a[i][k]*y.a[k][j]%mode;
}
}
return c;
}
mm fast(mm x,ll k){
mm c;
c=init();
while(k){
if(k%2) c=c*x;
x=x*x;
k/=2;
}
return c;
}
int sum(int x){
ori.a[0][0]=1,ori.a[0][1]=1,ori.a[0][2]=1,ori.a[0][3]=1;
ori.a[1][0]=0,ori.a[1][1]=1,ori.a[1][2]=1,ori.a[1][3]=1;
ori.a[2][0]=0,ori.a[2][1]=1,ori.a[2][2]=0,ori.a[2][3]=0;
ori.a[3][0]=0,ori.a[3][1]=0,ori.a[3][2]=1,ori.a[3][3]=0;
if(x<0) return 0;
else if(x==0) return 1;
else if(x==1) return 2;
else if(x==2) return 3;
mm c;
c=fast(ori,x-2);
return (3*c.a[0][0]+c.a[0][1]+c.a[0][2]+c.a[0][3])%mode;
}
int main()
{
while(scanf("%lld%lld",&a,&b)!=EOF){
printf("%d\n",(sum(b)-sum(a-1)+mode)%mode);
}
return 0;
}
08-09