#K35572. Process Multiplicative Queries

    ID: 25561 Type: Default 1000ms 256MiB

Process Multiplicative Queries

Process Multiplicative Queries

You are given a list of (N) integers and (Q) queries. There are two types of queries:\

  1. Query of type 1 is given as: (1\ L\ R\ V). For each index (i) in the range (L \le i \le R), update the (i)-th element of the list as follows:

[ B_i = B_i \times \left((i - L + 1) + V\right) ]

  1. Query of type 2 is given as: (2\ Y). Print the (Y)-th element of the current list.\

It is guaranteed that the operations are applied sequentially in the order of the queries. Your task is to process all the queries and for every query of type 2, output the corresponding element in the updated list.

inputFormat

The first line contains two integers (N) and (Q), representing the number of elements in the list and the number of queries, respectively.\ The second line contains (N) integers (B_1, B_2, \ldots, B_N), which is the initial list.\ Each of the following (Q) lines contains a query in one of the following formats:\

  • For a query of type 1: a line containing four integers: 1 L R V\
  • For a query of type 2: a line containing two integers: 2 Y

outputFormat

For each query of type 2, output the (Y)-th element of the list on a new line.## sample

6 3
2 4 6 8 10 12
1 1 3 2
2 2
1 4 6 3
12