import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { ArrayList 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 (int i=0; i split (String s){ ArrayList list = new ArrayList<>(); for (int i=0; i list) { int n = list.size(); for (int i=0; i