#include <bits/stdc++.h>
using namespace std;
bool judge(char test[]) {
  int len = strlen(test);
  for (int i = 0; i < len / 2; i++) {
    if (test[i] != test[len - 1 - i]) {
      return false;
    }
  }
  return true;
}
int main() {
  char word[20];
  char temp[20];
  while (~scanf("%s", word)) {
    int len = strlen(word);
    bool f = true;
    for (int j = 0; j < 26; j++) {
      for (int i = 0; i <= len; i++) {
        temp[i] = 'a' + j;
        int p = 0;
        for (int k = 0; k < len; k++) {
          if (p == i) {
            p++;
            temp[p++] = word[k];
          } else {
            temp[p++] = word[k];
          }
        }
        temp[len + 1] = '\0';
        if (judge(temp)) {
          printf("%s\n", temp);
          f = false;
          break;
        }
      }
      if (!f) break;
    }
    if (f) {
      printf("NA\n");
    }
  }
  return 0;
}
