def check(X): for i in range(len(X)): if X[i]!=X[len(X)-1-i]: return False return True S=input() if check(S)==True: X=S[:len(S)//2]+S[len(S)//2]+S[len(S)//2:] if check(X)==True: print(X) else: print("NA") else: for i in range(len(S)): if S[i]!=S[len(S)-1-i]: X=S[:i]+S[len(S)-1-i]+S[i:] #print(X) if check(X)==True: print(X) exit() X=S[:len(S)-1-i+1]+S[i]+S[len(S)-1-i+1:] #print(X) if check(X)==True: print(X) exit() print("NA") exit()