/*-------------------------------------------------------------*/
/* Cut this and save to mirror.c				       */
/* Program by Gregory F. Shay c 1988			*/
#include <stdio.h>
#define MAXN 2048

main()
{
	int i,j,k,flag;
	char dtype;
	float max,sum;
	float xinr[MAXN],xini[MAXN];
	int LOGN,N,size,avenum;
flag = 0;
/* input type of array */
scanf("%c\n",&dtype);
if ((dtype != 'r') && (dtype != 'c'))
	{
  fprintf(stderr,"Incompatible input data file, expect real or complex\n");
	flag = 1;
	}
/* input size of array */
scanf("%d \n",&LOGN);
if ((LOGN<2) || (LOGN>14) )
	{
	flag = 1;
	fprintf(stderr,"Error, size of array, %d, out of range.\n",LOGN);
	}
N = 1 << LOGN;
if (N>MAXN) 
	{
	fprintf(stderr,"Error, maximum size of array is set to %d\n",MAXN);
	flag = 1;
	}
if (flag == 0)
  {
/* Read in one half of the data */
if (dtype == 'r')
	for(i=0;i<=(N/2);i++)
	{
	xini[i] = 0.;
	if (EOF == scanf("%f ",&xinr[i]))
		xinr[i]=0.;
	}
if (dtype == 'c')
	for(i=0;i<=(N/2);i++)
	{
	if (EOF == scanf("%f ",&xinr[i]))
		xinr[i]=0.;
	if (EOF == scanf("%f ",&xini[i]))
		xini[i]=0.;
	}
/* Mirror data */
for(i=1;i<=(N/2)-1;i++)
	{
	xinr[N-i]=xinr[i];
	xini[N-i]= -xini[i];
	}
/* Output data */
printf("%c\n",dtype);
printf("%d\n",LOGN);
for(i=0;i<N;i++)
	{
	printf("%g ",xinr[i]);
	if (dtype == 'c')
		printf("%g ",xini[i]);
	printf("\n");
	}
   } /* end of no error if */
} /* End of main */
