#include <bits/stdc++.h>
using namespace std;
bool isp(string a) {
  for (int i = 0; i < a.size() / 2; ++i)
    if (a[i] != a[a.size() - 1 - i]) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); ++i) {
    for (char a = 'a'; a <= 'z'; ++a) {
      string m;
      for (int j = 0; j < i; ++j) m += s[j];
      m += a;
      for (int j = i; j < s.size(); ++j) m += s[j];
      if (isp(m)) {
        cout << m << endl;
        return 0;
      }
    }
  }
  for (char a = 'a'; a <= 'z'; ++a) {
    string m = s;
    m += a;
    if (isp(m)) {
      cout << m << endl;
      return 0;
    }
  }
  cout << "NA" << endl;
}
