import sys input=lambda: sys.stdin.readline().rstrip() S=input() n=len(S) def chk(T): m=len(T) for i in range(m//2): if T[i]!=T[m-1-i]: return False else: continue else: return True for i in range(n//2): if S[i]==S[n-1-i]: continue else: S1=S[:i]+S[n-1-i]+S[i:] S2=S[:n-i]+S[i]+S[n-i:] if chk(S1): print(S1) elif chk(S2): print(S2) else: print("NA") break else: if n%2: print(S[:n//2]+S[n//2]+S[n//2:]) else: print(S[:n//2]+"a"+S[n//2:])