{"raw_statement":[{"iden":"problem statement","content":"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."},{"iden":"constraints","content":"*   $1 \\leq |S| \\leq 100$\n*   $S$ consists of lowercase English letters.\n*   $1 \\leq K \\leq 10^9$\n*   $K$ is an integer."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$S$\n$K$"},{"iden":"sample input 1","content":"issii\n2"},{"iden":"sample output 1","content":"4\n\n$T$ is `issiiissii`. For example, we can rewrite it into `ispiqisyhi`, and now any two adjacent characters are different."},{"iden":"sample input 2","content":"qq\n81"},{"iden":"sample output 2","content":"81"},{"iden":"sample input 3","content":"cooooooooonteeeeeeeeeest\n999993333"},{"iden":"sample output 3","content":"8999939997"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}