#include <bits/stdc++.h>
using namespace std;
char a[101];
char b[101];
int k;
int func() {
  for (int i = 0; i < k; i++) {
    if (b[i] != b[k - 1 - i]) {
      return 0;
    }
  }
  return 1;
}
int main() {
  while (~scanf("%s", a)) {
    int l = strlen(a);
    int flag = 0;
    for (int i = 0; i <= l; i++) {
      for (int j = 'a'; j <= 'z'; j++) {
        k = 0;
        int i1 = 0;
        while (i1 < i) {
          b[k++] = a[i1];
          i1++;
        }
        b[k++] = j;
        while (i1 < l) {
          b[k++] = a[i1];
          i1++;
        }
        if (func()) {
          for (int m = 0; m < k; m++) {
            printf("%c", b[m]);
          }
          printf("\n");
          flag = 1;
          break;
        }
      }
      if (flag) {
        break;
      }
    }
    if (flag == 0) {
      printf("NA\n");
    }
  }
  return 0;
}
