#include <bits/stdc++.h>
using namespace std;
namespace IO {
const int BUFFER_SIZE = 4096;
const int NUMBER_BUFFER = 100;
FILE *input_stream = stdin;
FILE *output_stream = stdout;
char input_buffer[BUFFER_SIZE];
int input_pos = BUFFER_SIZE;
int input_read = BUFFER_SIZE;
char output_buffer[BUFFER_SIZE];
int output_pos = 0;
char number_buffer[NUMBER_BUFFER];
void init(const char *input_file, const char *output_file) {
  input_stream = fopen(input_file, "r");
  output_stream = fopen(output_file, "w");
}
void _update_input_buffer() {
  if (input_pos >= input_read && input_read == BUFFER_SIZE) {
    input_read = fread(input_buffer, sizeof(char), BUFFER_SIZE, input_stream);
    input_pos = 0;
  }
}
char next_char(bool advance = true) {
  _update_input_buffer();
  return input_buffer[advance ? input_pos++ : input_pos];
}
bool on_whitespace() { return isspace(next_char(false)); }
bool on_digit() { return isdigit(next_char(false)); }
void skip_whitespace() {
  while (on_whitespace()) next_char();
}
bool input_finished() {
  skip_whitespace();
  return input_pos >= input_read && input_read < BUFFER_SIZE;
}
template <typename T>
void read_int(T &number) {
  skip_whitespace();
  bool negative = next_char(false) == '-';
  if (negative) next_char();
  number = 0;
  while (on_digit()) number = 10 * number + (next_char() - '0');
  if (negative) number = -number;
}
void flush_output() {
  fwrite(output_buffer, sizeof(char), output_pos, output_stream);
  output_pos = 0;
}
void write_char(char c) {
  if (output_pos == BUFFER_SIZE) flush_output();
  output_buffer[output_pos++] = c;
}
template <typename T>
void write_int(T number, char after = 0) {
  if (number < 0) {
    write_char('-');
    number = -number;
  }
  int length = 0;
  do {
    number_buffer[length++] = number % 10 + '0';
    number /= 10;
  } while (number > 0);
  for (int i = length - 1; i >= 0; i--) write_char(number_buffer[i]);
  if (after) write_char(after);
}
struct Dummy {
  ~Dummy() { flush_output(); }
} dummy;
}  // namespace IO
const int MOD = 1e9 + 7;
template <typename T1, typename T2>
void mod_add(T1 &a, T2 b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
struct tree_node {
  long long w_sum;
  int aw_sum;
  tree_node() : w_sum(0), aw_sum(0) {}
  void join(const tree_node &other) {
    w_sum += other.w_sum;
    mod_add(aw_sum, other.aw_sum);
  }
};
int N, LOG, Q;
vector<int> A, W;
vector<tree_node> tree;
void build_tree() {
  for (int i = 1; i < 1 << LOG; i++) {
    int bit = i & -i;
    int position = i - bit;
    for (int k = bit >> 1; k > 0; k >>= 1) {
      position += k;
      tree[i].join(tree[position]);
    }
    if (i <= N) {
      tree[i].w_sum += W[i - 1];
      tree[i].aw_sum = (tree[i].aw_sum + (long long)W[i - 1] * A[i - 1]) % MOD;
    }
  }
}
void tree_update(int index, long long w_change, int a) {
  int aw_change = (MOD + w_change) * a % MOD;
  for (int i = index + 1; i < 1 << LOG; i += i & -i) {
    tree[i].w_sum += w_change;
    mod_add(tree[i].aw_sum, aw_change);
  }
}
tree_node tree_query(int count) {
  tree_node answer;
  for (int i = count; i > 0; i -= i & -i) answer.join(tree[i]);
  return answer;
}
int solve(int start, int end) {
  tree_node tree_end = tree_query(end);
  tree_node tree_start = tree_query(start);
  long long search = (tree_end.w_sum + tree_start.w_sum + 1) / 2;
  int goal = 0;
  long long w_sum = 0, aw_sum = 0;
  for (int k = LOG - 1; k >= 0; k--)
    if (search > w_sum + tree[goal + (1 << k)].w_sum) {
      goal += 1 << k;
      w_sum += tree[goal].w_sum;
      aw_sum += tree[goal].aw_sum;
    }
  assert(start <= goal && goal < end);
  long long result =
      ((w_sum - tree_start.w_sum) - (tree_end.w_sum - w_sum)) % MOD * A[goal] +
      (tree_end.aw_sum - aw_sum) - (aw_sum - tree_start.aw_sum);
  result %= MOD;
  mod_add(result, MOD);
  return result;
}
int main() {
  IO::read_int(N);
  IO::read_int(Q);
  A.resize(N);
  W.resize(N);
  LOG = 32 - __builtin_clz(N);
  assert(1 << LOG > N);
  tree.resize(1 << LOG);
  for (int i = 0; i < N; i++) {
    IO::read_int(A[i]);
    A[i] -= i;
  }
  for (int i = 0; i < N; i++) IO::read_int(W[i]);
  build_tree();
  for (int q = 0; q < Q; q++) {
    int x, y;
    IO::read_int(x);
    IO::read_int(y);
    if (x < 0) {
      x = -x - 1;
      tree_update(x, y - W[x], A[x]);
      W[x] = y;
    } else {
      IO::write_int(solve(x - 1, y), '\n');
    }
  }
}
