import sys
n, q=map(int, raw_input().split())
a=[-1]+map(int, raw_input().split())
w=[-1]+map(int, raw_input().split())
bit_weight=[0]*(n+1)
bit_prod=[0]*(n+1)
def add(bit, index, value):
	while index<=n:
		bit[index]+=value
		index+=(index&-index)
def sum(bit, index):
	result=0
	while index:
		result+=bit[index]
		index-=(index&-index)
	return result
def lower_bound(bit, value):
	index=(1<<18)
	for i in xrange(17, -1, -1):
		if index-(1<<i)<=n and bit[index-(1<<i)]<value:
			value-=bit[index-(1<<i)]
		else:
			index-=(1<<i)
	return index, value
for i in xrange(1, n+1):
	add(bit_weight, i, w[i])
	add(bit_prod, i, (a[i]-i)*w[i])
for i in xrange(q):
	x, y=map(int, raw_input().split())
	if x<0:
		i, v=-x, y
		add(bit_weight, i, v-w[i])
		add(bit_prod, i, (a[i]-i)*(v-w[i]))
		w[i]=v
	else:
		l, r=x, y
		sum_before_l=sum(bit_weight, l-1)
		sum_until_r=sum(bit_weight, r)
		sum_between=sum_until_r-sum_before_l
		sum_half_way=sum_before_l+(sum_between+1)/2
		m, remain=lower_bound(bit_weight, sum_half_way)
		assert sum(bit_weight, m-1)+remain==sum_half_way
		#print>>sys.stderr, m
		# i->a[m]-(m-i), d=|(a[m]-m)-(a[i]-i)| -> *w[i] -> (a[m]-m)*w[i]-(a[i]-i)*w[i]
		coeff=a[m]-m
		sum_until_m=sum(bit_weight, m)
		result=coeff*(sum_until_m-sum_before_l)-coeff*(sum_until_r-sum_until_m)
		sum_before_l=sum(bit_prod, l-1)
		sum_until_m=sum(bit_prod, m)
		sum_until_r=sum(bit_prod, r)
		result+=-(sum_until_m-sum_before_l)+(sum_until_r-sum_until_m)
		print result