#include <bits/stdc++.h>
using namespace std;
const int MaxN = 200100;
const int Mod = 1e9 + 7;
const int offset = 1 << 18;
int a[MaxN];
int w[MaxN];
long long pw[MaxN];
int N, Q;
long long add(long long A, long long B) {
  A %= Mod;
  B %= Mod;
  return (A + B) % Mod;
}
long long sub(long long A, long long B) {
  B %= Mod;
  return add(A, Mod - B);
}
long long mul(long long A, long long B) {
  A %= Mod;
  B %= Mod;
  return (A * B) % Mod;
}
struct SegTree {
  struct Node {
    long long sumOfWeights;
    long long costToMoveLeft;
    long long costToMoveRight;
    int leftPos;
    int rightPos;
    int pop;
  } T[offset * 2];
  void updateData(int ind) {
    ind += offset;
    T[ind].pop = 1;
    T[ind].leftPos = a[ind - offset];
    T[ind].rightPos = a[ind - offset];
    for (ind /= 2; ind >= 1; ind /= 2) {
      T[ind].pop = T[2 * ind].pop + T[2 * ind + 1].pop;
      T[ind].leftPos = T[2 * ind].leftPos;
      T[ind].rightPos = T[2 * ind].rightPos;
    }
  }
  void updateW(int ind, int val) {
    ind += offset;
    T[ind].sumOfWeights = val;
    for (ind /= 2; ind >= 1; ind /= 2) {
      T[ind] = combine(T[2 * ind], T[2 * ind + 1]);
    }
  }
  long long queryW(int ind, int lo, int hi, int l, int r) {
    if (lo >= r || hi <= l) return 0;
    if (lo >= l && hi <= r) return T[ind].sumOfWeights;
    int mid = (lo + hi) / 2;
    long long left_res = queryW(2 * ind, lo, mid, l, r);
    long long right_res = queryW(2 * ind, mid, hi, l, r);
    return left_res + right_res;
  }
  int distanceLeft(Node& A, Node& B) {
    return B.leftPos - A.leftPos - A.pop + 1;
  }
  int distanceRight(Node& A, Node& B) {
    return B.rightPos - A.rightPos - B.pop + 1;
  }
  Node combine(Node& A, Node& B) {
    Node C;
    C.sumOfWeights = A.sumOfWeights + B.sumOfWeights;
    C.costToMoveLeft = add(add(A.costToMoveLeft, B.costToMoveLeft),
                           mul(B.sumOfWeights, (long long)distanceLeft(A, B)));
    C.costToMoveRight =
        add(add(A.costToMoveRight, B.costToMoveRight),
            mul(A.sumOfWeights, (long long)distanceRight(A, B)));
    return C;
  }
  Node query(int ind, int lo, int hi, int l, int r) {
    if (lo >= r || hi <= l) {
      Node C;
      return C;
    }
    if (lo >= l && hi <= r) return T[ind];
    int mid = (lo + hi) / 2;
    Node A = query(2 * ind, lo, mid, l, r);
    Node B = query(2 * ind + 1, mid, hi, l, r);
    return combine(A, B);
  }
  long long queryCost(int l, int r, bool isLeft) {
    Node C = query(1, 0, N, l, r);
    return (isLeft) ? C.costToMoveLeft : C.costToMoveRight;
  }
} Tour;
void preprocessIntervals() {
  for (int(i) = (0); (i) < (N); i++) Tour.updateData(i);
  for (int(i) = (0); (i) < (N); i++) Tour.updateW(i, w[i]);
}
long long queryTask(int l, int r) {
  long long sum = Tour.queryW(1, 0, N, l, r);
  int lo = l, hi = r;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    long long sum_half = Tour.queryW(1, 0, N, l, mid);
    if (sum > sum_half * 2) {
      lo = mid + 1;
    } else {
      hi = mid;
    }
  }
  return add(Tour.queryCost(l, lo, 0), Tour.queryCost(lo + 1, r, 1));
}
void preprocess() { preprocessIntervals(); }
void load() {
  cin >> N >> Q;
  for (int(i) = (0); (i) < (N); i++) cin >> a[i];
  for (int(i) = (0); (i) < (N); i++) cin >> w[i];
  preprocess();
  for (int(i) = (0); (i) < (Q); i++) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      Tour.updateW(-x, y);
    } else {
      cout << queryTask(x, y + 1) << endl;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  load();
  return 0;
}
