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