/* Problem 5--Age Maze
   Probably the hardest problem in the contest.  I used a crude version
   of the Bellman-Ford algorithm to solve this one, since that can
   handle negative cycles (which would send the zombie back to the
   womb.) */

import java.io.*;
import java.util.*;

public class prob5 {

 public static Scanner in=null;
 public static PrintWriter out=null;
 public static int cs=1;
 public static IT[][] Maze = null;  //age at each spot in the maze
 public static int[][][] Paths = null; //aging direction

 public static void main (String[] args) throws Exception {

  in = new Scanner (new File ("prob5.in"));
  out = new PrintWriter ("prob5.out");
  int ct = 0;
  while ((ct=in.nextInt())>=0) {
   Paths = new int[10][10][4];
   for (int i=0; i < ct; i++) { //read in and initialize data structures
    int r = in.nextInt(), c = in.nextInt();
    char dir = in.next().charAt(0);
    int wt = in.nextInt();
    switch (dir) {
     case 'N' : Paths[r][c][0] = wt; break;
     case 'S' : Paths[r][c][1] = wt; break;
     case 'W' : Paths[r][c][2] = wt; break;
     case 'E' : Paths[r][c][3] = wt; break;
    }
   }
   int orig = in.nextInt(); //see if negative cycles or zombie deages
   if (Solve() && Maze[9][9].val + orig >= 0)
    out.println ("Case "+(cs++)+
           ":  The zombie's final age is "+(Maze[9][9].val + orig)+".");
   else out.println ("Case "+(cs++)+
           ":  The zombie returns to the womb.");
  }
  in.close();
  out.close();
 }

 /* Solve just gives a direct coding of the Bellman-Ford algorithm.  If,
    after 99 passes, it can STILL find a better path, there must be a
    negative cycle. */
 public static boolean Solve () {

  Maze = new IT[10][10];
  for (int i=0; i < 10; i++)
   for (int j=0; j < 10; j++)
    Maze[i][j] = new IT();
  Maze[0][0].inf=false;
  for (int i=0; i < 100; i++)
   for (int u=0; u < 10; u++)
    for (int v=0; v < 10; v++)
     for (int d=0; d < 4; d++)
      if (Relax (u,v,d) && i==99) return false;
  return true;
 }

 /* Relax just checks to see if the path from i to j improves upon the
    best known path to j */
 public static boolean Relax (int i, int j, int d) {

  switch (d) {
   case 0:
    if (i==0) return false;
    if (adjust (Maze[i][j],Maze[i-1][j],Paths[i][j][d])) {
     Maze[i-1][j].inf = false;
     Maze[i-1][j].val = Maze[i][j].val+Paths[i][j][d];
     return true;
    }
    return false;
   case 1:
    if (i==9) return false;
    if (adjust (Maze[i][j],Maze[i+1][j],Paths[i][j][d])) {
     Maze[i+1][j].inf = false;
     Maze[i+1][j].val = Maze[i][j].val+Paths[i][j][d];
     return true;
    }
    return false;
   case 2:
    if (j==0) return false;
    if (adjust (Maze[i][j],Maze[i][j-1],Paths[i][j][d])) {
     Maze[i][j-1].inf = false;
     Maze[i][j-1].val = Maze[i][j].val+Paths[i][j][d];
     return true;
    }
    return false;
   case 3:
    if (j==9) return false;
    if (adjust (Maze[i][j],Maze[i][j+1],Paths[i][j][d])) {
     Maze[i][j+1].inf = false;
     Maze[i][j+1].val = Maze[i][j].val+Paths[i][j][d];
     return true;
    }
    return false;
  }
  return false;
 }

 /* adjust checks to see if a+e < b, understanding that a or b or both
    might be infinity. */
 public static boolean adjust (IT a, IT b, int e) {

  if (a.inf) return false;
  if (b.inf) return true;
  return a.val + e < b.val;
 }
}

/* IT is a class that handles integers but has a flag to indicate that
   the integer is infinity. */
class IT {

 public boolean inf=true;
 public int val=0;
}
