import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { StringBuilder sb = new StringBuilder(sc.next()); StringBuilder ans = new StringBuilder("NA"); if (sb.length()%2==0) { String s = sb.toString(); String str = sb.insert(sb.length()/2,"a").reverse().toString(); sb.setLength(0); sb.append(s); for (int i=0; i<=sb.length(); i++) { sb.insert(i,str.charAt(i)); if (IsPalindrome(sb)==true) {ans=sb; break;} sb.delete(i,i+1); } } else if (sb.length()%2!=0) { String s = sb.toString(); String str = sb.insert(sb.length()/2,sb.charAt(sb.length()/2)).reverse().toString(); sb.setLength(0); sb.append(s); for (int i=0; i<=sb.length(); i++) { sb.insert(i,str.charAt(i)); if (IsPalindrome(sb)==true) {ans=sb; break;} sb.delete(i,i+1); } } System.out.println(ans); } static boolean IsPalindrome (StringBuilder s) { boolean b; StringBuilder sb = new StringBuilder(s); sb.reverse(); b = sb.toString().equals(s.toString())?true:false; return b; } }