{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":" \n \u003cp\u003eIn Chinese mythology, Pangu is the first living being and the creator of the sky and the earth. He woke up from an egg and split the egg into two parts: the sky and the earth.\u003c/p\u003e \n \u003cp\u003eAt the beginning, there was no mountain on the earth, only stones all over the land.\u003c/p\u003e \n \u003cp\u003eThere were N piles of stones, numbered from 1 to N. Pangu wanted to merge all of them into one pile to build a great mountain. If the sum of stones of some piles was S, Pangu would need S seconds to pile them into one pile, and there would be S stones in the new pile. \u003c/p\u003e \n \u003cp\u003eUnfortunately, every time Pangu could only merge successive piles into one pile. And the number of piles he merged shouldn\u0027t be less than L or greater than R.\u003c/p\u003e \n \u003cp\u003ePangu wanted to finish this as soon as possible. \u003c/p\u003e \n \u003cp\u003eCan you help him? If there was no solution, you should answer \u00270\u0027.\u003c/p\u003e \n "}},{"title":"Input","value":{"format":"HTML","content":" \n \u003cp\u003eThere are multiple test cases.\u003c/p\u003e \n \u003cp\u003eThe first line of each case contains three integers N,L,R as above mentioned (2\u0026lt;\u003dN\u0026lt;\u003d100,2\u0026lt;\u003dL\u0026lt;\u003dR\u0026lt;\u003dN).\u003c/p\u003e \n \u003cp\u003eThe second line of each case contains N integers a\u003csub\u003e1\u003c/sub\u003e,a\u003csub\u003e2\u003c/sub\u003e …a\u003csub\u003eN\u003c/sub\u003e (1\u0026lt;\u003d a\u003csub\u003ei\u003c/sub\u003e \u0026nbsp;\u0026lt;\u003d1000,i\u003d 1…N ), indicating the number of stones of \u0026nbsp;pile 1, pile 2 …pile N.\u003c/p\u003e \n \u003cp\u003eThe number of test cases is less than 110 and there are at most 5 test cases in which N \u0026gt;\u003d 50.\u003c/p\u003e \n "}},{"title":"Output","value":{"format":"HTML","content":" \n \u003cp\u003eFor each test case, you should output the minimum time(in seconds) Pangu had to take . If it was impossible for Pangu to do his job, you should output \u0026nbsp;0.\u003c/p\u003e \n \u003c/div\u003e \n "}},{"title":"Sample Input","value":{"format":"HTML","content":" \n \u003cpre\u003e3 2 2\r\n1 2 3\r\n3 2 3\r\n1 2 3\r\n4 3 3\r\n1 2 3 4\u003c/pre\u003e \n "}},{"title":"Sample Output","value":{"format":"HTML","content":" \n \u003cpre\u003e9\r\n6\r\n0\u003c/pre\u003e \n "}}]}