#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
class FenwickTree {
 public:
  FenwickTree(int _n) : n(_n), data(n, 0) {}
  void add(int x, long long v) {
    for (; x < n; x |= x + 1) {
      data[x] += v;
    }
  }
  long long get(int x) {
    long long res = 0;
    for (; x >= 0; x = (x & (x + 1)) - 1) {
      res += data[x];
    }
    return res;
  }

 private:
  int n;
  vector<long long> data;
};
class Solution {
 public:
  Solution(vector<int>& _pos, vector<int>& _cost, int _n)
      : n(_n), pos(_pos), cost(_cost), cft(n + 10), pcft(n + 10) {
    for (int i = 0; i < n; ++i) {
      pos[i] -= i + 1;
      cft.add(i, cost[i]);
      pcft.add(i, mulM(cost[i], pos[i]));
    }
  }
  void update(int x, long long v) {
    cft.add(x, v - cost[x]);
    pcft.add(x, mulM(v - cost[x], pos[x]));
    cost[x] = v;
  }
  long long query(int l, int r) {
    long long res = 0;
    int lo = l, hi = r;
    long long sum = cft.get(r) - cft.get(l - 1);
    while (lo <= hi) {
      int mi = lo + (hi - lo) / 2;
      long long sum1 = cft.get(mi) - cft.get(l - 1);
      if (sum1 * 2LL < sum) {
        lo = mi + 1;
      } else {
        hi = mi - 1;
      }
    }
    res = subM(mulM(pos[lo], subM(cft.get(lo - 1), cft.get(l - 1))),
               subM(pcft.get(lo - 1), pcft.get(l - 1)));
    res = addM(res, subM(subM(pcft.get(r), pcft.get(lo - 1)),
                         mulM(pos[lo], subM(cft.get(r), cft.get(lo - 1)))));
    return res;
  }

 private:
  int n;
  FenwickTree cft;
  FenwickTree pcft;
  vector<int> pos;
  vector<int> cost;
  long long addM(long long a, long long b) {
    a += b;
    a %= M;
    while (a >= M) {
      a -= M;
    }
    while (a < 0) {
      a += M;
    }
    return a;
  }
  long long subM(long long a, long long b) {
    a -= b;
    a %= M;
    while (a >= M) {
      a -= M;
    }
    while (a < 0) {
      a += M;
    }
    return a;
  }
  long long mulM(long long a, long long b) {
    a *= b;
    a %= M;
    while (a >= M) {
      a -= M;
    }
    while (a < 0) {
      a += M;
    }
    return a;
  }
  long long powM(long long x, long long e) {
    long long res = 1;
    while (e > 0) {
      if (e & 0x1) {
        res = mulM(res, x);
      }
      x = mulM(x, x);
      e >>= 1;
    }
    return res;
  }
};
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  vector<int> pos(n);
  vector<int> cost(n);
  for (int i = 0; i < n; ++i) {
    cin >> pos[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> cost[i];
  }
  Solution sol(pos, cost, n);
  for (int i = 0, x = 0, y = 0; i < q; ++i) {
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      --x;
      sol.update(x, y);
    } else {
      --x;
      --y;
      cout << sol.query(x, y) << endl;
    }
  }
  return 0;
}
