from math import *

boxCount,lineCount = (int(e) for e in input().split(' '))
posArr = [int(e) for e in input().split(' ')]
massArr = [int(e) for e in input().split(' ')]

def getRequiredEnergy(ind,bottom,top):
  s = 0
  for i in range(bottom,top+1):
    s += massArr[i]*abs(posArr[i]-ind-i)
  return s

def find_v1(loBound,hiBound,bottom,top):
  minval = float('inf');
  for i in range(loBound,hiBound):
    t = getRequiredEnergy(i,bottom,top)
    if(minval>t):
      minval = t
    else:
      # print('i:',i-1)
      return minval
  return minval

def find_v2(loBound,hiBound,bottom,top):
  delta = ceil((hiBound-loBound)/2)
  oprevi = previ = loBound+delta
  prev = getRequiredEnergy(loBound+delta,bottom,top)
  while True:
    t = getRequiredEnergy(previ+delta,bottom,top)
    if(t>=prev):
      t2 = getRequiredEnergy(previ-delta,bottom,top)
      if(t2>=prev):
        if(abs(delta)==1):
          break
        delta = ceil(delta/2)
        if(t2<t):
          delta *= -1
        # print("delta = ",delta,";t = ",t,';t2 = ',t2,';prev = ',prev,sep='')
      else:
        delta *= -1
        previ = previ-delta
        # print(previ)
        prev = t2
    else:
      previ = previ+delta
      # print(previ)
      prev = t
  # print("previ:",previ,"prev:",prev,"delta:",delta,"oprevi:",oprevi)
  return prev;

def main(bottom,top):
  length = top-bottom;
  bpos,tpos = posArr[bottom],posArr[top]

  # minval = find_v1(bpos-length,tpos+1,bottom,top)
  minval = find_v2(bpos-length,tpos+1,bottom,top)

  return minval % 1000000007

for i in range(lineCount):
  a,b = (int(e) for e in input().split(' '))
  if(a<0):
    massArr[-a-1] = b
  else:
    r = main(a-1,b-1)
    print(r)


"""
5 8
1 2 6 7 10
1 1 1 1 2
1 1
1 5
1 3
3 5
-3 5
-1 10
1 4
2 5
-------------------
0
10
3
4
18
7
"""