#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int i = 0; i <= s.size(); i++) {
    for (int j = 'a'; j <= 'z'; j++) {
      string S = s, a;
      s.insert(s.begin() + i, char(j));
      for (int m = s.size() - 1; m >= 0; m--) a += s[m];
      if (a == s) {
        cout << s;
        return 0;
      }
      s = S;
    }
  }
  cout << "NA";
}
