#D10366. Connection and Disconnection
Connection and Disconnection
Connection and Disconnection
Given is a string S. Let T be the concatenation of K copies of S. We can repeatedly perform the following operation: choose a character in T and replace it with a different character. Find the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.
Constraints
- 1 \leq |S| \leq 100
- S consists of lowercase English letters.
- 1 \leq K \leq 10^9
- K is an integer.
Input
Input is given from Standard Input in the following format:
S K
Output
Print the minimum number of operations required.
Examples
Input
issii 2
Output
4
Input
qq 81
Output
81
Input
cooooooooonteeeeeeeeeest 999993333
Output
8999939997
inputFormat
Input
Input is given from Standard Input in the following format:
S K
outputFormat
Output
Print the minimum number of operations required.
Examples
Input
issii 2
Output
4
Input
qq 81
Output
81
Input
cooooooooonteeeeeeeeeest 999993333
Output
8999939997
样例
cooooooooonteeeeeeeeeest
999993333
8999939997