#include <bits/stdc++.h>
using namespace std;
int w[200010];
int a[200010];
long long B[200010], C[200010], D[200010];
void update(int u, int x) {
  while (u < 200010) {
    B[u] += x;
    u += (-u) & u;
  }
}
long long calc(int u) {
  long long ss = 0;
  while (u > 0) {
    ss += B[u];
    u -= (-u) & u;
  }
  return ss;
}
void iupdate(int u, long long x) {
  while (u < 200010) {
    C[u] += x;
    u += (-u) & u;
  }
}
long long icalc(int u) {
  long long ss = 0;
  while (u > 0) {
    ss += C[u];
    u -= (-u) & u;
  }
  return ss;
}
void wupdate(int u, long long x) {
  while (u < 200010) {
    D[u] += x;
    u += (-u) & u;
  }
}
long long wcalc(int u) {
  long long ss = 0;
  while (u > 0) {
    ss += D[u];
    u -= (-u) & u;
  }
  return ss;
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
    update(i, w[i]);
    iupdate(i, (long long)i * w[i]);
    wupdate(i, (long long)a[i] * w[i]);
  }
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0) {
      x = -x;
      update(x, -w[x]);
      update(x, y);
      iupdate(x, (long long)x * (-w[x]));
      iupdate(x, (long long)x * y);
      wupdate(x, (long long)a[x] * (-w[x]));
      wupdate(x, (long long)a[x] * y);
      w[x] = y;
    } else {
      long long sum = calc(y) - calc(x - 1);
      int st = x - 1, ed = y;
      while (st + 1 < ed) {
        int mid = (st + ed) >> 1;
        if (2 * (calc(mid) - calc(x - 1)) > sum)
          ed = mid;
        else
          st = mid;
      }
      long long ans = 0;
      ans += (calc(ed - 1) - calc(x - 1)) * (a[ed] - ed) % 1000000007;
      ans += (calc(y) - calc(ed)) * (ed - a[ed]) % 1000000007;
      ans += (icalc(ed - 1) - icalc(x - 1)) % 1000000007;
      ans -= (icalc(y) - icalc(ed)) % 1000000007;
      ans -= (wcalc(ed - 1) - wcalc(x - 1)) % 1000000007;
      ans += (wcalc(y) - wcalc(ed)) % 1000000007;
      ans %= 1000000007;
      if (ans < 0) ans += 1000000007;
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
