{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\n\n \u003cp\u003eChef has recently learnt Function and Addition. He is too exited to teach this to his friend Churu. Chef and Churu are very fast friends, they share their knowledge whenever they meet. Chef use to give a lot of exercises after he teaches some concept to Churu. \u003c/p\u003e \n \u003cp\u003e\u003c/p\u003eChef has an array of \n \u003cb\u003eN\u003c/b\u003e numbers. He also has \n \u003cb\u003eN\u003c/b\u003e functions. Each function will return the sum of all numbers in the array from \n \u003cb\u003eL\u003csub\u003ei\u003c/sub\u003e\u003c/b\u003e to \n \u003cb\u003eR\u003csub\u003ei\u003c/sub\u003e\u003c/b\u003e. So Chef asks churu a lot of queries which are of two types.\n \u003cp\u003e\u003c/p\u003e \n \u003cli\u003e Type 1: Change the \u003cb\u003ex\u003csup\u003eth\u003c/sup\u003e\u003c/b\u003e element of the array to \u003cb\u003ey\u003c/b\u003e. \u003cbr\u003e \u003c/li\u003e \n \u003cli\u003e Type 2: Return the sum of all functions from \u003cb\u003em\u003c/b\u003e to \u003cb\u003en\u003c/b\u003e.\u003cbr\u003e \u003c/li\u003e \n \u003cbr\u003e Now Churu has started to solve, but Chef realize that it is tough for him to decide whether Churu is correct or not. So he needs your help , will you help him out ? \n \u003ch3\u003eInput Format\u003c/h3\u003e First Line is the size of the array i.e. \n \u003cb\u003eN\u003c/b\u003e \n \u003cbr\u003e Next Line contains \n \u003cb\u003eN\u003c/b\u003e space separated numbers \n \u003cb\u003eA\u003csub\u003ei\u003c/sub\u003e\u003c/b\u003e denoting the array\n \u003cbr\u003e Next N line follows denoting \n \u003cb\u003eL\u003csub\u003ei\u003c/sub\u003e\u003c/b\u003e and \n \u003cb\u003eR\u003csub\u003ei\u003c/sub\u003e\u003c/b\u003e for each functions.\n \u003cbr\u003e Next Line contains an integer \n \u003cb\u003eQ\u003c/b\u003e , number of queries to follow.\n \u003cbr\u003e Next \n \u003cb\u003eQ\u003c/b\u003e line follows , each line containing a query of Type 1 or Type 2.\n \u003cbr\u003e 1 \n \u003cb\u003ex y\u003c/b\u003e : denotes a type 1 query,where \n \u003cb\u003ex\u003c/b\u003e and \n \u003cb\u003ey\u003c/b\u003e are integers\n \u003cbr\u003e 2 \n \u003cb\u003em n\u003c/b\u003e : denotes a type 2 query where \n \u003cb\u003em\u003c/b\u003e and \n \u003cb\u003en\u003c/b\u003e are integers\n \u003cbr\u003e \n \u003ch3\u003eOutput Format\u003c/h3\u003e For each query of type 2 , output as asked above.\n \u003cbr\u003e \n \u003ch3\u003eConstraints\u003c/h3\u003e 1 ≤ N ≤ 10\n \u003csup\u003e5\u003c/sup\u003e\n \u003cbr\u003e 1 ≤ A\n \u003csub\u003ei\u003c/sub\u003e ≤ 10\n \u003csup\u003e9\u003c/sup\u003e\n \u003cbr\u003e 1 ≤ L\n \u003csub\u003ei\u003c/sub\u003e ≤ N\n \u003cbr\u003e L\n \u003csub\u003ei\u003c/sub\u003e ≤ R\n \u003csub\u003ei\u003c/sub\u003e ≤ N\n \u003cbr\u003e 1 ≤ Q ≤ 10\n \u003csup\u003e5\u003c/sup\u003e\n \u003cbr\u003e 1 ≤ x ≤ N\n \u003cbr\u003e 1 ≤ y ≤ 10\n \u003csup\u003e9\u003c/sup\u003e\n \u003cbr\u003e 1 ≤ m ≤ N\n \u003cbr\u003e m ≤ n ≤ N\n\n \n\n \u003ch3\u003eSample Input\u003c/h3\u003e 5\n \u003cbr\u003e 1 2 3 4 5\n \u003cbr\u003e 1 3\n \u003cbr\u003e 2 5\n \u003cbr\u003e 4 5\n \u003cbr\u003e 3 5\n \u003cbr\u003e 1 2\n \u003cbr\u003e 4\n \u003cbr\u003e 2 1 4\n \u003cbr\u003e 1 3 7\n \u003cbr\u003e 2 1 4\n \u003cbr\u003e 2 3 5\n \u003cbr\u003e \n \u003ch3\u003eSample Output\u003c/h3\u003e 41\n \u003cbr\u003e 53\n \u003cbr\u003e 28\n \u003cbr\u003e \n \u003ch3\u003eExplanation\u003c/h3\u003e Functions values initially : \n \u003cbr\u003e F[1] \u003d 1+ 2 + 3 \u003d 6\n \u003cbr\u003e F[2] \u003d 2 + 3 + 4 + 5 \u003d 14\n \u003cbr\u003e F[3] \u003d 4+5 \u003d 9\n \u003cbr\u003e F[4] \u003d 3+4+5 \u003d 12\n \u003cbr\u003e F[5] \u003d 1+2 \u003d 3\n \u003cbr\u003e Query 1: F[1] + F[2] + F[3] + F[4] \u003d 41\n \u003cbr\u003e After Update , the Functions are :\n \u003cbr\u003e F[1] \u003d 10 , F[2] \u003d 18 , F[3] \u003d 9 , F[4] \u003d 16 , F[5] \u003d 3\n \u003cbr\u003e Query 3: F[1] + F[2] + F[3] + F[4] \u003d 53\n \u003cbr\u003e Query 4: F[3]+F[4]+F[5] \u003d 28\n \u003cbr\u003e\n \u003c/body\u003e\n\u003c/html\u003e"}}]}