Mr. Kitayuta has kindly given you a string s consisting of lowercase English letters. You are asked to insert exactly one lowercase English letter into s to make it a palindrome. A palindrome is a string that reads the same forward and backward. For example, "noon", "testset" and "a" are all palindromes, while "test" and "kitayuta" are not.

You can choose any lowercase English letter, and insert it to any position of s, possibly to the beginning or the end of s. You have to insert a letter even if the given string is already a palindrome.

If it is possible to insert one lowercase English letter into s so that the resulting string will be a palindrome, print the string after the insertion. Otherwise, print "NA" (without quotes, case-sensitive). In case there is more than one palindrome that can be obtained, you are allowed to print any of them.


-----Input-----

The only line of the input contains a string s (1 ≤ |s| ≤ 10). Each character in s is a lowercase English letter.


-----Output-----

If it is possible to turn s into a palindrome by inserting one lowercase English letter, print the resulting string in a single line. Otherwise, print "NA" (without quotes, case-sensitive). In case there is more than one solution, any of them will be accepted. 


-----Examples-----
Input
revive

Output
reviver

Input
ee

Output
eye
Input
kitayuta

Output
NA



-----Note-----

For the first sample, insert 'r' to the end of "revive" to obtain a palindrome "reviver".

For the second sample, there is more than one solution. For example, "eve" will also be accepted.

For the third sample, it is not possible to turn "kitayuta" into a palindrome by just inserting one letter.

Difficulty: interview

Starter code:

Solutions:
import sys
s = input().strip()

def isPalin(n):
    if n[::-1] == n:
        return True
    return False

for i in range(len(s)+1):
    for j in "abcdefghijklmnopqrstuvwxyz":
        if isPalin(s[:i] + j + s[i:]):
            print(s[:i] + j + s[i:])
            return

print("NA")


def palindrome(s):
    if list(s) == list(reversed(list(s))):
        return 1
    return 0

s = input()
done = 0
for i in range(0,len(s)+1):
    for j in range(97,123):
        l = s[:i]+chr(j)+s[i:]
        if palindrome(l) == 1 and done == 0:
            print(l)
            done = 1
if done == 0:
    print("NA")


def is_palindrome(s):
    return s == s[::-1]

s = input()
letters = set(s)
found = False
for letter in letters:
    for i in range(len(s)+1):
        temp = s[:i] + letter + s[i:]
        if is_palindrome(temp):
            print(temp)
            found = True
            break
    if found:
        break
if not found:
    print('NA')


def ptest(l):
    m = l[:]
    m.reverse()
    if m == l:
        return True
    return False


a = input()
a = list(a)
lett = set(a)
done = False
for x in range(len(a)+1):
    b = a[:]
    for t in lett:
        c = b[:x] + [t] + b[x:]
        c.reverse()
        if ptest(c):
            done = True
            print(''.join(c))
            break
    if done:
        break
if not(done):
    print("NA")


palindrom = lambda s: s == s[::-1]
printans = lambda l: print(''.join(l))
s = list(input())

for i in range(len(s)+1):
    for letter in 'abcdefghijklmnopqrstvwuxyz':
        tmp = s[:]
        tmp.insert(i,letter)
        if palindrom(tmp):
            printans(tmp)
            return

print('NA')

#input
s=str(input())

#variables
def ispalindrome(s):
	if s==s[::-1]:
		return True
	return False

#main
for i in range(len(s)+1):
	if i<len(s)/2:
		t=s[:i]+s[len(s)-i-1]+s[i:]
	else:
		t=s[:i]+s[len(s)-i]+s[i:]
	if ispalindrome(t):
		print(t)
		quit()

#output
print('NA')

def f(s):
    at = -1
    for i, v in enumerate(s):
        if v == '@':
            at = i
            continue
        if v != s[-i - 1] and s[-i - 1] != '@':
            return False
    s[at] = s[-at - 1]
    return ''.join(s)

s = list(input())
for i in range(len(s) + 1):
    s.insert(i, '@')
    a = f(s)
    if a:
        print(a)
        break
    del s[i]
else:
    print('NA')


def palindrom(s):
    n = len(s)
    for num in range(n):
        if s[num] != s[n - num - 1]:
            return 0
    return 1
s = input()
n = len(s)
words = "abcdefghjklmnpoqrstvwxyziuy"
yes = 0
s1 = ""
for i in range(n+1):
    for j in words:
        if palindrom(s[:i]+j+s[i:]) == 1:
            s1 = s[:i]+j+s[i:]
            yes = 1
            break
    if yes == 1:
        break
if s1 == "":
    print("NA")
else:
    print(s1)


s=input();
lens=len(s);
flag=0;
for i in range(0,lens+1):
    for j in range(ord('a'),ord('z')+1):
        s1=s;
        s1=s[:i]+chr(j)+s[i:];
        s2=s1[::-1];
        if(s1==s2):
            print(s1);
            flag=1;
            break;
    if(flag==1):break;
if(flag==0):print("NA");


s = input()
s1 = s[::-1]
p = False

def try1(a):
    q = s[:a] + s1[a] + s[a::]
    q1 = q[::-1]
    for i in range(a + 1, len(q) // 2):
        if q[i] != q1[i]:
            return False
    return True

def try2(a):
    q = s[:len(s) - a] + s[a] + s[len(s) - a::]
    q1 = q[::-1]
    for i in range(a + 1, len(q) // 2):
        if q[i] != q1[i]:
            return False
    return True

for i in range(len(s) // 2):
    if s[i] != s1[i]:
        if try1(i):
            q = s[:i] + s1[i] + s[i::]
            print(q)
            return
        elif try2(i):
            q = s[:len(s) - i] + s[i] + s[len(s) - i::]
            print(q)
            return
        else:
            p = True
            break
if p:
    print("NA")
else:
    d = s[:len(s) // 2] + s[len(s) // 2] + s[len(s) // 2::]
    print(d)


def ptest(l):
	m = l[:]
	m.reverse()
	if m == l:
		return True
	return False
 
 
a = input()
a = list(a)
lett = set(a)
done = False
for x in range(len(a) + 1):
	b = a[:]
	for t in lett:
		c = b[:x] + [t] + b[x:]
		c.reverse()
		if ptest(c):
			done = True
			print(''.join(c))
			break
	if done:
		break
if not(done):
	print("NA")