#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, m, n, cnt = 0;
  char s[120], str[120];
  scanf("%s", s);
  n = strlen(s);
  for (i = 0; i <= n; i++) {
    for (j = 'a'; j <= 'z'; j++) {
      cnt = 0;
      for (k = 0; k < i; k++) str[k] = s[k];
      str[i] = j;
      for (k = i + 1; k <= n; k++) str[k] = s[k - 1];
      for (k = 0; k <= n; k++) {
        if (str[k] != str[n - k]) cnt = 1;
      }
      str[n + 1] = 0;
      if (cnt == 0) {
        printf("%s\n", str);
        return 0;
      }
    }
  }
  printf("NA\n");
  return 0;
}
