import java.io.*;
import java.math.*;
import java.util.*;

public class A {
	public static void main (String[] args) { new A(); }

	long MOD = (long)1e9+7;
	
	A() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("");
		
//		BIT tmp = new BIT(10);
//		tmp.update(0, 10);
//		tmp.update(1, 1);
//		tmp.update(2, 14);
//		System.out.println(tmp.getKth(11));

		int n = fs.nextInt(), q = fs.nextInt();
		BIT weight = new BIT(n), offset = new BIT(n);
		int[] pos = new int[n], ws = new int[n];
		int[] offs = new int[n];
		
		for(int i = 0; i < n; i++) pos[i] = fs.nextInt();
		for(int i = 0; i < n; i++) {
			ws[i] = fs.nextInt();
			offs[i] = mult(ws[i], sub(pos[i], i));
			weight.update(i, ws[i]);
			offset.update(i, offs[i]);
		}
		
		for(int qq = 1; qq <= q; qq++) {
			int x = fs.nextInt(), y = fs.nextInt();
			if(x < 0) {
				int id = -x; id--;
				int nw = y;
				
				weight.update(id, -ws[id]);
				offset.update(id, -offs[id]);
				
				ws[id] = nw;
				offs[id] = mult(ws[id], sub(pos[id], id));
				
				weight.update(id, ws[id]);
				offset.update(id, offs[id]);
			}
			else {
				int l = x-1;
				int r = y-1;
				
				long range = weight.range(l, r);
				long tot = range/2+(range&1);
				if(l > 0) tot += weight.range(0, l-1);
				int spot = weight.getKth(tot-1);
				
				long res = 0;
				if(spot > l) {
					int rgt = mult(sub(pos[spot], spot), weight.range(l, spot-1));
					int lft = (int)(offset.range(l, spot-1)%MOD);
					res += sub(rgt, lft);
				}
				if(spot < r) {
					int rgt = mult(sub(pos[spot], spot), weight.range(spot+1, r));
					int lft = (int)(offset.range(spot+1, r)%MOD);
					res += sub(lft, rgt);
				}
				while(res >= MOD) res -= MOD;
				out.println(res);
			}
		}
		
		out.close();
	}
	
	int mult(long a, long b) {
		if(a >= MOD) a %= MOD;
		if(b >= MOD) b %= MOD;
		
		a *= b;
		if(a >= MOD) a %= MOD;
		return (int)a;
	}
	
	int sub(int a, int b) {
		a -= b;
		if(a < 0) a += MOD;
		return a;
	}
	
	class BIT {
		int n;
		long[] tree;
		public BIT(int n) {
			this.n = n;
			tree = new long[n + 2];
		}
		long read(int i) {
			i++;
			long sum = 0;
			while (i > 0) {
				sum += tree[i];
				i -= i & -i;
			}
			return sum;
		}
		long range(int i, int j) {
			long res = read(j);
			if(i > 0) res -= read(i-1);
			return res;
		}
		void update(int i, long val) {
			i++;
			while (i <= n) {
				tree[i] += val;
				i += i & -i;
			}
		}
		int getKth(long k) {
			int e=Integer.highestOneBit(n), o=0;
			for (; e!=0; e>>=1) {
				if (e+o<=n && tree[e+o]<=k) {
					k-=tree[e+o];
					o+=e;
				}
			}
			return o;
		}
	}
	
	class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		FastScanner(){
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer("");
		}
		String next() {
			if(st.hasMoreTokens()) return st.nextToken();
			try { st = new StringTokenizer(br.readLine()); } catch (Exception e) {}
			return next();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
	}
	
}