# Dark SOLUTIONS CMX1P04

Page Contents

### Dark SOLUTIONS CMX1P04

Jonas is a very lover history understudy. He lives in the province of Winden and is captivated by its history. One night he was meandering in the timberlands of Winden and coincidentally he found the Widen Caves. Which undoubtedly were a Time Machine! He realized that verifiably Winden was an exceptionally helpless state, yet on the off chance that he can go to the past and give the gold that he found in the caverns to the individuals, at that point Winden can be a rich state in the present.

There were consistently N houses in Winden directly from its origin. Information the rundown of unique riches Hi of these N family units, where Hi speaks to the abundance of ith house, which is unaltered from the earliest starting point right up ’til today.

Presently you have to deal with Q inquiries of two sorts

past W I : In this question, Jonas goes to the past and gives W riches to the Ith family unit. No compelling reason to print any yield here.

present L R : In this inquiry, Jonas computes the complete abundance of houses from list L to R (both comprehensive). You have to print this incentive on another line.

Info:

First line contains N the quantity of houses.

Second line contain N separated whole numbers, where Hi speaks to the abundance of ith family

Third line contains Q the all out number of inquiries

At that point, Q lines follow. Every one of these lines contains one of the two questions referenced previously.

Yield:

For each inquiry of the subsequent sort, print a solitary line containing one number ― the riches which Jonas determined.

Limitations

1≤N≤106

0≤Hi≤109

1≤Q≤105

1≤W≤109

1≤I≤N

1≤L≤R≤N

Test Input:

2 5 8 7 1

past 5 2

present 1 3

past 10 5

present 1 5

Test Output:

20

38

Clarification:

In first inquiry he adds 5 riches to second house, presently second house complete riches gets 5+5=10.

In second inquiry he figures riches from house 1 to 3, which is 2+10+8=20.

In third inquiry he adds 10 riches to fifth house, presently fifth house complete riches gets 1+10=11.

In last question he ascertains riches from house 1 to 5, which is 2+10+8+7+11=38.