#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); ++i) {
    char c = s[i];
    for (int j = 0; j < s.size() + 1; ++j) {
      vector<char> v;
      for (int k = 0; k < s.size(); ++k) {
        if (k == j) v.push_back(c);
        v.push_back(s[k]);
      }
      if (j == s.size()) v.push_back(c);
      bool check = 1;
      int n = v.size();
      for (int k = 0; k < v.size(); ++k) {
        if (v[k] != v[n - k - 1]) {
          check = 0;
          break;
        }
      }
      if (check) {
        for (int k = 0; k < v.size(); ++k) cout << v[k];
        cout << endl;
        return 0;
      }
    }
  }
  cout << "NA" << endl;
  return 0;
}
