def is_palindrome(l, r): s_sub = s[l:r+1] return s_sub==s_sub[::-1] s = input() if is_palindrome(0, len(s)-1): if len(s)%2==0: print(s[:len(s)//2]+'a'+s[len(s)//2:]) else: print(s[:len(s)//2]+s[len(s)//2]+s[len(s)//2:]) exit() l, r = 0, len(s)-1 while True: if s[l]==s[r]: l += 1 r -= 1 else: if is_palindrome(l+1, r): print(s[:r+1]+s[l]+s[r+1:]) elif is_palindrome(l, r-1): print(s[:l]+s[r]+s[l:]) else: print('NA') exit()