#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int pal(string s) {
  int i = 0, j = s.length() - 1;
  while (i < j) {
    if (s[i] != s[j]) return 0;
    i++;
    j--;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  string str, tp, s;
  cin >> str;
  int l = str.length();
  for (int i = 0; i <= l; i++) {
    s = str.substr(0, i);
    for (int j = 0; j < 26; j++) {
      char ch = 'a' + j;
      tp = s + ch + str.substr(i);
      if (pal(tp)) {
        cout << tp << endl;
        return 0;
      }
    }
  }
  cout << "NA" << endl;
  return 0;
}
