{"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\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eVanya is managed to enter his favourite site Codehorses. Vanya uses \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e distinct passwords for sites at all, however he can\u0027t remember which one exactly he specified during Codehorses registration.\u003c/p\u003e\u003cp\u003eVanya will enter passwords in order of non-decreasing their lengths, and he will enter passwords of same length in arbitrary order. Just when Vanya will have entered the correct password, he is immediately authorized on the site. Vanya will not enter any password twice.\u003c/p\u003e\u003cp\u003eEntering any passwords takes one second for Vanya. But if Vanya will enter wrong password \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ek\u003c/i\u003e\u003c/span\u003e times, then he is able to make the next try only \u003cspan class\u003d\"tex-span\"\u003e5\u003c/span\u003e seconds after that. Vanya makes each try immediately, that is, at each moment when Vanya is able to enter password, he is doing that.\u003c/p\u003e\u003cp\u003eDetermine how many seconds will Vanya need to enter Codehorses in the best case for him (if he spends minimum possible number of second) and in the worst case (if he spends maximum possible amount of seconds).\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of the input contains two integers \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ek\u003c/i\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e1 ≤ \u003ci\u003en\u003c/i\u003e, \u003ci\u003ek\u003c/i\u003e ≤ 100\u003c/span\u003e)\u0026nbsp;— the number of Vanya\u0027s passwords and the number of failed tries, after which the access to the site is blocked for \u003cspan class\u003d\"tex-span\"\u003e5\u003c/span\u003e seconds.\u003c/p\u003e\u003cp\u003eThe next \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e lines contains passwords, one per line\u0026nbsp;— pairwise distinct non-empty strings consisting of latin letters and digits. Each password length does not exceed \u003cspan class\u003d\"tex-span\"\u003e100\u003c/span\u003e characters.\u003c/p\u003e\u003cp\u003eThe last line of the input contains the Vanya\u0027s Codehorses password. It is guaranteed that the Vanya\u0027s Codehorses password is equal to some of his \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e passwords.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint two integers\u0026nbsp;— time (in seconds), Vanya needs to be authorized to Codehorses in the best case for him and in the worst case respectively.\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 2\ncba\nabc\nbb1\nabC\nABC\nabc\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 15\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\u003e4 100\n11\n22\n1\n2\n22\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3 4\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\u003eConsider the first sample case. As soon as all passwords have the same length, Vanya can enter the right password at the first try as well as at the last try. If he enters it at the first try, he spends exactly \u003cspan class\u003d\"tex-span\"\u003e1\u003c/span\u003e second. Thus in the best case the answer is \u003cspan class\u003d\"tex-span\"\u003e1\u003c/span\u003e. If, at the other hand, he enters it at the last try, he enters another \u003cspan class\u003d\"tex-span\"\u003e4\u003c/span\u003e passwords before. He spends \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e seconds to enter first \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e passwords, then he waits \u003cspan class\u003d\"tex-span\"\u003e5\u003c/span\u003e seconds as soon as he made \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e wrong tries. Then he spends \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e more seconds to enter \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e wrong passwords, again waits \u003cspan class\u003d\"tex-span\"\u003e5\u003c/span\u003e seconds and, finally, enters the correct password spending \u003cspan class\u003d\"tex-span\"\u003e1\u003c/span\u003e more second. In summary in the worst case he is able to be authorized in \u003cspan class\u003d\"tex-span\"\u003e15\u003c/span\u003e seconds.\u003c/p\u003e\u003cp\u003eConsider the second sample case. There is no way of entering passwords and get the access to the site blocked. As soon as the required password has length of \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e, Vanya enters all passwords of length \u003cspan class\u003d\"tex-span\"\u003e1\u003c/span\u003e anyway, spending \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e seconds for that. Then, in the best case, he immediately enters the correct password and the answer for the best case is \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e, but in the worst case he enters wrong password of length \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e and only then the right one, spending \u003cspan class\u003d\"tex-span\"\u003e4\u003c/span\u003e seconds at all.\u003c/p\u003e"}}]}