#include<stdio.h>
#include<stdlib.h>
typedef struct Node{
    int data;
    struct node *next;
    struct node *prev;
}Node;

void create(int num){
    Node *newnode = (Node*) malloc(1*sizeof(Node*));
    newnode->data = num;
    newnode->next = NULL;
    
    if(head==NULL){
        head = newnode;
        tail = newnode;
    }
        else{
            newnode->prev = tail;
            tail->next = newnode;
            tail = newnode;
        }
    }
void palindrome(){
    Node *i;
    for(i=head;i!=head;i=i->prev){
        printf("%d",i->data);
    }
}
int main(){
    int num, i;
    while(num<0){
        if(!(scanf("%d",&num))){
            printf("Invalid input");
            return 0;
        }
    create(num);
    }
    palindrom();
    return 0;
    
}