#K43472. Store Inventory Management

    ID: 27317 Type: Default 1000ms 256MiB

Store Inventory Management

Store Inventory Management

A store sells \(N\) types of fruits and manages its inventory using a series of operations. Each fruit has an associated price and quantity. The store performs three types of operations:

  • Update Price: Change the price of a specific fruit.
  • Update Quantity: Change the quantity of a specific fruit.
  • Calculate Value: Compute the total value of a fruit's inventory using the formula \(P \times Q\), where \(P\) is the price and \(Q\) is the quantity.

Your task is to process a series of operations and output the result of each value calculation operation.

Note: The fruits are numbered from 1 to \(N\). Operations that update either price or quantity do not produce any output while the calculation operation does.

inputFormat

The input is read from standard input (stdin) and has the following format:

  1. An integer \(N\) representing the number of fruit types.
  2. \(N\) lines follow, each containing two integers: the initial price and quantity for each fruit, from fruit 1 to fruit \(N\).
  3. An integer \(M\) representing the number of operations.
  4. \(M\) lines follow, each describing an operation. Each line will be in one of the following formats:
    • 1 x p: Update the price of fruit \(x\) to \(p\).
    • 2 x q: Update the quantity of fruit \(x\) to \(q\).
    • 3 x: Calculate and output the current total value (i.e. \(price[x] \times quantity[x]\)) of fruit \(x\).

outputFormat

For each operation of the type 3 x, output the total value of the corresponding fruit on a separate line. If no calculation operation occurs, nothing should be printed.

## sample
3
10 5
20 8
15 10
5
1 2 25
3 2
2 1 7
3 1
3 3
200

70 150

</p>