There are n stocks in the market, and after researching, the variance of the i-th stock’s price is ai per dollar you devoted.
Master Dong is reluctant to taking risk, so he wants to put the money on hand into n shares in a certain proportion, so that the total amount of total investment in all stocks fluctuates to a minimum.
We use the variance as a measure of volatility. We assume the money Master Dong invested into stocks is a real number. And we just define the unit minimum variance (UMV) as the variance of each dollar Mater Dong invested, under the optimal strategy.
There are m days now. For each day we have a cmd.
cmd = 1 indicates that the market was uniformly regulated on that day, and the stock price was adjusted by x% for the stocks from l to r.
cmd = 2 means if only stocks l to r are considered, what is UMV.
It’s guaranteed the answer is a rational number in the form of . You only need to output
in order to avoid accuracy error and high precision.
, all inputs are integers.
The first line contains two intergers : n, m.
The next line contains n integers a1…an
The next m lines: first input cmd if cmd = 1, input
l, r, x, or l ,r.
For every cmd = 2, output an integer in a line.