output_description: Print the minimum number of operations required.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S
      K
attempt: s = [s_i for s_i in input()]
  k = int(input())
  c = a = 0
  s_ = s[0]
  idx = 1
  while idx < len(s):
      if s_ == s[idx]:
          c += 1
      else:
          s_ = s[idx]
          c = 0
      a += c % 2
      idx += 1
  a *= k
  if c != 0 and c % 2 == 0 and s[-1] == s[0]:
      a -= 1
  print(a)
  
problem_description: Statement
  
  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.
samples: [{"input": "issii\n    2", "output": "4\n    \n\nT is `issiiissii`. For example, we can rewrite it into `ispiqisyhi`, and now\nany two adjacent characters are different.\n\n* * *"}, {"input": "qq\n    81", "output": "81\n    \n\n* * *"}, {"input": "cooooooooonteeeeeeeeeest\n    999993333", "output": "8999939997"}]