#include <bits/stdc++.h>
using namespace std;
int main() {
  long long tc = 1;
  while (tc--) {
    string s;
    cin >> s;
    string s2 = s;
    for (long long i = 0; i < 26; i++) {
      for (long long j = 0; j < s.size() + 1; j++) {
        s.insert(s.begin() + j, i + 97);
        string s3 = s;
        reverse(s3.begin(), s3.end());
        if (s3 == s) {
          cout << s << endl;
          return 0;
        }
        s = s2;
      }
    }
    cout << "NA" << endl;
  }
  return 0;
}
