Vanya is managed to enter his favourite site Codehorses. Vanya uses _n_ distinct passwords for sites at all, however he can't remember which one exactly he specified during Codehorses registration.
Vanya 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.
Entering any passwords takes one second for Vanya. But if Vanya will enter wrong password _k_ times, then he is able to make the next try only 5 seconds after that. Vanya makes each try immediately, that is, at each moment when Vanya is able to enter password, he is doing that.
Determine 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).
## Input
The first line of the input contains two integers _n_ and _k_ (1 ≤ _n_, _k_ ≤ 100) — the number of Vanya's passwords and the number of failed tries, after which the access to the site is blocked for 5 seconds.
The next _n_ lines contains passwords, one per line — pairwise distinct non-empty strings consisting of latin letters and digits. Each password length does not exceed 100 characters.
The last line of the input contains the Vanya's Codehorses password. It is guaranteed that the Vanya's Codehorses password is equal to some of his _n_ passwords.
## Output
Print two integers — time (in seconds), Vanya needs to be authorized to Codehorses in the best case for him and in the worst case respectively.
[samples]
## Note
Consider 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 1 second. Thus in the best case the answer is 1. If, at the other hand, he enters it at the last try, he enters another 4 passwords before. He spends 2 seconds to enter first 2 passwords, then he waits 5 seconds as soon as he made 2 wrong tries. Then he spends 2 more seconds to enter 2 wrong passwords, again waits 5 seconds and, finally, enters the correct password spending 1 more second. In summary in the worst case he is able to be authorized in 15 seconds.
Consider 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 2, Vanya enters all passwords of length 1 anyway, spending 2 seconds for that. Then, in the best case, he immediately enters the correct password and the answer for the best case is 3, but in the worst case he enters wrong password of length 2 and only then the right one, spending 4 seconds at all.
Vanya 成功登录了他最喜欢的网站 Codehorses。Vanya 总共为各个网站使用了 #cf_span[n] 个不同的密码,但他不记得在注册 Codehorses 时具体使用了哪一个。
Vanya 将按照密码长度非递减的顺序尝试密码,对于相同长度的密码,他将以任意顺序尝试。一旦 Vanya 输入了正确的密码,他将立即被授权访问网站。Vanya 不会重复输入任何密码。
每次尝试输入密码需要 Vanya 一秒。但如果 Vanya 连续输入了 #cf_span[k] 次错误密码,那么他必须等待 #cf_span[5] 秒后才能进行下一次尝试。Vanya 每次一有机会就会立即尝试,即在每个可以输入密码的时刻,他都会进行尝试。
请确定在最佳情况下(Vanya 花费最少时间)和最坏情况下(Vanya 花费最多时间),Vanya 登录 Codehorses 所需的时间(以秒为单位)。
输入的第一行包含两个整数 #cf_span[n] 和 #cf_span[k](#cf_span[1 ≤ n, k ≤ 100])——分别表示 Vanya 的密码数量和导致网站被封锁 #cf_span[5] 秒的连续失败尝试次数。
接下来的 #cf_span[n] 行每行包含一个密码,均为互不相同的非空字符串,由拉丁字母和数字组成,每个密码长度不超过 #cf_span[100] 个字符。
输入的最后一行是 Vanya 的 Codehorses 密码。保证该密码等于他 #cf_span[n] 个密码中的某一个。
请输出两个整数——Vanya 在最佳情况和最坏情况下登录 Codehorses 所需的时间(以秒为单位)。
考虑第一个样例。由于所有密码长度相同,Vanya 可能在第一次尝试就输入正确密码,也可能在最后一次尝试才输入正确密码。如果他在第一次尝试就成功,他花费恰好 #cf_span[1] 秒。因此最佳情况的答案是 #cf_span[1]。如果他在最后一次尝试才成功,那么在此之前他输入了另外 #cf_span[4] 个密码。他花费 #cf_span[2] 秒输入前 #cf_span[2] 个密码,然后由于他已犯了 #cf_span[2] 次错误,必须等待 #cf_span[5] 秒。接着他再花费 #cf_span[2] 秒输入另外 #cf_span[2] 个错误密码,再次等待 #cf_span[5] 秒,最后输入正确的密码,再花费 #cf_span[1] 秒。综上,在最坏情况下他总共花费 #cf_span[15] 秒。
考虑第二个样例。无论如何输入密码,都不会触发网站被封锁。由于目标密码长度为 #cf_span[2],Vanya 必然先输入所有长度为 #cf_span[1] 的密码,花费 #cf_span[2] 秒。在最佳情况下,他紧接着输入正确的密码,总时间为 #cf_span[3] 秒;而在最坏情况下,他先输入一个长度为 #cf_span[2] 的错误密码,再输入正确的密码,总共花费 #cf_span[4] 秒。
## Input
输入的第一行包含两个整数 #cf_span[n] 和 #cf_span[k](#cf_span[1 ≤ n, k ≤ 100])——分别表示 Vanya 的密码数量和导致网站被封锁 #cf_span[5] 秒的连续失败尝试次数。接下来的 #cf_span[n] 行每行包含一个密码,均为互不相同的非空字符串,由拉丁字母和数字组成,每个密码长度不超过 #cf_span[100] 个字符。输入的最后一行是 Vanya 的 Codehorses 密码。保证该密码等于他 #cf_span[n] 个密码中的某一个。
## Output
请输出两个整数——Vanya 在最佳情况和最坏情况下登录 Codehorses 所需的时间(以秒为单位)。
[samples]
## Note
考虑第一个样例。由于所有密码长度相同,Vanya 可能在第一次尝试就输入正确密码,也可能在最后一次尝试才输入正确密码。如果他在第一次尝试就成功,他花费恰好 #cf_span[1] 秒。因此最佳情况的答案是 #cf_span[1]。如果他在最后一次尝试才成功,那么在此之前他输入了另外 #cf_span[4] 个密码。他花费 #cf_span[2] 秒输入前 #cf_span[2] 个密码,然后由于他已犯了 #cf_span[2] 次错误,必须等待 #cf_span[5] 秒。接着他再花费 #cf_span[2] 秒输入另外 #cf_span[2] 个错误密码,再次等待 #cf_span[5] 秒,最后输入正确的密码,再花费 #cf_span[1] 秒。综上,在最坏情况下他总共花费 #cf_span[15] 秒。
考虑第二个样例。无论如何输入密码,都不会触发网站被封锁。由于目标密码长度为 #cf_span[2],Vanya 必然先输入所有长度为 #cf_span[1] 的密码,花费 #cf_span[2] 秒。在最佳情况下,他紧接着输入正确的密码,总时间为 #cf_span[3] 秒;而在最坏情况下,他先输入一个长度为 #cf_span[2] 的错误密码,再输入正确的密码,总共花费 #cf_span[4] 秒。
Let $ n $ be the number of passwords, $ k $ the number of allowed failed attempts before a 5-second cooldown, and $ p^* $ the correct password.
Define:
- $ L $: multiset of password lengths.
- Let $ m = \text{len}(p^*) $.
- Let $ a $: number of passwords with length less than $ m $.
- Let $ b $: number of passwords with length equal to $ m $, excluding $ p^* $ (i.e., wrong passwords of same length as correct one).
Thus, total passwords: $ n = a + b + 1 $.
Vanya enters passwords in non-decreasing order of length; within same length, order is arbitrary.
---
**Best case**:
Correct password is the first one tried among all passwords of length $ m $.
Total attempts: $ a + 1 $ (all shorter passwords, then correct one).
Time calculation:
- Each attempt takes 1 second.
- Cooldowns occur after every $ k $ failed attempts.
- Failed attempts: $ a $ (all shorter passwords).
Number of cooldowns: $ \left\lfloor \frac{a}{k} \right\rfloor $, each adding 5 seconds.
$$
T_{\text{best}} = (a + 1) + 5 \cdot \left\lfloor \frac{a}{k} \right\rfloor
$$
---
**Worst case**:
Correct password is the last one tried among all passwords of length $ m $.
Total attempts: $ a + b + 1 $.
Failed attempts: $ a + b $.
Number of cooldowns: $ \left\lfloor \frac{a + b}{k} \right\rfloor $
$$
T_{\text{worst}} = (a + b + 1) + 5 \cdot \left\lfloor \frac{a + b}{k} \right\rfloor
$$
---
**Final Answer:**
$$
\boxed{
\begin{aligned}
T_{\text{best}} &= (a + 1) + 5 \cdot \left\lfloor \frac{a}{k} \right\rfloor \\
T_{\text{worst}} &= (a + b + 1) + 5 \cdot \left\lfloor \frac{a + b}{k} \right\rfloor
\end{aligned}
}
$$
Where:
- $ a = \#\{ p \mid \text{len}(p) < \text{len}(p^*) \} $
- $ b = \#\{ p \mid \text{len}(p) = \text{len}(p^*) \text{ and } p \ne p^* \} $