{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThere are $$$n$$$ candy boxes in front of Tania. The boxes are arranged in a row from left to right, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th box contains $$$r_i$$$ candies, candies have the color $$$c_i$$$ (the color can take one of three values — red, green, or blue). All candies inside a single box have the same color (and it is equal to $$$c_i$$$).\u003c/p\u003e\u003cp\u003eInitially, Tanya is next to the box number $$$s$$$. Tanya can move to the neighbor box (that is, with a number that differs by one) or eat candies in the current box. Tanya eats candies instantly, but the movement takes one second.\u003c/p\u003e\u003cp\u003eIf Tanya eats candies from the box, then the box itself remains in place, but there is no more candies in it. In other words, Tanya always eats all the candies from the box and candies in the boxes are not refilled.\u003c/p\u003e\u003cp\u003eIt is known that Tanya cannot eat candies of the same color one after another (that is, the colors of candies in two consecutive boxes from which she eats candies are always different). In addition, Tanya\u0027s appetite is constantly growing, so in each next box from which she eats candies, there should be strictly more candies than in the previous one.\u003c/p\u003e\u003cp\u003eNote that for the first box from which Tanya will eat candies, there are no restrictions on the color and number of candies.\u003c/p\u003e\u003cp\u003eTanya wants to eat at least $$$k$$$ candies. What is the minimum number of seconds she will need? Remember that she eats candies instantly, and time is spent only on movements.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains three integers $$$n$$$, $$$s$$$ and $$$k$$$ ($$$1 \\le n \\le 50$$$, $$$1 \\le s \\le n$$$, $$$1 \\le k \\le 2000$$$) — number of the boxes, initial position of Tanya and lower bound on number of candies to eat. The following line contains $$$n$$$ integers $$$r_i$$$ ($$$1 \\le r_i \\le 50$$$) — numbers of candies in the boxes. The third line contains sequence of $$$n$$$ letters \u0027R\u0027, \u0027G\u0027 and \u0027B\u0027, meaning the colors of candies in the correspondent boxes (\u0027R\u0027 for red, \u0027G\u0027 for green, \u0027B\u0027 for blue). Recall that each box contains candies of only one color. The third line contains no spaces.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint minimal number of seconds to eat at least $$$k$$$ candies. If solution doesn\u0027t exist, print \"-1\".\u003c/p\u003e"}},{"title":"Examples","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\u003e5 3 10\n1 2 3 4 5\nRGBRR\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","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\u003e2 1 15\n5 6\nRG\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e-1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eThe sequence of actions of Tanya for the first example:\u003c/p\u003e\u003cul\u003e \u003cli\u003e move from the box $$$3$$$ to the box $$$2$$$; \u003c/li\u003e\u003cli\u003e eat candies from the box $$$2$$$; \u003c/li\u003e\u003cli\u003e move from the box $$$2$$$ to the box $$$3$$$; \u003c/li\u003e\u003cli\u003e eat candy from the box $$$3$$$; \u003c/li\u003e\u003cli\u003e move from the box $$$3$$$ to the box $$$4$$$; \u003c/li\u003e\u003cli\u003e move from the box $$$4$$$ to the box $$$5$$$; \u003c/li\u003e\u003cli\u003e eat candies from the box $$$5$$$. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eSince Tanya eats candy instantly, the required time is four seconds.\u003c/p\u003e"}}]}