#include <bits/stdc++.h>
using namespace std;
bool p(string s) {
  int n = s.length();
  for (int i = 0; i < n / 2; i++) {
    if (s[i] != s[n - i - 1]) return 0;
  }
  return 1;
}
int main() {
  std::ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int n = s.length();
  for (char c = 'a'; c <= 'z'; c++) {
    string tmp = s;
    for (int i = 0; i <= n; i++) {
      tmp.insert(tmp.begin() + i, c);
      if (p(tmp)) {
        cout << tmp << endl;
        return 0;
      }
      tmp = s;
    }
  }
  cout << "NA" << endl;
  return 0;
}
