#include <bits/stdc++.h>
using namespace std;
int ispalin(string a) {
  string b = a;
  reverse(b.begin(), b.end());
  return a == b;
}
int main() {
  string str;
  cin >> str;
  int N = str.size();
  for (int i = 0; i <= N; i++) {
    for (char xc = 'a'; xc <= 'z'; xc++) {
      string str1;
      for (int j = 0; j < i; j++) str1 += str[j];
      str1 += xc;
      for (int j = i; j < N; j++) str1 += str[j];
      if (ispalin(str1)) {
        cout << str1;
        return 0;
      }
    }
  }
  cout << "NA";
  return 0;
}
