include

include

include

include

include

include

include

include

include

include

include

include

include

using namespace std;

define sfi(i) scanf("%d",&i)

define sfl(i) scanf("%lld",&i)

define pri(i) printf("%d\n",i)

define sff(i) scanf("%lf",&i)

define ll long long

define mem(x,y) memset(x,y,sizeof(x))

define INF 0x3f3f3f3f

define eps 1e-6

define PI acos(-1)

define lowbit(x) ((x)&(-x))

define fl() printf("flag\n")

ll gcd(ll a,ll b){while(b^=a^=b^=a%=b);return a;}
const ll mod=1e9+7;
const int maxn=2e5+9;

ll AB[maxn],B[maxn],a[maxn],b[maxn];
int main()
{
ios::sync_with_stdio(false);
int n,m;
cin>>n>>m;
for(int i=2;i<=n;i++)
{
cin>>a[i];
a[i]=a[i-1]+a[i];
a[i]%=mod;
}
for(int i=1;i<=n;i++)
{
cin>>b[i];
B[i]=B[i-1]+b[i];
B[i]%=mod;
}
for(int i=1;i<=n;i++)
{
AB[i]=AB[i-1]+a[i]%modb[i]%mod;
AB[i]%=mod;
}
while(m--)
{
ll ans=0;
ll x,l,r;
cin>>x>>l>>r;
if(x<=l)
{
ans=( (AB[r]-AB[l-1]+mod)%mod - (a[x]
(B[r]-B[l-1]+mod)%mod )%mod );
}
else if(x>=r)
{
ans=( (a[x]* (B[r]-B[l-1]+mod)%mod)%mod - (AB[r]-AB[l-1]+mod)%mod );
}
else
{
ll t =( (AB[r]-AB[x-1]+mod)%mod - (a[x]* (B[r]-B[x-1]+mod)%mod )%mod );
ll tt =( (a[x]* (B[x]-B[l-1]+mod)%mod)%mod - (AB[x]-AB[l-1]+mod)%mod );
ans=t+tt;
ans%=mod;
}

    cout<<(ans+mod)%mod<<endl;
}
return 0;

}