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));} if (IsPalindrome(s)==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 list) { int n = list.size(); for (int i=0; i