import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { List s = split(sc.next()); int n = s.size(); boolean F = false; for (int i=0; i<=n; i++) { if (i<=n/2) {s.add(i,s.get(n-i-1));} else {s.add(i,s.get(n-i));} boolean b = true; for (int j=0; j<(n+1)/2; j++) { if (s.get(j)!=s.get(n-j-1)) {b=false;} } if (b==true) {F=true; break;} s.remove(i); } if (F==false) {System.out.println("NA");} else { StringBuilder ans = new StringBuilder(); for (char c : s) {ans.append(c);} System.out.println(ans.toString()); } } static List split (String s){ List list = new ArrayList<>(); for (int i=0; i