import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

public class b {
    private static final int c = (int) (2e5 + 10), mod = (int) (1e9 + 7);
    static IO io = new IO();
    static int[][] tre = new int[c][2];
    static int[] a = new int[c];
    static int[] w = new int[c];
    static int n, q;

    static void update(int i,int x,int j){
        while (i<=n){
            tre[i][j]+=x;
            if (j==1)tre[i][j]%= mod;
            i+=(i&-i);
        }
    }

    static long query(int i,int j){
        long s=0;
        while (i>0){
            s+=tre[i][j];
            if (j==1)s%=mod;
            i-=(i&-i);
        }
        return s;
    }

    public static void main(String[] args) {
        n=io.nextInt();q=io.nextInt();
        for (int i=1;i<=n;i++)a[i]=io.nextInt();
        for (int i=1;i<=n;i++){
            update(i,w[i]=io.nextInt(),0);
            update(i,w[i]*(a[i]-i),0);
        }
        while (q-->0){
            int x=io.nextInt(),y=io.nextInt();
            if (x<0){
                x=-x;
                update(x,y-w[x],0);
                update(x,(y-w[x])*(a[x]-x),1);
                w[x]=y;
            }else {
                x--;y--;
                long s=query( y,0)+query(x-1,0);
                int mid=0,c=0;
                for (int i=17;i>=0;i--)if (mid+(1<<i)<=n&&(tre[mid+(1<<i)][0]+c)*2<s){
                    mid+=(1<<i);
                    c+=tre[mid][0];
                }
                long ans=query(y,1)-query(mid,1)-(query(mid-1,1)-query(x-1,1));
                ans-=(query(y,0)-query(mid,0)-(query(mid-1,0)-query(x-1,0)))*(a[mid]-mid);
                io.println(ans%=mod);;

            }
        }
    }
    static class IO {

        BufferedInputStream din;
        final int BUFFER_SIZE = 1 << 16;
        byte[] buffer;
        int byteRead, bufferPoint;

        StringBuilder builder;
        PrintWriter pw;

        public IO() {
            din = new BufferedInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPoint = byteRead = 0;

            builder = new StringBuilder();
            pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
                    System.out
            )));
        }

        int read() {
            if (bufferPoint >= byteRead) {
                try {
                    byteRead = din.read(buffer, bufferPoint = 0, BUFFER_SIZE);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (byteRead == -1) buffer[0] = -1;
            }
            return buffer[bufferPoint++];
        }

        int peek() {
            if (byteRead == -1) return -1;
            if (bufferPoint >= byteRead) {
                try {
                    byteRead = din.read(buffer, bufferPoint = 0, BUFFER_SIZE);
                } catch (IOException e) {
                    return -1;
                }
                if (byteRead <= 0) return -1;
            }
            return buffer[bufferPoint];
        }

        boolean hasNext() {
            int c = peek();
            while (c != -1 && c <= ' ') {
                read();
                c = peek();
            }
            return c != -1;
        }

        char nextChar() {
            int c = read();
            while (c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1) {
                c = read();
            }
            return (char) c;
        }

        double nextDouble() {
            double ret = 0, div = 1;
            int c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }
            if (neg)
                return -ret;
            return ret;
        }

        String nextLine() {
            byte[] strBuf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') {
                    if (cnt == 0) {
                        continue;
                    } else {
                        break;
                    }
                }
                if (strBuf.length == cnt) {
                    strBuf = Arrays.copyOf(strBuf, strBuf.length * 2);
                }
                strBuf[cnt++] = (byte) c;
            }
            return new String(strBuf, 0, cnt);
        }


        String next() {
            byte[] strBuf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (Character.isWhitespace(c)) {
                    if (cnt == 0) {
                        continue;
                    } else {
                        break;
                    }
                }
                if (strBuf.length == cnt) {
                    strBuf = Arrays.copyOf(strBuf, strBuf.length * 2);
                }
                strBuf[cnt++] = (byte) c;
            }
            return new String(strBuf, 0, cnt);
        }

        int nextInt() {
            int ans = 0;
            int c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ans = ans * 10 + c - '0';
            } while ('0' <= (c = read()) && c <= '9');
            bufferPoint--;
            return neg ? -ans : ans;
        }

        long nextLong() {
            long ans = 0;
            int c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ans = ans * 10 + c - '0';
            } while ('0' <= (c = read()) && c <= '9');
            bufferPoint--;
            return neg ? -ans : ans;
        }

        void println(Object o) {
            pw.println(o);
            pw.flush();
        }

        void print(Object o) {
            pw.print(o);
            pw.flush();
        }

        void printf(String format, Object... objects) {
            pw.printf(format, objects);
            pw.flush();
        }

        void close() {
            pw.close();
        }

        void done(Object o) {
            print(o);
            close();
        }

    }

}
