You are given an array a_1, a_2, …, a_n.

You need to perform q queries of the following two types:

  1. "MULTIPLY l r x" — for every i (l ≤ i ≤ r) multiply a_i by x.
  2. "TOTIENT l r" — print \varphi(∏ _{i=l}^{r} a_i) taken modulo 10^9+7, where \varphi denotes Euler's totient function. 



The [Euler's totient function](http://gg.gg/euler_totient) of a positive integer n (denoted as \varphi(n)) is the number of integers x (1 ≤ x ≤ n) such that \gcd(n,x) = 1.

Input

The first line contains two integers n and q (1 ≤ n ≤ 4 ⋅ 10^5, 1 ≤ q ≤ 2 ⋅ 10^5) — the number of elements in array a and the number of queries.

The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 300) — the elements of array a.

Then q lines follow, describing queries in the format given in the statement.

  1. "MULTIPLY l r x" (1 ≤ l ≤ r ≤ n, 1 ≤ x ≤ 300) — denotes a multiplication query.
  2. "TOTIENT l r" (1 ≤ l ≤ r ≤ n) — denotes a query on the value of Euler's totient function. 



It is guaranteed that there is at least one "TOTIENT" query.

Output

For each "TOTIENT" query, print the answer to it.

Example

Input

4 4
5 9 1 2
TOTIENT 3 3
TOTIENT 3 4
MULTIPLY 4 4 3
TOTIENT 4 4


Output

1
1
2

Note

In the first example, \varphi(1) = 1 for the first query, \varphi(2) = 1 for the second query and \varphi(6) = 2 for the third one.
import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
    static int[] primes =new int[301];
    static int[] primes2 =new int[301];
    static long[] pp =new long[301];
    static boolean[] check = new boolean[301];
    static long mod = 1000000007;
    static long fa[]  = new long[301];
    public static void main(String args[]) throws IOException {
        FastScanner fastIO = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
        int count = 0;
        for(int i=2;i<=300;i++){
            if(check[i]) continue;
            int cnt = 2;
            primes2[count] = i;
            primes[i] = count++;
            while(i*cnt<=300){
                check[i*cnt] = true;
                cnt++;
            }
        }
        for(int i=1;i<=300;i++){
            for(int j=2;j<=i;j++){
                if(!check[j] &&i%j==0){
                    //System.out.println(i+" "+j);
                    pp[i] |= (1l  <<  primes[j]);
                }
            }
            //System.out.println(pp[i]);
        }
        Arrays.fill(tree,1);
        Arrays.fill(lazy,1);
        for(int i=1;i<=300;i++){
            if(!check[i]){
                fa[i] = pow(i,mod-2)*(i-1)%mod;
            }
        }
        int n = fastIO.nextInt();
        int m = fastIO.nextInt();
        for(int i=0;i<n;i++){
            int v = fastIO.nextInt();
            update(1,v,pp[v],i,i,0,n-1);
        }

        StringBuilder sb = new StringBuilder();
        for(int i=0;i<m;i++){
            if(fastIO.next().equals("MULTIPLY")){
                int l = fastIO.nextInt()-1;
                int r = fastIO.nextInt()-1;
                int v = fastIO.nextInt();
                update(1,v,pp[v],l,r,0,n-1);
            }
            else{
                int l = fastIO.nextInt()-1;
                int r = fastIO.nextInt()-1;
                long[] a = get(1,l,r,0,n-1);
                long product = a[0];
                long mask = a[1];
                for(int j=0;j<count;j++){
                    if(((1l<<j) & mask) != 0){
                        product *= fa[primes2[j]];
                        product %= mod;
                    }
                }
                pw.println(product);
            }
        }
        pw.close();
    }
    static long tree[] = new long[4810000];
    static long  lazy[] = new long[4810000];
    static long tree2[] = new long[4810000];
    static long  lazy2[] = new long[4810000];

    public static long gcd(long a, long b)
    {
        if(b == 0) {
            return a;
        } else {
            return gcd(b, a%b);
        }
    }

    static long pow(long value,long exp){
        if(exp == 0) return 1;
        if(exp == 1) return value%mod;
        long v = pow(value,exp/2);
        v = v*v%mod;
        if(exp % 2 ==1){
            v *= value;
            v %= mod;
        }
        return v;

    }
    static void propa(int node, int start, int end){
        tree[node] *= pow(lazy[node],(end-start+1));
        tree[node] %= mod;
        if (start != end){
            lazy[node * 2] *= lazy[node];
            lazy[node * 2] %= mod;
            lazy[node * 2 + 1] *= lazy[node];
            lazy[node * 2 + 1] %= mod;
        }
        lazy[node] = 1;
    }

    static void propa2(int node, int start, int end){
        tree2[node] |= lazy2[node];
        if (start != end){
            lazy2[node * 2] |= lazy2[node];
            lazy2[node * 2 + 1] |= lazy2[node];
        }
        lazy2[node] = 0;
    }
    static long[] get(int node, int left, int right, int start, int end){
        long[] a = new long[2];
        if (lazy[node] != 1) propa(node,start,end);
        if (lazy2[node] != 0) propa2(node,start,end);
        if (left > end || right < start) {
            a[0] = 1;
            a[1] = 0;
            return a;
        }
        if (left <= start && end <= right) {
            a[0] = tree[node];
            a[1] = tree2[node];
            return a;
        }
        long[] l = get(node * 2, left, right, start, (start + end) / 2);
        long[] r = get(node * 2 + 1, left, right, ((start + end) / 2) + 1, end);
        a[0] = l[0] * r[0] %mod;
        a[1] = l[1] | r[1];
        return a;
    }

    static void update(int node, long val,long mask, int left, int right, int start, int end){
        if (lazy[node] != 1) propa(node, start, end);
        if (lazy2[node] != 0) propa2(node, start, end);
        if (left > end || right < start) return;
        if (left <= start && end <= right){
            tree[node] *= pow(val,(end-start+1));
            tree[node] %= mod;
            if (start != end){
                lazy[node * 2] *= val;
                lazy[node * 2 + 1] *= val;
                lazy[node * 2 ] %=mod;
                lazy[node * 2 + 1] %= mod;
            }
            tree2[node] |= mask;
            if (start != end){
                lazy2[node * 2] |= mask;
                lazy2[node * 2 + 1] |=mask;
            }
            return;
        }
        update(node * 2, val,mask, left, right, start, (start + end) / 2);
        update(node * 2 + 1, val,mask, left, right, ((start + end) / 2)+1, end);
        tree[node] = tree[node * 2] * tree[node * 2 + 1];
        tree[node] %= mod;
        tree2[node] = tree2[node * 2] | tree2[node * 2 + 1];
    }

    static class FastScanner {
        public int BS = 1<<16;
        public char NC = (char)0;
        byte[] buf = new byte[BS];
        int bId = 0, size = 0;
        char c = NC;
        double num = 1;
        BufferedInputStream in;

        public FastScanner() {
            in = new BufferedInputStream(System.in, BS);
        }

        public FastScanner(String s) throws FileNotFoundException {
            in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
        }

        public char nextChar(){
            while(bId==size) {
                try {
                    size = in.read(buf);
                }catch(Exception e) {
                    return NC;
                }
                if(size==-1)return NC;
                bId=0;
            }
            return (char)buf[bId++];
        }

        public int nextInt() {
            return (int)nextLong();
        }

        public long nextLong() {
            num=1;
            boolean neg = false;
            if(c==NC)c=nextChar();
            for(;(c<'0' || c>'9'); c = nextChar()) {
                if(c=='-')neg=true;
            }
            long res = 0;
            for(; c>='0' && c <='9'; c=nextChar()) {
                res = (res<<3)+(res<<1)+c-'0';
                num*=10;
            }
            return neg?-res:res;
        }

        public double nextDouble() {
            double cur = nextLong();
            return c!='.' ? cur:cur+nextLong()/num;
        }

        public String next() {
            StringBuilder res = new StringBuilder();
            while(c<=32)c=nextChar();
            while(c>32) {
                res.append(c);
                c=nextChar();
            }
            return res.toString();
        }

        public String nextLine() {
            StringBuilder res = new StringBuilder();
            while(c<=32)c=nextChar();
            while(c!='\n') {
                res.append(c);
                c=nextChar();
            }
            return res.toString();
        }

        public boolean hasNext() {
            if(c>32)return true;
            while(true) {
                c=nextChar();
                if(c==NC)return false;
                else if(c>32)return true;
            }
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for(int i = 0; i < n; i++) res[i] = nextInt();
            return res;
        }

    }

}