#include<stdio.h>
#include<stdlib.h>
struct node {
    int data;
    struct node*next;
};
struct node*createnode(int value) {
    struct node*newnode =(struct node*)malloc(sizeof(struct node));
    newnode->data=value;
    newnode->next =NULL;
    return newnode;
}
struct node *insertAtposition(struct node*head ,int value ,int pos ,int n) {
    if (pos < 1 ||pos >n+1) {
        printf("invalid input.\n");
        return NULL;
    }
    struct node*newnode= createnode(value);
if (pos==1) {
    newnnode-> next=head;
    return newnode;
}
struct node*temp=head;
for(int i=0; i<pos-> 1 &&temp !=NULL; i+=) {
    temp =temp->next;
}
newnode-> next =temp->next;
temp-> next=newnode;
return head;
}
 void printlist(struct node*head) {
     struct node *temp=head;
     while(temp!=NULL) {
         printf("%d", temp->data);
         temp=temp->next;
     }
     printf("\n");
 }
 int main(0 {
     int n ,values,pos;
     scanf("%d", &n);
     struct node*head=NULL;
     struct node*tail=NULL;
     for(int i=0; i<n;i++) {
         int val;
         scanf("%d", &val);
         struct node*newnode=createnode(val);
         if(head==NULL) {
             head=newnode;
             tail=newnode;
         }
         else [
             tail-> next=newnode;
             tail=newnode;
     }
 }
 scanf("%d", &value);
 scanf("%d", &pos);
 struct node*updatehead =insertAtpostion(head,value,pos,n);
 if(updatehead== NULL &&(pos <1 || pos> n+1)) {
     return 0;
 }
 print;ist(updatehead);
 return 0;
 }