{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"N gangsters are going to a restaurant. The i-th gangster comes at the time Ti and has the prosperity Pi. The door of the restaurant has K+1 states of openness expressed by the integers in the range [0, K]. The state of openness can change by one in one unit of time; i.e. it either opens by one, closes by one or remains the same. At the initial moment of time the door is closed (state 0). The i-th gangster enters the restaurant only if the door is opened specially for him, i.e. when the state of openness coincides with his stoutness Si. If at the moment of time when the gangster comes to the restaurant the state of openness is not equal to his stoutness, then the gangster goes away and never returns.\u003cbr\u003eThe restaurant works in the interval of time [0, T].\u003cbr\u003eThe goal is to gather the gangsters with the maximal total prosperity in the restaurant by opening and closing the door appropriately.\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"?The first line of the input file contains the values N, K, and T, separated by spaces. (1 \u0026lt;\u003d N \u0026lt;\u003d 100 ,1 \u0026lt;\u003d K \u0026lt;\u003d 100 ,0 \u0026lt;\u003d T \u0026lt;\u003d 30000 )\u003cbr\u003e?The second line of the input file contains the moments of time when gangsters come to the restaurant T1, T2, ..., TN, separated by spaces. ( 0 \u0026lt;\u003d Ti \u0026lt;\u003d T for i \u003d 1, 2, ..., N)\u003cbr\u003e?The third line of the input file contains the values of the prosperity of gangsters P1, P2, ..., PN, separated by spaces. ( 0 \u0026lt;\u003d Pi \u0026lt;\u003d 300 for i \u003d 1, 2, ..., N)\u003cbr\u003e?The forth line of the input file contains the values of the stoutness of gangsters S1, S2, ..., SN, separated by spaces. ( 1 \u0026lt;\u003d Si \u0026lt;\u003d K for i \u003d 1, 2, ..., N)\u003cbr\u003eAll values in the input file are integers.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"Print to the output file the single integer ?the maximal sum of prosperity of gangsters in the restaurant. In case when no gangster can enter the restaurant the output should be 0."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4 10 20\r\n10 16 8 16\r\n10 11 15 1\r\n10 7 1 8\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e26\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}