
#include <fstream>
#include <vector>
#include <algorithm>

#include <iostream>

#include <stdio.h>

struct SummDescriptor
{
  bool exists;
  int i, j;
};

void resize(std::vector<std::vector<int> >& m, int w, int h)
{
  m.resize(h);
  for (int i = 0; i < h; ++i) m[i].resize(w);
}

int mod(int a, int b)
{
  while (a < 0) a += b;
  return a % b;
}

int main(int argc, char** argv)
{
//  std::fstream input("input.txt", std::ios_base::in);
  FILE* input = fopen("input.txt", "r");

  std::fstream output("output.txt", std::ios_base::out);

  int l, w, h, rs, cs, rf, cf;

//  input >> l >> w >> h;
//  input >> rs >> cs >> rf >> cf;
  fscanf(input, "%d %d %d\n", &l, &w, &h);
  fscanf(input, "%d %d %d %d\n", &rs, &cs, &rf, &cf);

  std::vector<std::vector<int> > ch, cv, lc;

  resize(ch, w, h);
  resize(cv, w, h);
  resize(lc, w, h);
  for (int i = 0; i < h - 1; ++i)
  {
    for (int j = 0; j < w - 1; ++j)
//      input >> ch[i][j] >> cv[i][j];
      fscanf(input, "%d %d", &(ch[i][j]), &(cv[i][j]));
//    input >> cv[i][w - 1];
      fscanf(input, "%d\n", &(cv[i][w - 1]));
  }
  for (int j = 0; j < w - 1; ++j)
//    input >> ch[h - 1][j];
    fscanf(input, "%d", &(ch[h - 1][j]));  

  fclose(input);

  std::cout << "Done input" << std::endl;

  std::vector<SummDescriptor> sums(l);
  std::vector<bool> factorUsed(l);
  sums[0].exists = true;
  factorUsed[0] = true;

  for (int i = 1; i < h; ++i)
    for (int j = 1; j < w; ++j)
    {
      lc[i][j] = lc[i - 1][j] + lc[i][j - 1] - lc[i - 1][j - 1] + ch[i - 1][j - 1] + cv[i - 1][j] - ch[i][j - 1] - cv[i - 1][j - 1];

      if (!factorUsed[mod(lc[i][j], l)])
      {
        for (int k = 0; k < l; ++k)
          if (sums[mod (k, l)].exists)
          {
            int m = mod (k + lc[i][j], l);
            while (!sums[m].exists)
            {
              sums[m].exists = true;
              sums[m].i = i;
              sums[m].j = j;

              m = mod (m + lc[i][j], l);
            }
          }

        factorUsed[mod(lc[i][j], l)] = true;
      }
      
    }

  //for (int i = 0; i < l; ++i)
  //  std::cout << "ind = " << i << " exists = " << sums[i].exists << " i = " << sums[i].i << " j = " << sums[i].j << std::endl;

  int d = 0;
  for (int i = rs; i != rf; i += 2 * (rf > rs) - 1)
    d += cv[i - (rf < rs)][cs] * (2 * (rf > rs) - 1);
  for (int i = cs; i != cf; i += 2 * (cf > cs) - 1)
    d += ch[rf][i - (cf < cs)] * (2 * (cf > cs) - 1);


  std::cout << d << std::endl;

  if (!sums[mod(-d, l)].exists)
  {
    output << "X";
    output.close();
    return 0;
  }

  for (int i = cs; i > 0; --i) output << "W";
  for (int i = rs; i > 0; --i) output << "N";

  while (mod(d, l) != 0)
  {
    int i = sums[mod(-d, l)].i;
    int j = sums[mod(-d, l)].j;

    //std::cout << " d = " << d << " i = " << i << " j = " << j << std::endl;

    for (int j1 = 0; j1 < j; ++j1) output << "E";
    for (int i1 = 0; i1 < i; ++i1) output << "S";
    for (int j1 = j; j1 > 0; --j1) output << "W";
    for (int i1 = i; i1 > 0; --i1) output << "N";

    d += lc[i][j];
  }

  for (int i = 0; i < rs; ++i) output << "S";
  for (int i = 0; i < cs; ++i) output << "E";
  for (int i = rs; i != rf; i += 2 * (rf > rs) - 1) output << ((rf > rs) ? "S" : "N");
  for (int i = cs; i != cf; i += 2 * (cf > cs) - 1) output << ((cf > cs) ? "E" : "W");
 
  return 0;
}
