#include <bits/stdc++.h>
using namespace std;
char str[100];
char temp[100];
bool check(int len) {
  for (int l = 0, r = len - 1; l < r; l++, r--)
    if (temp[l] != temp[r]) return false;
  return true;
}
int main(void) {
  scanf("%s", str);
  int len = strlen(str);
  bool flag = false;
  if (len == 1) {
    printf("%s%s\n", str, str);
    return 0;
  }
  for (int i = 0; i <= len; i++) {
    for (int j = 0; j < i; j++) temp[j] = str[j];
    for (int j = i + 1; j <= len; j++) temp[j] = str[j - 1];
    temp[i] = temp[len - i];
    if (check(len + 1)) {
      flag = true;
      break;
    }
  }
  if (flag)
    printf("%s\n", temp);
  else
    printf("NA\n");
  return 0;
}
