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()); String ans = "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++) { s = sb.toString(); sb.insert(i,str.charAt(i)); if (IsPalindrome(sb)==true) {ans=sb.toString(); break;} sb.setLength(0); sb.append(s); } } 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++) { s = sb.toString(); sb.insert(i,str.charAt(i)); if (IsPalindrome(sb)==true) {ans=sb.toString(); break;} sb.setLength(0); sb.append(s); } } System.out.println(ans); } static boolean IsPalindrome (StringBuilder s) { boolean b; StringBuilder sb = new StringBuilder(s); sb.reverse(); b = sb.equals(s)?true:false; return b; } }