#include <bits/stdc++.h>
using namespace std;
bool be(string s) {
  string t = s;
  reverse(t.begin(), t.end());
  return s == t;
}
int main() {
  string s;
  cin >> s;
  for (char c = 'a'; c <= 'z'; c++)
    for (int i = 0; i <= s.size(); i++) {
      string t = s;
      string g = "";
      g += c;
      t.insert(i, g);
      if (be(t)) {
        cout << t << "\n";
        return 0;
      }
    }
  cout << "NA\n";
  return 0;
}
