#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

double conv_x(double x)
{
  return(300.0-x);
}

double conv_y(double y)
{
  return(y);
}


main(int ac, char **av)
{
  int le, let, led, ap0;
  char line[1024];
  char type[10];
  double x1, y1, x2, y2, ap, w, tmp, ex, ey, nx, ny;
  char delim[] = ":,=\r\n";

  printf("[Version]\nPCBE:Version 0.48.4\n[BoardSize]\nX:300\nY:210\nGRID:1\n");
  printf("[LayerDef]\n");

  printf("0:NAME=Aux,COLOR=0,DISP=ON,ACTIV=ON,PRINT=OFF\n");
  printf("1:NAME=Pat1,COLOR=1,DISP=ON,ACTIV=ON,PRINT=ON\n");
  printf("2:NAME=Pat2,COLOR=2,DISP=ON,ACTIV=ON,PRINT=OFF\n");
  printf("3:NAME=Silk1,COLOR=3,DISP=ON,ACTIV=ON,PRINT=OFF\n");
  printf("4:NAME=Silk2,COLOR=4,DISP=ON,ACTIV=ON,PRINT=OFF\n");
  printf("5:NAME=Sol1,COLOR=5,DISP=ON,ACTIV=ON,PRINT=OFF\n");
  printf("6:NAME=Sol2,COLOR=6,DISP=ON,ACTIV=ON,PRINT=OFF\n");
  printf("7:NAME=Outline,COLOR=0,DISP=ON,ACTIV=ON,PRINT=ON\n");
  printf("8:NAME=Hole,COLOR=0,DISP=ON,ACTIV=ON,PRINT=ON\n");
  printf("9:NAME=Base,COLOR=12,DISP=ON,ACTIV=ON,PRINT=OFF\n");

  printf("[PadDef]\n[FlshDef]\n[LineDef]\n255:0.001\n[DrawItems]\n");

  type[4] = '\0';
  while(fgets(line, 1023, stdin) != NULL){
    strncpy(type, line, 4);
    if (strcmp(type, "LAND") == 0 || strcmp(type, "FLSH") == 0){
      strtok(line, delim);
      strtok(NULL, delim);
      x1 = atof(strtok(NULL, delim));
      strtok(NULL, delim);
      y1 = atof(strtok(NULL, delim));
      strtok(NULL, delim);
      le = atoi(strtok(NULL, delim));
      strtok(NULL, delim);
      ap0 = atoi(strtok(NULL, delim));
      printf("%s:X=%.3f,Y=%.3f,LE=%d,AP=%d\n", type, conv_x(x1), conv_y(y1), le, ap0);
    }
    if (strcmp(type, "LINE") == 0){
      strtok(line, delim);
      strtok(NULL, delim);
      x1 = atof(strtok(NULL, delim));
      strtok(NULL, delim);
      y1 = atof(strtok(NULL, delim));
      strtok(NULL, delim);
      x2 = atof(strtok(NULL, delim));
      strtok(NULL, delim);
      y2 = atof(strtok(NULL, delim));
      strtok(NULL, delim);
      le = atoi(strtok(NULL, delim));
      strtok(NULL, delim);
      ap0 = atoi(strtok(NULL, delim));
      printf("%s:XS=%.3f,YS=%.3f,XE=%.3f,YE=%.3f,LE=%d,AP=%d\n",
	     type, conv_x(x1), conv_y(y1), conv_x(x2), conv_y(y2), le, ap0);
    }
  }
  
}
