S=gets.chomp I=(0..S.size).find{|i|S[i]!=S[S.size-1-i]} if S==S.reverse puts S.size%2==0 ? S[0,S.size/2]+?a+S[S.size/2..-1] : S[0,S.size/2]+S[S.size/2,1]*2+S[S.size/2+1..-1] else puts [S[0,I]+S[S.size-1-I]+S[I..-1],S[0,S.size-I]+S[I]+S[S.size-I..-1]].find{|e|e==e.reverse}||:NA end