#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;
  }
  int search(long long tar, int upper) {
    int res = 0;
    int LOG = 1;
    while (1 << LOG < upper) {
      ++LOG;
    }
    long long sum = 0;
    for (int i = LOG; i >= 0; --i) {
      if (res + (1 << i) - 1 < upper) {
        if (2LL * (sum + data[res + (1 << i) - 1]) <= tar) {
          sum += data[res + (1 << i) - 1];
          res |= 1 << i;
        }
      }
    }
    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);
    lo = cft.search(cft.get(r) + cft.get(l - 1), r);
    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;
}
