#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, const U &b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, const U &b) {
  if (a < b) a = b;
}
long long sum[200010];
long long w[200010];
long long a[200010];
long long s[200010];
long long SS[200010];
int update_1(int u, long long val) {
  for (; u < 200010; u += u & -u) SS[u] = (SS[u] + val) % 1000000007;
}
long long calc_1(int u) {
  long long ans = 0;
  for (; u; u -= u & -u) ans = (ans + SS[u]) % 1000000007;
  return ans;
}
long long calc_1(int L, int R) {
  long long ans = calc_1(R) - calc_1(L - 1);
  ans = (ans % 1000000007 + 1000000007) % 1000000007;
  return ans;
}
int update(int u, long long val) {
  for (; u < 200010; u += u & -u) sum[u] += val;
}
long long calc(int u) {
  long long ans = 0;
  for (; u; u -= u & -u) ans += sum[u];
  return ans;
}
long long calc(int L, int R) {
  long long ans = calc(R) - calc(L - 1);
  return ans;
}
long long S3[200010];
int update_3(int u, long long val) {
  val = (val % 1000000007 + 1000000007) % 1000000007;
  for (; u < 200010; u += u & -u) S3[u] = (S3[u] + val) % 1000000007;
}
int calc_3(int u) {
  long long ans = 0;
  for (; u; u -= u & -u) ans = (ans + S3[u]) % 1000000007;
  return ans % 1000000007;
}
int calc_3(int L, int R) {
  long long ans = calc_3(R) - calc_3(L - 1);
  ans = (ans % 1000000007 + 1000000007) % 1000000007;
  return ans;
}
int solve(int L, int R) {
  if (L == R) return 0;
  long long sum = calc(L, R);
  int st = L - 1;
  int ed = R + 1;
  while (st + 1 < ed) {
    int md = (st + ed) / 2;
    if (calc(L, md) * 2 >= sum)
      ed = md;
    else
      st = md;
  }
  st++;
  long long ans = calc_1(st + 1, R) - calc_1(L, st);
  ans += calc_3(L, st) - calc_3(st + 1, R);
  ans += (long long)calc(L, st) * (a[st] - st) % 1000000007 -
         (long long)calc(st + 1, R) * (a[st] - st) % 1000000007;
  ans = (ans % 1000000007 + 1000000007) % 1000000007;
  return ans;
}
int main() {
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) scanf("%I64d", a + i), s[i] = s[i - 1] + a[i];
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", w + i), update(i, w[i]);
    update_1(i, (long long)w[i] * a[i] % 1000000007);
    update_3(i, w[i] * i % 1000000007);
  }
  while (q--) {
    int first, second;
    scanf("%d %d", &first, &second);
    if (first < 0) {
      first = -first;
      long long val = second - w[first];
      update(first, val);
      update_3(first, (long long)first * val % 1000000007);
      val = val * a[first] % 1000000007;
      val = (val % 1000000007 + 1000000007) % 1000000007;
      update_1(first, val);
      continue;
    }
    printf("%d\n", solve(first, second));
  }
}
