#include <bits/stdc++.h>
using namespace std;
bool is(string s) {
  int i = 0;
  int j = s.length() - 1;
  while (i <= j) {
    if (s[i] != s[j]) return false;
    i++;
    j--;
  }
  return true;
}
int main() {
  string s;
  cin >> s;
  int i = 0;
  int j = s.length() - 1;
  bool found = false;
  while (i < j) {
    if (s[i] != s[j]) {
      found = true;
      break;
    }
    i++;
    j--;
  }
  if (found) {
    string s2 = s, s3 = s;
    s2.insert(s2.begin() + i, s[j]);
    s3.insert(s3.begin() + j + 1, s[i]);
    if (is(s2))
      cout << s2 << endl;
    else if (is(s3))
      cout << s3 << endl;
    else
      cout << "NA" << endl;
  } else {
    int nn = s.length();
    if (nn % 2 == 0) {
      s.insert(s.begin() + (nn / 2), 'a');
      cout << s << endl;
    } else {
      char c = s[nn / 2];
      s.insert(s.begin() + (nn / 2), c);
      cout << s << endl;
    }
  }
  return 0;
}
