题目描述
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
输入格式
见题面
输出格式
见题面
样例输入
cooooooooonteeeeeeeeeest
999993333
样例输出
8999939997