#include <bits/stdc++.h>
using namespace std;
int main() {
  string cad;
  cin >> cad;
  int w = cad.length() - 1;
  string aux;
  bool er = true, sf = false;
  for (int q = 0; q <= cad.length(); q++) {
    aux = " ";
    aux = cad.substr(0, q) + " " + cad.substr(q);
    int s = w + 1;
    er = true;
    for (int a = 0; a < aux.length() / 2; a++) {
      if (aux[a] == ' ') {
        aux[a] = aux[s];
      } else if (aux[s] == ' ') {
        aux[s] = aux[a];
      } else {
        if (aux[a] != aux[s]) {
          er = false;
        }
      }
      s--;
    }
    if (er) {
      cout << aux << endl;
      q = cad.length();
      sf = true;
    }
  }
  if (!sf) {
    cout << "NA" << endl;
  }
  return 0;
}
