import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Writer;
import java.util.List;
import java.io.IOException;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.math.BigInteger;
import java.io.InputStream;
import java.io.*;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author sandeepandey
*/
public class Main {
public static void main
(String[] args
) { OutputWriter out = new OutputWriter(outputStream);
try {
ExtendToPalindrome solver = new ExtendToPalindrome();
//int testCount = Integer.parseInt(in.next());
solver.solve(0, in, out);
}
//out.close();
}
}
class ExtendToPalindrome {
while((input= in.readLine()) != null) {
int lenCount = input.length();
StringHash hashRef = new ConcreteHasher(input);
int longestSuffix = 0;
for(int i = 0;i < lenCount ; i++) {
long fHash = hashRef.hash(i,lenCount-1);
long rHash = hashRef.reverseHash(lenCount-1,i);
if(fHash == rHash) {
longestSuffix = i;
break;
}
}
//out.printLine("Longest Suffix::"+longestSuffix);
String outputString
= input
+ StringUtils.
reverse(input.
substring(0,longestSuffix
)); out.printLine(outputString);
}
}
}
class InputReader {
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
this.stream = stream;
}
public int read() {
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
int c = read();
while (isSpaceChar(c))
c = read();
do {
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
return readString();
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
class OutputWriter {
}
public OutputWriter
(Writer writer
) { }
public void print
(Object...
objects) {
for (int i = 0; i < objects.length; i++) {
if (i != 0)
writer.print(' ');
writer.print(objects[i]);
}
}
public void printLine
(Object...
objects) {
print(objects);
writer.println();
}
public void close() {
writer.close();
}
}
interface StringHash {
public long hash(int from,int to);
public long reverseHash(int from ,int to);
}
class ConcreteHasher extends SimpleStringHash {
public ConcreteHasher
(String input
) { super(input);
}
public long hashFunction(long previousHash, char currentChar, int subtractor, long multiplier) {
return (previousHash * multiplier + currentChar-subtractor);
}
}
class StringUtils {
StringBuilder result = new StringBuilder(sample);
result.reverse();
return result.toString();
}
//----------------------------------------------------------------------
}
abstract class SimpleStringHash extends AbstractStringHash {
private static long[] hashArray = new long[0];
private static long[] baseArray = new long[0];
private static long[] reverseHashArray = new long[0];
private static int length;
public SimpleStringHash(CharSequence input) {
super();
length = input.length();
hashArray = new long[length + 1];
baseArray = new long[length + 1];
reverseHashArray = new long[length + 1];
long tmpHash = 0;
long tmpMul = 1;
for(int i = 0; i < length ; i++) {
baseArray[i] = tmpMul;
tmpMul = tmpMul * DEFAULT_MAULTIPLIER;
}
for(int i = 0; i < length ; i++) {
tmpHash = hashFunction(tmpHash,input.charAt(i),48,DEFAULT_MAULTIPLIER);
hashArray[i] = tmpHash;
}
tmpHash = 0;
for(int i = length-1 ; i >=0 ; i--) {
tmpHash = hashFunction(tmpHash,input.charAt(i),48,DEFAULT_MAULTIPLIER);
reverseHashArray[i] = tmpHash;
}
}
public abstract long hashFunction(long previousHash,char currentChar,int subtractor, long multiplier);
public long hash(int from, int to) {
int windowSize = to-from + 1;
return (hashArray[to]-((from <=0) ? 0 : hashArray[from-1] * baseArray[windowSize]));
}
public long reverseHash(int from, int to) {
int windowSize = from-to + 1;
long hashToReturn = reverseHashArray[to]- ((from == length-1) ? 0 : reverseHashArray[from+1] * baseArray[windowSize]);
return hashToReturn;
}
}
abstract class AbstractStringHash implements StringHash {
protected final long DEFAULT_MAULTIPLIER ;
public AbstractStringHash() {
int randomNumber
= randomBehaviour.
nextInt(Integer.
MAX_VALUE); randomNumber = IntegerUtils.nextPrime(randomNumber);
DEFAULT_MAULTIPLIER = 1000004933;
}
}
class IntegerUtils {
public static int nextPrime(int currentValue) {
while(!(currentNum.isProbablePrime(2))) {
}
return Integer.
valueOf(currentNum
+""); }
}