#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    int data;
    struct node*next;
    struct node*prev;
}nd;
nd*head=NULL;
void insert(int num){
    nd*newnode=(nd*)malloc(1*sizeof(nd));
    newnode->data=num;
    if(head==NULL){
        newnode->next=head->next;
        head->next=newnode;
    }
    else{
        newnode->next=head->next;
        head->next=newnode;
    }
}
void display(){
    nd*temp=head->next;
    do{
        printf("%d",temp->data);
        temp=temp->next;
    }
    while(temp!=head->next);

}
int main(){
    int n,num,val;
    scanf("%d",&n);
    if(n<=0){
        printf("Invalid input");
        return 0:
        
    }
    for(int i=0,i<=n;i++){
        scanf("%d",&num);
        insert(num);
    }
    scanf("%d",&val);
    insert(val);
    display();
    return 0;
}