S = input() L = len(S) def is_palindrome(s): for i in range(len(s) // 2): if s[i] != s[len(s) - 1 - i]: return False return True if is_palindrome(S): print(S[:L // 2] + S[L // 2] + S[L // 2:]) exit() for i in range(L // 2): if S[i] != S[L - 1 - i]: s1 = S[:i] + S[L - 1 - i] + S[i:] s2 = S[:L - i] + S[i] + S[L - i:] if is_palindrome(s1): print(s1) break elif is_palindrome(s2): print(s2) break else: print('NA')