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