/* Problem 2--Scatter Point Plot
   This problem was accomplished by building a two-dimensional character
   array of the scatter plot and printing the whole thing out at once.*/

import java.io.*;
import java.util.*;

public class prob2 {

 public static BufferedReader in;
 public static PrintStream out;
 public static StringTokenizer st;
 public static char[][] Screen = BlankScreen (); //all spaces

 public static void main (String[] args) throws Exception {

  in = new BufferedReader (new FileReader ("prob2.in"));
  out = new PrintStream (new FileOutputStream ("prob2.out"));
  st = new StringTokenizer (in.readLine()); //Read input informatoin
  int x = Integer.parseInt (st.nextToken()),
     dx = Integer.parseInt (st.nextToken());
  st = new StringTokenizer (in.readLine());
  int y = Integer.parseInt (st.nextToken()),
     dy = Integer.parseInt (st.nextToken());
  int[][] cts = new int[12][20];
  while (true) { //Read in points
   String s = in.readLine ();
   if (s==null) break;
   st = new StringTokenizer (s,",");
   int x0=Integer.parseInt (st.nextToken()),
       y0=Integer.parseInt (st.nextToken());
   cts[(int)(((x0-x)/(double)dx)+0.5+1e-5)]  //Increment proper location
      [(int)(((y0-y)/(double)dy)+0.5+1e-5)]++;
  }
  for (int r=0; r < 20; r++) { //Put y-values on screen
   Screen[r][4] = ':';
   PlaceNumber (y+dy*(19-r),r,0);
  } //Put bottom row on scrren
  for (int c=4; c<=64; c++) Screen[20][c] = c%5==4?'+':'-';
  for (int c=0; c<12; c++)  //Put x-values on screen
   PlaceNumber (x+dx*c,21,5*(c+2)-4+(length(x+dx*c)-1)/2);
  for (int i=0; i < 12; i++)
   for (int j=0; j < 20; j++)
    if (cts[i][j] > 0) //Put the various plots on the screen
     PlaceNumber (cts[i][j],19-j,5*(i+2)-4+(length(cts[i][j])-1)/2);
  PrintScreen ();
 }

/* BlankScreen creates an entire screen of spaces */
 public static char[][] BlankScreen () {

  char[][] s = new char[22][66];
  for (int i=0; i < 22; i++)
   for (int j=0; j < 66; j++)
    s[i][j] = ' ';
  return s;
 }

/* PlaceNumber puts n in (r,c) in the screen treating leading zeroes
   as blanks. */
 public static void PlaceNumber (int n, int r, int c) throws Exception {


  for (int i=3; i>=0; i--) {
   Screen[r][c+i] = (char)(n%10+'0');
   if ((n/=10)==0) return;
  }
 }

/* length returns the number of digits in the specified integer. */
 public static int length (int n) {

  return (""+n).length();
 }

/* PrintScreen prints the screen to the output file, removing trailing
   spaces. */
 public static void PrintScreen () throws Exception {

  for (int r = 0; r < Screen.length; r++) {
   for (int c = Screen[r].length-1; c>=0; c--)
    if (Screen[r][c]==' ') Screen[r][c] = 0;
    else break;//Replace trailing spaces with nulls
   for (int c = 0; c < Screen[r].length; c++)
    if (Screen[r][c]==0) break; //Print up to the nulls
    else out.print (Screen[r][c]);
   out.println ();
  }
 }
}