#include <bits/stdc++.h>
using namespace std;
const signed long long Infinity = 1000000100;
const long double Epsilon = 1e-9;
template <typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  return os << "(" << p.first << "," << p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& V) {
  os << "[";
  for (int(i) = (0); (i) < (int(V.size())); (i)++)
    os << V[i] << ((i == int(V.size()) - 1) ? "" : ",");
  return os << "]";
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& S) {
  os << "(";
  for (__typeof(S.begin()) i = S.begin(); i != S.end(); ++i)
    os << *i << (*i == *S.rbegin() ? "" : ",");
  return os << ")";
}
template <typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& M) {
  os << "{";
  for (__typeof(M.begin()) i = M.begin(); i != M.end(); ++i)
    os << *i << (*i.first == M.rbegin()->first ? "" : ",");
  return os << "}";
}
char first[30];
char T[30];
void check() {
  int n = strlen(T);
  for (int(i) = (0); (i) < (n); (i)++) {
    if (T[i] != T[n - i - 1]) return;
  }
  printf("%s\n", T);
  exit(0);
}
int main() {
  scanf("%s", first);
  int n = strlen(first);
  for (int(i) = (0); (i) <= (n); (i)++) {
    for (int(j) = ('a'); (j) <= ('z'); (j)++) {
      for (int(k) = (0); (k) <= (n); (k)++) {
        if (k < i) T[k] = first[k];
        if (k == i) T[k] = j;
        if (k > i) T[k] = first[k - 1];
      }
      check();
    }
  }
  printf("NA\n");
  return 0;
}
