#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
class Lnum {
  const int base = 1e9;
  vector<int> digit;
  int sign;
  void normalize();

 public:
  Lnum();
  Lnum(long long);
  Lnum(string);
  Lnum(vector<int>, int);
  Lnum(const Lnum&);
  Lnum& operator=(const Lnum&);
  bool operator==(const Lnum&) const;
  bool operator!=(const Lnum&) const;
  bool operator<(const Lnum&) const;
  bool operator<=(const Lnum&) const;
  bool operator>(const Lnum&) const;
  bool operator>=(const Lnum&) const;
  Lnum operator+(const Lnum&) const;
  Lnum operator-(const Lnum&) const;
  Lnum operator-() const;
  Lnum operator*(const Lnum&) const;
  Lnum operator/(const Lnum&) const;
  Lnum operator%(const Lnum&) const;
  Lnum operator+=(const Lnum&);
  Lnum operator-=(const Lnum&);
  Lnum operator*=(const Lnum&);
  Lnum operator/=(const Lnum&);
  Lnum operator%=(const Lnum&);
  Lnum& operator=(const long long&);
  bool operator==(const long long&) const;
  bool operator!=(const long long&) const;
  bool operator<(const long long&) const;
  bool operator<=(const long long&) const;
  bool operator>(const long long&) const;
  bool operator>=(const long long&) const;
  Lnum operator+(const long long&) const;
  Lnum operator-(const long long&) const;
  Lnum operator*(const long long&) const;
  Lnum operator/(const long long&) const;
  Lnum operator%(const long long&) const;
  Lnum operator+=(const long long&);
  Lnum operator-=(const long long&);
  Lnum operator*=(const long long&);
  Lnum operator/=(const long long&);
  Lnum operator%=(const long long&);
  pair<Lnum, Lnum> divmod(const Lnum&) const;
  int getDigit(int) const;
  int length() const;
  int getSign() const;
  vector<int> getDigits() const;
};
Lnum lPow(Lnum a, long long b);
Lnum lPow(long long a, long long b);
Lnum::Lnum() : sign(1), digit(vector<int>(1, 0)) {}
Lnum::Lnum(long long x) {
  if (x < 0) {
    sign = -1;
    x *= -1;
  } else {
    sign = 1;
  }
  digit.clear();
  while (x > 0) {
    digit.push_back(x % base);
    x /= base;
  }
  if (digit.empty()) {
    digit.push_back(0);
  }
}
Lnum::Lnum(string s) {
  digit.clear();
  sign = 1;
  reverse(s.begin(), s.end());
  int cnt = 0, x = 0, pw = 1;
  for (auto c : s) {
    if (isdigit(c)) {
      cnt++;
      x += pw * int(c - '0');
      pw *= 10;
      if (cnt == 9) {
        digit.push_back(x);
        cnt = 0;
        x = 0;
        pw = 1;
      }
    } else {
      if (x != 0) {
        digit.push_back(x);
        x = 0;
      }
      if (c == '-') {
        sign *= -1;
      }
    }
  }
  if (x != 0) {
    digit.push_back(x);
  }
  normalize();
}
Lnum::Lnum(vector<int> digit, int sign) : digit(digit), sign(sign) {
  normalize();
}
Lnum::Lnum(const Lnum& x) : digit(x.getDigits()), sign(x.getSign()) {
  normalize();
}
Lnum& Lnum::operator=(const Lnum& x) {
  digit = x.getDigits();
  sign = x.getSign();
  return *this;
}
istream& operator>>(istream& in, Lnum& x) {
  string s;
  in >> s;
  x = Lnum(s);
  return in;
}
ostream& operator<<(ostream& out, const Lnum& x) {
  if (x == 0) {
    out << 0;
  } else {
    if (x.getSign() == -1) {
      out << "-";
    }
    vector<int> digits = x.getDigits();
    out << digits.back();
    digits.pop_back();
    reverse(digits.begin(), digits.end());
    struct Helper {
      string addLeadingZeroes(int x) {
        stringstream stream;
        stream << x;
        string s = stream.str();
        while (int(s.size()) < 9) {
          s = "0" + s;
        }
        return s;
      }
    } h;
    for (auto x : digits) {
      out << h.addLeadingZeroes(x);
    }
  }
  return out;
}
bool Lnum::operator==(const Lnum& x) const {
  return sign == x.getSign() && digit == x.getDigits();
}
bool Lnum::operator!=(const Lnum& x) const { return !(*this == x); }
bool Lnum::operator<(const Lnum& x) const {
  if (sign != x.getSign()) {
    return sign < x.getSign();
  } else {
    bool condition;
    if (length() != x.length()) {
      condition = length() < x.length();
    } else {
      vector<int> v1 = digit, v2 = x.getDigits();
      reverse(v1.begin(), v1.end());
      reverse(v2.begin(), v2.end());
      condition = v1 < v2;
    }
    if (sign == -1) condition ^= 1;
    return condition;
  }
}
bool Lnum::operator<=(const Lnum& x) const { return *this < x || *this == x; }
bool Lnum::operator>(const Lnum& x) const { return !(*this <= x); }
bool Lnum::operator>=(const Lnum& x) const { return !(*this < x); }
Lnum Lnum::operator-() const { return Lnum(digit, -sign); }
Lnum Lnum::operator+(const Lnum& x) const {
  if (sign == x.getSign()) {
    vector<int> c(max(x.length(), length()) + 1, 0);
    for (int i = 0, carry = 0; i < int(c.size()); i++) {
      carry += getDigit(i) + x.getDigit(i);
      c[i] = carry % base;
      carry /= base;
    }
    return Lnum(c, sign);
  } else {
    if (*this > x) {
      return *this - (-x);
    } else {
      return (x - (-*this));
    }
  }
}
Lnum Lnum::operator-(const Lnum& x) const {
  if (sign != x.getSign()) {
    return *this + (-x);
  } else {
    if (sign == -1) {
      return -(-*this - (-x));
    } else {
      if (*this < x) {
        return -(x - *this);
      } else {
        vector<int> c(digit.size(), 0);
        for (int i = 0; i < int(c.size()); i++) {
          c[i] += getDigit(i) - x.getDigit(i);
          if (c[i] < 0) {
            c[i] += base;
            c[i + 1]--;
          }
        }
        return Lnum(c, 1);
      }
    }
  }
}
Lnum Lnum::operator*(const Lnum& x) const {
  vector<int> c(length() + x.length() + 10, 0);
  for (int i = 0, carry = 0; i < int(digit.size()); i++) {
    for (int j = 0; i + j < int(c.size()) || carry > 0; j++) {
      long long cur = c[i + j] + getDigit(i) * 1ll * x.getDigit(j) + carry;
      carry = cur / base;
      c[i + j] = cur % base;
    }
  }
  return Lnum(c, sign * x.getSign());
}
Lnum Lnum::operator/(const Lnum& x) const { return divmod(x).first; }
Lnum Lnum::operator%(const Lnum& x) const { return divmod(x).second; }
pair<Lnum, Lnum> Lnum::divmod(const Lnum& x) const {
  vector<int> a = digit;
  reverse(a.begin(), a.end());
  Lnum y(x.getDigits(), 1);
  vector<int> c;
  Lnum carry = 0;
  for (int i = 0; i < a.size(); i++) {
    carry *= base;
    carry += a[i];
    int l = 0, r = base - 1;
    while (l < r) {
      int m = (l + r + 1) / 2;
      if (y * m <= carry) {
        l = m;
      } else {
        r = m - 1;
      }
    }
    c.push_back(l);
    carry -= y * l;
  }
  reverse(c.begin(), c.end());
  return make_pair(Lnum(c, sign * x.getSign()), carry * (sign * x.getSign()));
}
Lnum Lnum::operator+=(const Lnum& x) { return (*this = *this + x); }
Lnum Lnum::operator-=(const Lnum& x) { return (*this = *this - x); }
Lnum Lnum::operator*=(const Lnum& x) { return (*this = *this * x); }
Lnum Lnum::operator/=(const Lnum& x) { return (*this = *this / x); }
Lnum Lnum::operator%=(const Lnum& x) { return (*this = *this % x); }
Lnum& Lnum::operator=(const long long& x) { return (*this = Lnum(x)); }
bool Lnum::operator==(const long long& x) const { return *this == Lnum(x); }
bool Lnum::operator!=(const long long& x) const { return *this != Lnum(x); }
bool Lnum::operator<(const long long& x) const { return *this < Lnum(x); }
bool Lnum::operator<=(const long long& x) const { return *this <= Lnum(x); }
bool Lnum::operator>(const long long& x) const { return *this > Lnum(x); }
bool Lnum::operator>=(const long long& x) const { return *this >= Lnum(x); }
Lnum Lnum::operator+(const long long& x) const { return *this + Lnum(x); }
Lnum Lnum::operator-(const long long& x) const { return *this - Lnum(x); }
Lnum Lnum::operator*(const long long& x) const { return *this * Lnum(x); }
Lnum Lnum::operator/(const long long& x) const { return *this / Lnum(x); }
Lnum Lnum::operator%(const long long& x) const { return *this % Lnum(x); }
Lnum Lnum::operator+=(const long long& x) { return (*this = *this + x); }
Lnum Lnum::operator-=(const long long& x) { return (*this = *this - x); }
Lnum Lnum::operator*=(const long long& x) { return (*this = *this * x); }
Lnum Lnum::operator/=(const long long& x) { return (*this = *this / x); }
Lnum Lnum::operator%=(const long long& x) { return (*this = *this % x); }
int Lnum::getDigit(int pos) const {
  return 0 <= pos && pos < int(digit.size()) ? digit[pos] : 0;
}
int Lnum::length() const {
  return digit.size() == 1 && digit[0] == 0 ? 1 : digit.size() + (sign == -1);
}
int Lnum::getSign() const { return sign; }
vector<int> Lnum::getDigits() const { return digit; }
void Lnum::normalize() {
  while (digit.size() > 1 && digit.back() == 0) {
    digit.pop_back();
  }
  if (digit.size() == 0) {
    sign = 1;
    digit.push_back(0);
  }
  if (digit.size() == 1 && digit[0] == 0) {
    sign = 1;
  }
}
Lnum lPow(Lnum a, long long b) {
  Lnum res = 1;
  while (b > 0) {
    if (b % 2) res *= a;
    a *= a;
    b /= 2;
  }
  return res;
}
Lnum lPow(long long a, long long b) { return lPow(Lnum(a), b); }
const int MAXN = 2e5 + 10;
const int M = 1e9 + 7;
int n, q, a[MAXN], w[MAXN];
struct Node {
  Lnum sw, s1, s2;
} t[4 * MAXN];
Node f(Node u, Node v) { return Node{u.sw + v.sw, u.s1 + v.s1, u.s2 + v.s2}; }
void build(int v, int l, int r) {
  if (l == r) {
    t[v].sw = w[l];
    t[v].s1 = (a[l] - l) * 1ll * w[l];
    t[v].s2 = (a[l] + l) * 1ll * w[l];
  } else {
    int m = (l + r) / 2;
    build(v + v, l, m);
    build(v + v + 1, m + 1, r);
    t[v] = f(t[v + v], t[v + v + 1]);
  }
}
void upd(int v, int l, int r, int pos, int val) {
  if (l == r) {
    w[l] = val;
    t[v].sw = w[l];
    t[v].s1 = (a[l] - l) * 1ll * w[l];
    t[v].s2 = (a[l] + l) * 1ll * w[l];
  } else {
    int m = (l + r) / 2;
    if (pos <= m) {
      upd(v + v, l, m, pos, val);
    } else {
      upd(v + v + 1, m + 1, r, pos, val);
    }
    t[v] = f(t[v + v], t[v + v + 1]);
  }
}
Node get(int v, int l, int r, int L, int R) {
  if (r < L || R < l || R < l) {
    return Node{0, 0, 0};
  }
  if (L <= l && r <= R) {
    return t[v];
  }
  int m = (l + r) / 2;
  return f(get(v + v, l, m, L, R), get(v + v + 1, m + 1, r, L, R));
}
Lnum getShift(int l, int r, int i) {
  Node gl = get(1, 1, n, l, i - 1), gr = get(1, 1, n, i + 1, r);
  Lnum res = 0;
  if (l <= i - 1) {
    res += -gl.s1 + gl.sw * (a[i] - i);
  }
  if (i + 1 <= r) {
    res += gr.s1 - gr.sw * (a[i] - i);
  }
  return res;
}
Lnum ans(int L, int R, int l, int r) {
  while (l + 1 < r) {
    int m = (l + r) / 2;
    Lnum x = getShift(L, R, m + 1) - getShift(L, R, m);
    if (x == 0) return getShift(L, R, m);
    if (x > 0) {
      r = m;
    } else {
      l = m;
    }
  }
  return min(getShift(L, R, l), getShift(L, R, r));
}
int32_t main() {
  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]);
  }
  build(1, 1, n);
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (l < 0) {
      upd(1, 1, n, -l, r);
    } else {
      cout << ans(l, r, l, r) % M << "\n";
    }
  }
}
