#include <bits/stdc++.h>
const long long mod = 1e8 + 7;
const long long eps = 1e-12;
using namespace std;
string s;
bool judge(string sp) {
  for (int i = 0; i <= sp.size() - 1; ++i) {
    if (sp[i] != sp[sp.size() - 1 - i]) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  while (cin >> s) {
    int ok = 0;
    for (int i = 0; i <= s.size(); ++i) {
      string st;
      for (int j = 0; j <= 25; ++j) {
        st.clear();
        st = s.substr(0, i);
        st += j + 'a';
        st += s.substr(i, s.size());
        if (judge(st)) {
          ok = 1;
          cout << st << endl;
          break;
        }
      }
      if (ok) break;
    }
    if (!ok) cout << "NA" << endl;
  }
  return 0;
  return 0;
}
