//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
//~ #pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(),x.end()
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define erase_duplicates(x) sort(all(x)); (x).resize(distance((x).begin(), unique(all(x))));


using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<
T,
null_type,
less<T>,
rb_tree_tag,
tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<LL> VLL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long double LD;
typedef pair<LD,LD> PLD;
typedef vector<LD> VLD;
typedef vector<PLD> VPLD;

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<" = "<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<" = "<<h<<", "; _dbg(sdbg+1, a...);
}

#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#define cerr if(0)cout
#endif

const int maxn = (1e6)+7;
const int maxk = 20;
const int inf = (1e9)+7;
const LL LLinf = ((LL)1e18)+7LL;
const LD eps = 1e-9;
const LL mod = 1e9+7;

// ***************************** CODE ***************************** //

struct node
{
  LL suma;
  LL ilo;
  LL ile;
  LL lewo, prawo;
  node(LL pos = 0LL, LL wag = 0LL)
  {
    if(pos == 0)
      ile = 0;
    else
      ile = 1;
    lewo = wag;
    prawo = wag;
    suma = wag;
    ilo = pos * wag % mod;
  }

};

void wypisz(node a)
{
  dbg(a.suma, a.ilo, a.ile, a.lewo, a.prawo);
}

const int pot = 1<<20;

node drze[2 * pot + 7];

LL pos[maxn];

node merge(node a, node b)
{
  node res;
  res.suma = (a.suma + b.suma);
  res.ilo = (a.ilo + b.ilo) % mod;
  res.ile = a.ile + b.ile;
  res.lewo = (b.lewo + a.lewo + (a.suma % mod) * b.ile) % mod;
  res.prawo = (a.prawo + b.prawo + (b.suma % mod) * a.ile) % mod;
  return res;
}

LL sum(int l, int p)
{
  LL res = 0LL;
  l += pot;
  p += pot;
  while(l <= p)
  {
    if(l & 1)
      res += drze[l].suma;
    if(!(p & 1))
      res += drze[p].suma;
    l = (l + 1) / 2;
    p = (p - 1) / 2;
  }
  return res;
}

node daj(int l, int p)
{
  if(l > p)
    return node();
  l += pot;
  p += pot;
  vector<node> L, P;
  while(l <= p)
  {
    if(l & 1)
      L.pb(drze[l]);
    if(!(p & 1))
      P.pb(drze[p]);
    l = (l + 1) / 2;
    p = (p - 1) / 2;
  }
  while(SZ(P) > 1)
  {
    P[SZ(P) - 2] = merge(P.back(), P[SZ(P) - 2]);
    P.pop_back();
  }
  if(SZ(P))
    L.pb(P[0]);
  while(SZ(L) > 1)
  {
    L[SZ(L) - 2] = merge(L[SZ(L) - 2], L.back());
    L.pop_back();
  }
  return L[0];
}

void update(int x)
{
  while(x)
  {
    drze[x] = merge(drze[2 * x], drze[2 * x + 1]);
    x /= 2;
  }
}

int main()
{
	_upgrade
  int n, q;
  cin>>n>>q;
  for(int i = 1;i <= n;i++)
    cin>>pos[i];
  for(int j = 1;j <= n;j++)
  {
    int w;
    cin>>w;
    drze[j + pot] = node(pos[j], w);
  }
  for(int i = pot - 1;i > 0;i--)
    drze[i] = merge(drze[i * 2], drze[i * 2 + 1]);
  while(q--)
  {
    dbg("elo");
    int x, y;
    cin>>x>>y;
    if(x < 0)
    {
      x *= -1;
      // dbg(x, y);
      drze[x + pot] = node(pos[x], y);
      update((pot + x) / 2);
    }
    else
    {
      int l = x;
      int p = y + 1;
      LL xdd = daj(x, y).suma;
      while(l + 1 < p)
      {
        int sr = (l + p) / 2;
        if(sum(x, sr - 1) * 2LL <= xdd)
          l = sr;
        else
          p = sr;
      }
      int sr = l;
      l = x;
      p = y;
      // dbg(daj(x, y).suma, daj(1, 2).suma);
      // dbg(l, sr, p);
      LL res = pos[sr] * daj(x, sr - 1).suma % mod - daj(x, sr - 1).ilo - daj(x, sr - 1).lewo;
      res %= mod;
      res += mod;
      res %= mod;
      // dbg(res);
      // wypisz(daj(l, sr - 1));
      // wypisz(daj(sr + 1, p));
      res += daj(sr + 1, p).ilo - pos[sr] * daj(sr + 1, p).suma - daj(sr + 1, p).prawo;
      res %= mod;
      res += mod;
      res %= mod;
      // dbg(res);
      cout<<res<<"\n";
    }
  }
  // wypisz(drze[pot + 7]);
  // wypisz(drze[(pot + 8) / 2]);
  // wypisz(drze[(pot + 10)]);
	return 0;
}
