# Prime Divide

#### Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

`You are given an array A of N numbers.You need to perform Q operations. Each operation has one of the two type:1. 1 l r p: select all numbers between indices l to r which are divisible by p and  divide then all by p, here is in set {2, 3 5}.2. 2 l d: update element at index l to d.Print the final array after performing all operations.`
Input Format
`First line contains single number N denoting size of arraySecond line contains N space seperated numbers A[1] A[2] A[3] ... A[N] denoting elements of arrayThird line contains single number Q denoting number of operationsQ following lines contains operations of format1 l r p or 2 l d`
Output Format
`Print in different lines elements of array after performing all operations.`
Question Video
Constraints
`1. 1 <= N <= 10^52. 1 <= Q <= 10^53. 1 <= l <= r <= N4. 1 <= A[i], d <= 10^95. p belongs to set {2, 3, 5}`
Sample Input
`58 9 12 3 5 51 1 5 32 5 91 1 5 31 2 5 22 3 5`
Sample Output
`81513`

• Related Topics

Run

Run
Id Name