# -*- coding: utf-8 -*- def kai(S): cnts = 0 cntf = len(S)-1 while cnts <= cntf : if S[cnts] != S[cntf]: return 0 cnts += 1 cntf -= 1 return 1 S = list(raw_input()) if len(S) == 1: print "".join(S*2) exit() if kai(S): n = len(S) / 2 S.insert(n ,S[n]) print "".join(S) exit() cnts = 0 cntf = len(S)-1 while cnts <= cntf : if S[cnts] != S[cntf]: if S[cnts +1] == S[cntf]: S.insert(cntf+1, S[cnts]) if kai(S): print "".join(S) exit() else: print "NA" exit() elif S[cnts] == S[cntf-1]: S.insert(cnts, S[cntf]) if kai(S): print "".join(S) exit() else: print "NA" exit() else: print "NA" exit() cnts += 1 cntf -= 1