#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return SQR(POW(B, P / 2));
}
template <typename T>
inline T BigMod(T b, T p, T m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    T s = BigMod(b, p / 2, m);
    return ((s % m) * (s % m)) % m;
  }
  return ((b % m) * (BigMod(b, p - 1, m) % m)) % m;
}
template <typename T>
inline T ModInv(T b, T m) {
  return BigMod(b, m - 2, m);
}
template <typename T>
inline T ABS(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
template <typename T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <typename T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
int chp(string s) {
  int p = s.size();
  p--;
  for (int i = 0; i < s.size() / 2; i++) {
    if (s[i] == s[p - i])
      continue;
    else {
      return 1;
    }
  }
  return 0;
}
int main() {
  string ss, t1, t2, sr[11];
  cin >> ss;
  t1 = "";
  for (int i = 0; i < ss.size(); i++) {
    sr[i] = "";
    for (int j = i; j < ss.size(); j++) {
      sr[i] += ss[j];
    }
  }
  for (int i = 0; i < ss.size(); i++) {
    for (char ii = 'a'; ii <= 'z'; ii++) {
      char pp = ii;
      string tt = "", t3, t2 = "";
      tt += t1;
      tt += pp;
      tt += sr[i];
      int cc = chp((tt));
      if (!cc) {
        cout << (tt) << endl;
        return 0;
      }
    }
    t1 += ss[i];
  }
  for (char ii = 'a'; ii <= 'z'; ii++) {
    string tt = "";
    tt += ss;
    tt += ii;
    int cc = chp(tt);
    if (!cc) {
      cout << tt << endl;
      return 0;
    }
  }
  cout << "NA" << endl;
  return 0;
}
