list_origion =list(map(int,input().split())) len_list =len(list_origion) list_all =[] leaf = int(input()) Leaf_count=leaf for i in range(0,len_list,leaf): if(leaf<=len_list): list_temp=list_origion[i:leaf] list_temp.reverse() list_all=list_all+list_temp list_temp =[] leaf+=Leaf_count else: if(i<len_list): list_temp=list_origion[i:] list_all=list_all+list_temp for i in list_all: print(i,end=' ')