import java.io.*;
import java.util.StringTokenizer;

public class ProblemA {
    public static void main(String[] args) {
        int testMode = 0;
        String testInput = "2 2 2 2\n" +
                "ULD";
        /*-------------------------------------------------------------------------------------------------------*/
        FastReader in = new FastReader(testMode == 0 ? System.in : new ByteArrayInputStream(testInput.getBytes()));
        PrintWriter out = new PrintWriter(System.out);
        new ProblemSolver().solve(in, out);
        out.close();
    }
}

class ProblemSolver {
    int A[][] = new int[501][501];
    int B[] = new int[500 * 500 + 1];

    void solve(FastReader in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        int x = in.nextInt();
        int y = in.nextInt();
        int dx[] = new int[256];
        int dy[] = new int[256];
        dy['L'] = -1;
        dy['R'] = 1;
        dx['U'] = -1;
        dx['D'] = 1;
        int d = 0;
        char s[] = in.nextToken().toCharArray();
        for (int i = 1; i <= n; i++) for (int k = 1; k <= m; k++) A[i][k] = -1;
        for (int i = 0; i < s.length; i++) {
            if (A[x][y] == -1) A[x][y] = d;
            x += dx[s[i]];
            y += dy[s[i]];
            if (x < 1) x = 1;
            if (y < 1) y = 1;
            if (y > m) y = m;
            if (x > n) x = n;
            d++;
        }
        for (int i = 1; i <= n; i++) for (int k = 1; k <= m; k++) B[A[i][k] == -1 ? s.length : A[i][k]]++;
        for (int i = 0; i <= s.length; i++) out.print((i == 0 ? "" : " ") + B[i]);
        out.println();
    }
}

class Pair implements Comparable<Pair> {
    public int a;
    public int b;

    public Pair(int a, int b) {
        this.a = a;
        this.b = b;
    }

    public int compareTo(Pair o) {
        if (this.a < o.a) return -1;
        if (this.a > o.a) return 1;
        if (this.b == o.b) return 0;
        return (int) ((this.b - o.b) / Math.abs(this.b - o.b));
    }
}

class FastReader extends BufferedReader {
    private StringTokenizer st;

    public FastReader(InputStream is) {
        super(new InputStreamReader(is));
    }

    public String nextToken() {
        try {
            while (st == null || !st.hasMoreElements()) {
                st = new StringTokenizer(readLine());
            }
            return st.nextToken();
        } catch (IOException e) {
            return null;
        }
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }

    public int[] nextArrayInt(int size) {
        int[] ret = new int[size];
        for (int i = 0; i < size; i++) {
            ret[i] = nextInt();
        }
        return ret;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.StringTokenizer;

public class A {

	Scanner scanner = new Scanner(System.in);
	BufferedReader cin = new BufferedReader(new InputStreamReader(System.in));
	PrintWriter cout = new PrintWriter(System.out);
	StringTokenizer tok;

	int[][] p;
	int dx[] = {0, 0, -1, 1};
	int dy[] = {-1, 1, 0, 0};

	int n, m;
	int x, y;
	int xn, yn;

	String s;

	HashMap<Character, Integer> step = new HashMap<Character, Integer>();

	private void run() throws IOException {

		n = scanner.nextInt();
		m = scanner.nextInt();

		x = scanner.nextInt();
		y = scanner.nextInt();

		--x;
		--y;

		p = new int[n][m];

		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < m; ++j) {
				p[i][j] = 0;
			}
		}

		p[x][y] = 1;
		s = scanner.next();

		step.put('L', 0);
		step.put('R', 1);
		step.put('U', 2);
		step.put('D', 3);

		cout.print("1 ");
		for (int i = 0; i < s.length(); ++i) {
			xn = x + dx[step.get(s.charAt(i))];
			yn = y + dy[step.get(s.charAt(i))];

			xn = Math.min(n - 1, xn);
			xn = Math.max(0, xn);
			yn = Math.min(m - 1, yn);
			yn = Math.max(0, yn);

			int cnt = 0;

			if (i == s.length() - 1) {
				for (int ii = 0; ii < n; ++ii) {
					for (int jj = 0; jj < m; ++jj) {
						if (ii == xn && jj == yn) {
							continue;
						}
						if (p[ii][jj] == 0) {
							cnt++;
						}
					}
				}
			}
			if (p[xn][yn] == 1) {
				cout.print(cnt);
			} else {
				cout.print(cnt + 1);
			}
			cout.print(" ");
			p[xn][yn] = 1;

			/*for (int ii = 0; ii < n; ++ii) {
				for (int jj = 0; jj < m; ++jj) {
					cout.print(p[ii][jj]);
				}
				cout.println();
			}
			cout.println();*/

			x = xn;
			y = yn;
		}

		scanner.close();
		cin.close();
		cout.close();
	}

	public static void main(String[] args) throws IOException {
		A solution = new A();
		solution.run();
	}
}


import java.io.*;
import java.util.*;
public class ccf335_b {

    static int x;
    static int y;
    public static void main(String[] args) throws Exception
    {
        InputReader in=new InputReader(System.in);
        PrintWriter pw=new PrintWriter(System.out);
         x=in.nextInt();
        y=in.nextInt();
        int x1=in.nextInt();
        int y1=in.nextInt();
        String s=in.readString();
        boolean[][] visited=new boolean[x+1][y+1];
        int totalvisited=1;
        pw.print(1+" ");
        visited[x1][y1]=true;
        for(int i=0;i<s.length()-1;i++)
        {
            if(s.charAt(i)=='U')
            {
                if(isvalid(x1-1,y1) )
                {
                    if(!visited[x1-1][y1])
                    {
                    pw.print(1+" ");
                    }
                    else
                    {
                        pw.print(0+" ");
                    }
                    x1=x1-1;
                }
                else
                {
                    pw.print(0+" ");
                }
            }
            else if(s.charAt(i)=='L')
            {
                if(isvalid(x1,y1-1))
                {
                    if(!visited[x1][y1-1])
                    {
                    pw.print(1+" ");
                    }
                    else
                    {
                        pw.println(0);
                    }
                    y1=y1-1;
                }
                else
                {
                    pw.print(0+" ");
                }
            }
            else if(s.charAt(i)=='D')
            {
                if(isvalid(x1+1,y1))
                {
                    if(!visited[x1+1][y1])
                    {
                    pw.print(1+" ");
                    }
                    else
                    {
                        pw.print(0+" ");
                    }
                    x1=x1+1;
                }
                else
                {
                    pw.print(0+" ");
                }
            }
            else
            {
                if(isvalid(x1,y1+1))
                {
                    if(!visited[x1][y1+1])
                    {
                    pw.print(1+" ");
                    }
                    else
                    {
                        pw.print(0+" ");
                    }
                    y1=y1+1;
                }
                else
                {
                    pw.print(0+" ");
                }
            }
            //System.out.println(x1+" "+y1);
            if(!visited[x1][y1])
            {
                visited[x1][y1]=true;
                totalvisited++;
            }
        }
        int f=s.length()-1;
        if(s.charAt(f)=='U')
        {
            if(isvalid(x1-1,y1) )
            {
                //pw.print(1+" ");
                x1=x1-1;
            }
            else
            {
                //pw.print(0+" ");
            }
        }
        else if(s.charAt(f)=='L')
        {
            if(isvalid(x1,y1-1))
            {
                //pw.print(1+" ");
                y1=y1-1;
            }
            else
            {
                //pw.print(0+" ");
            }
        }
        else if(s.charAt(f)=='D')
        {
            if(isvalid(x1+1,y1))
            {
                //pw.print(1+" ");
                x1=x1+1;
            }
            else
            {
                //pw.print(0+" ");
            }
        }
        else
        {
            if(isvalid(x1,y1+1))
            {
                //pw.print(1+" ");
                y1=y1+1;
            }
            else
            {
                //pw.print(0+" ");
            }
        }
    /*  if(!visited[x1][y1])
        {
            visited[x1][y1]=true;
            totalvisited++;
        }*/
        pw.print(x*y-totalvisited);
    pw.close();
    }
    public static boolean isvalid(int u,int v)
    {
        if(u>=1 && u<=x && v>=1 && v<=y)
        {
            return true;
        }
        return false;
    }

     static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }

            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));

            return res * sgn;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

}


import java.io.*;
import java.util.*;
public class ccf335_b {

    static int x;
    static int y;
    static boolean[][] visited;
    public static void main(String[] args) throws Exception
    {
        InputReader in=new InputReader(System.in);
        PrintWriter pw=new PrintWriter(System.out);
         x=in.nextInt();
        y=in.nextInt();
        int x1=in.nextInt();
        int y1=in.nextInt();
        String s=in.readString();
         visited=new boolean[x+1][y+1];
        int totalvisited=0;
        if(x*y>1 && s.length()>1)
        {
        pw.print(1+" ");
        }
        visited[x1][y1]=true;
        for(int i=0;i<s.length()-1;i++)
        {
            if(s.charAt(i)=='U')
            {
                if(isvalid(x1-1,y1) )
                {
                    if(ispos(x1-1,y1))
                    {
                    pw.print(1+" ");
                    }
                    else
                    {
                        pw.print(0+" ");
                    }
                    x1=x1-1;
                }
                else
                {
                    pw.print(0+" ");
                }
            }
            else if(s.charAt(i)=='L')
            {
                if(isvalid(x1,y1-1))
                {
                    if(ispos(x1,y1-1))
                    {
                    pw.print(1+" ");
                    }
                    else
                    {
                        pw.println(0);
                    }
                    y1=y1-1;
                }
                else
                {
                    pw.print(0+" ");
                }
            }
            else if(s.charAt(i)=='D')
            {
                if(isvalid(x1+1,y1))
                {
                    if(ispos(x1+1,y1))
                    {
                    pw.print(1+" ");
                    }
                    else
                    {
                        pw.print(0+" ");
                    }
                    x1=x1+1;
                }
                else
                {
                    pw.print(0+" ");
                }
            }
            else
            {
                if(isvalid(x1,y1+1))
                {
                    if(ispos(x1,y1+1))
                    {
                    pw.print(1+" ");
                    }
                    else
                    {
                        pw.print(0+" ");
                    }
                    y1=y1+1;
                }
                else
                {
                    pw.print(0+" ");
                }
            }
            //System.out.println(x1+" "+y1);
            if(!visited[x1][y1])
            {
                visited[x1][y1]=true;
                totalvisited++;
            }
        }
        int f=s.length()-1;
        if(s.charAt(f)=='U')
        {
            if(isvalid(x1-1,y1) )
            {
                //pw.print(1+" ");
                x1=x1-1;
            }
            else
            {
                //pw.print(0+" ");
            }
        }
        else if(s.charAt(f)=='L')
        {
            if(isvalid(x1,y1-1))
            {
                //pw.print(1+" ");
                y1=y1-1;
            }
            else
            {
                //pw.print(0+" ");
            }
        }
        else if(s.charAt(f)=='D')
        {
            if(isvalid(x1+1,y1))
            {
                //pw.print(1+" ");
                x1=x1+1;
            }
            else
            {
                //pw.print(0+" ");
            }
        }
        else
        {
            if(isvalid(x1,y1+1))
            {
                //pw.print(1+" ");
                y1=y1+1;
            }
            else
            {
                //pw.print(0+" ");
            }
        }
        if(!visited[x1][y1])
        {
            visited[x1][y1]=true;
            totalvisited++;
        }
        pw.print(x*y-totalvisited);
    pw.close();
    }
    public static boolean ispos(int x,int y)
    {
        if(isvalid(x+1,y) && !visited[x+1][y])
        {
            return true;
        }
        if(isvalid(x-1,y) && !visited[x-1][y])
        {
            return true;
        }
        if(isvalid(x,y-1) && !visited[x][y-1])
        {
            return true;
        }
        if(isvalid(x,y+1) && !visited[x][y+1])
        {
            return true;
        }
        return false;
    }
    public static boolean isvalid(int u,int v)
    {
        if(u>=1 && u<=x && v>=1 && v<=y)
        {
            return true;
        }
        return false;
    }

     static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }

            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));

            return res * sgn;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

}


import java.io.*;
import java.util.*;
public class ccf335_b {

    static int x;
    static int y;
    public static void main(String[] args) throws Exception
    {
        InputReader in=new InputReader(System.in);
        PrintWriter pw=new PrintWriter(System.out);
         x=in.nextInt();
        y=in.nextInt();
        int x1=in.nextInt();
        int y1=in.nextInt();
        String s=in.readString();
        boolean[][] visited=new boolean[x+1][y+1];
        int totalvisited=0;
        pw.print(1+" ");
        for(int i=0;i<s.length()-1;i++)
        {
            if(s.charAt(i)=='U')
            {
                if(isvalid(x1-1,y1) )
                {
                    pw.print(1+" ");
                    x1=x1-1;
                }
                else
                {
                    pw.print(0+" ");
                }
            }
            else if(s.charAt(i)=='L')
            {
                if(isvalid(x1,y1-1))
                {
                    pw.print(1+" ");
                    y1=y1-1;
                }
                else
                {
                    pw.print(0+" ");
                }
            }
            else if(s.charAt(i)=='D')
            {
                if(isvalid(x1+1,y1))
                {
                    pw.print(1+" ");
                    x1=x1+1;
                }
                else
                {
                    pw.print(0+" ");
                }
            }
            else
            {
                if(isvalid(x1,y1+1))
                {
                    pw.print(1+" ");
                    y1=y1+1;
                }
                else
                {
                    pw.print(0+" ");
                }
            }
            //System.out.println(x1+" "+y1);
            if(!visited[x1][y1])
            {
                visited[x1][y1]=true;
                totalvisited++;
            }
        }
        int f=s.length()-1;
        if(s.charAt(f)=='U')
        {
            if(isvalid(x1-1,y1) )
            {
                //pw.print(1+" ");
                x1=x1-1;
            }
            else
            {
                //pw.print(0+" ");
            }
        }
        else if(s.charAt(f)=='L')
        {
            if(isvalid(x1,y1-1))
            {
                //pw.print(1+" ");
                y1=y1-1;
            }
            else
            {
                //pw.print(0+" ");
            }
        }
        else if(s.charAt(f)=='D')
        {
            if(isvalid(x1+1,y1))
            {
                //pw.print(1+" ");
                x1=x1+1;
            }
            else
            {
                //pw.print(0+" ");
            }
        }
        else
        {
            if(isvalid(x1,y1+1))
            {
                //pw.print(1+" ");
                y1=y1+1;
            }
            else
            {
                //pw.print(0+" ");
            }
        }
        if(!visited[x1][y1])
        {
            visited[x1][y1]=true;
            totalvisited++;
        }
        pw.print(x*y-totalvisited);
    pw.close();
    }
    public static boolean isvalid(int u,int v)
    {
        if(u>=1 && u<=x && v>=1 && v<=y)
        {
            return true;
        }
        return false;
    }

     static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }

            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));

            return res * sgn;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

}


import java.io.*;
import java.util.*;
public class ccf335_b {

	static int x;
	static int y;
	public static void main(String[] args) throws Exception
	{
		InputReader in=new InputReader(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		 x=in.nextInt();
		y=in.nextInt();
		int x1=in.nextInt();
		int y1=in.nextInt();
		String s=in.readString();
		boolean[][] visited=new boolean[x+1][y+1];
		int totalvisited=0;
		pw.print(1+" ");
		for(int i=0;i<s.length()-1;i++)
		{
			if(s.charAt(i)=='U')
			{
				if(isvalid(x1-1,y1) )
				{
					if(!visited[x1-1][y1])
					{
					pw.print(1+" ");
					}
					else
					{
						pw.print(0+" ");
					}
					x1=x1-1;
				}
				else
				{
					pw.print(0+" ");
				}
			}
			else if(s.charAt(i)=='L')
			{
				if(isvalid(x1,y1-1))
				{
					if(!visited[x1][y1-1])
					{
					pw.print(1+" ");
					}
					else
					{
						pw.println(0);
					}
					y1=y1-1;
				}
				else
				{
					pw.print(0+" ");
				}
			}
			else if(s.charAt(i)=='D')
			{
				if(isvalid(x1+1,y1))
				{
					if(!visited[x1+1][y1])
					{
					pw.print(1+" ");
					}
					else
					{
						pw.print(0+" ");
					}
					x1=x1+1;
				}
				else
				{
					pw.print(0+" ");
				}
			}
			else
			{
				if(isvalid(x1,y1+1))
				{
					if(!visited[x1][y1+1])
					{
					pw.print(1+" ");
					}
					else
					{
						pw.print(0+" ");
					}
					y1=y1+1;
				}
				else
				{
					pw.print(0+" ");
				}
			}
			//System.out.println(x1+" "+y1);
			if(!visited[x1][y1])
			{
				visited[x1][y1]=true;
				totalvisited++;
			}
		}
		int f=s.length()-1;
		if(s.charAt(f)=='U')
		{
			if(isvalid(x1-1,y1) )
			{
				//pw.print(1+" ");
				x1=x1-1;
			}
			else
			{
				//pw.print(0+" ");
			}
		}
		else if(s.charAt(f)=='L')
		{
			if(isvalid(x1,y1-1))
			{
				//pw.print(1+" ");
				y1=y1-1;
			}
			else
			{
				//pw.print(0+" ");
			}
		}
		else if(s.charAt(f)=='D')
		{
			if(isvalid(x1+1,y1))
			{
				//pw.print(1+" ");
				x1=x1+1;
			}
			else
			{
				//pw.print(0+" ");
			}
		}
		else
		{
			if(isvalid(x1,y1+1))
			{
				//pw.print(1+" ");
				y1=y1+1;
			}
			else
			{
				//pw.print(0+" ");
			}
		}
		if(!visited[x1][y1])
		{
			visited[x1][y1]=true;
			totalvisited++;
		}
		pw.print(x*y-totalvisited);
	pw.close();
	}
	public static boolean isvalid(int u,int v)
	{
		if(u>=1 && u<=x && v>=1 && v<=y)
		{
			return true;
		}
		return false;
	}

	 static class InputReader {

		private InputStream stream;
		private byte[] buf = new byte[8192];
		private int curChar;
		private int snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}

			int res = 0;

			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}

			long res = 0;

			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));

			return res * sgn;
		}

		public String readString() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

}


import java.io.*;
import java.util.*;

public class B {
	InputStream is;

	int __t__ = 1;
	int __f__ = 0;
	int __FILE_DEBUG_FLAG__ = __f__;
	String __DEBUG_FILE_NAME__ = "src/T";

	FastScanner in;
	PrintWriter out;

	int[] vx = {1, 0, -1, 0};
	int[] vy = {0, 1, 0, -1};
	char[] cc = {'D', 'R', 'U', 'L'};

	public void solve() {
		int x = in.nextInt(), y = in.nextInt();
		int x0 = in.nextInt() - 1, y0 = in.nextInt() - 1;
		String s = in.next();

		boolean[][] vis = new boolean[y][x];

		ArrayList<Integer> res = new ArrayList<>();

		int nowX = x0, nowY = y0;
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			int idx = 0;
			for (int j = 0; j < 4; j++) {
				if (cc[j] == c) {
					idx = j;
					break;
				}
			}
			nowX += vx[idx];
			nowY += vy[idx];
			nowX = Math.max(nowX, 0);
			nowX = Math.min(nowX, x - 1);
			nowY = Math.max(nowY, 0);
			nowY = Math.min(nowY, y - 1);
			if (vis[nowY][nowX]) {
				res.add(0);
			} else {
				res.add(1);
			}
			vis[nowY][nowX] = true;
		}

		int cnt = x * y;
		for (int i = 0; i < y; i++) {
			for (int j = 0; j < x; j++) {
				if (vis[i][j]) {
					cnt--;
				}
			}
		}
		res.add(cnt);
		for (int i = 0; i <= s.length(); i++) {
			out.print(res.get(i) + " ");
		}
		out.println();
		out.close();
	}

	public void run() {
		if (__FILE_DEBUG_FLAG__ == __t__) {
			try {
				is = new FileInputStream(__DEBUG_FILE_NAME__);
			} catch (FileNotFoundException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
			System.out.println("FILE_INPUT!");
		} else {
			is = System.in;
		}
		in = new FastScanner(is);
		out = new PrintWriter(System.out);

		solve();
	}

	public static void main(String[] args) {
		new B().run();
	}

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}

		System.out.println("----------------------------");
		System.out.println();
	}

	public void debug(Object... obj) {
		System.out.println(Arrays.deepToString(obj));
	}

	class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
			//stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] nextIntArray(int n) {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();

			return array;
		}

		int[][] nextIntMap(int n, int m) {
			int[][] map = new int[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextIntArray(m);
			}
			return map;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();

			return array;
		}

		long[][] nextLongMap(int n, int m) {
			long[][] map = new long[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextLongArray(m);
			}
			return map;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		double[] nextDoubleArray(int n) {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();

			return array;
		}

		double[][] nextDoubleMap(int n, int m) {
			double[][] map = new double[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextDoubleArray(m);
			}
			return map;
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String[] nextStringArray(int n) {
			String[] array = new String[n];
			for (int i = 0; i < n; i++)
				array[i] = next();

			return array;
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}


import java.io.*;
import java.util.*;

public class B {
	InputStream is;

	int __t__ = 1;
	int __f__ = 0;
	int __FILE_DEBUG_FLAG__ = __f__;
	String __DEBUG_FILE_NAME__ = "src/T";

	FastScanner in;
	PrintWriter out;

	int[] vx = {1, 0, -1, 0};
	int[] vy = {0, 1, 0, -1};
	char[] cc = {'D', 'R', 'U', 'L'};

	public void solve() {
		int x = in.nextInt(), y = in.nextInt();
		int x0 = in.nextInt() - 1, y0 = in.nextInt() - 1;
		String s = in.next();

		boolean[][] vis = new boolean[y][x];

		ArrayList<Integer> res = new ArrayList<>();
		res.add(1);
		vis[y0][x0] = true;

		int nowX = x0, nowY = y0;
		for (int i = 0; i < s.length() - 1; i++) {
			char c = s.charAt(i);
			int idx = 0;
			for (int j = 0; j < 4; j++) {
				if (cc[j] == c) {
					idx = j;
					break;
				}
			}
			nowX += vx[idx];
			nowY += vy[idx];
			nowX = Math.max(nowX, 0);
			nowX = Math.min(nowX, x - 1);
			nowY = Math.max(nowY, 0);
			nowY = Math.min(nowY, y - 1);
			if (vis[nowY][nowX]) {
				res.add(0);
			} else {
				res.add(1);
			}
			vis[nowY][nowX] = true;
		}

		int cnt = x * y;
		for (int i = 0; i < y; i++) {
			for (int j = 0; j < x; j++) {
				if (vis[i][j]) {
					cnt--;
				}
			}
		}
		res.add(cnt);
		for (int i = 0; i <= s.length(); i++) {
			out.print(res.get(i) + " ");
		}
		out.println();
		out.close();
	}

	public void run() {
		if (__FILE_DEBUG_FLAG__ == __t__) {
			try {
				is = new FileInputStream(__DEBUG_FILE_NAME__);
			} catch (FileNotFoundException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
			System.out.println("FILE_INPUT!");
		} else {
			is = System.in;
		}
		in = new FastScanner(is);
		out = new PrintWriter(System.out);

		solve();
	}

	public static void main(String[] args) {
		new B().run();
	}

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}

		System.out.println("----------------------------");
		System.out.println();
	}

	public void debug(Object... obj) {
		System.out.println(Arrays.deepToString(obj));
	}

	class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
			//stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] nextIntArray(int n) {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();

			return array;
		}

		int[][] nextIntMap(int n, int m) {
			int[][] map = new int[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextIntArray(m);
			}
			return map;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();

			return array;
		}

		long[][] nextLongMap(int n, int m) {
			long[][] map = new long[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextLongArray(m);
			}
			return map;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		double[] nextDoubleArray(int n) {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();

			return array;
		}

		double[][] nextDoubleMap(int n, int m) {
			double[][] map = new double[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextDoubleArray(m);
			}
			return map;
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String[] nextStringArray(int n) {
			String[] array = new String[n];
			for (int i = 0; i < n; i++)
				array[i] = next();

			return array;
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}


import java.util.*;
import java.io.*;
import java.lang.*;
public class contest1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		MyScanner s=new MyScanner();
		int row=s.nextInt();
		int col=s.nextInt();
		int x=s.nextInt()-1;
		int y=s.nextInt()-1;
		int[][] a=new int[row][col];
		String str=s.next();
		StringBuilder out = new StringBuilder("");
		int b=0;
		if((x<row&&x>=0)&&(y<col&&y>=0)){
			out.append("1 ");
			b++;
		}
		else
			out.append("0 ");
		a[x][y]=1;
		int i;
		for( i=0;i<str.length()-1;i++){
			char c=str.charAt(i);
			switch(c){
			case 'U': if(x-1>=0){
				x=x-1;
				if(a[x][y]==1)
					out.append("0 ");
				else{
					out.append("1 ");
					b++;
					a[x][y]=1;
				}
			}
			else out.append("0 ");
			break;
			case 'L': if(y-1>=0){
				y=y-1;
				if(a[x][y]==1)
					out.append("0 ");
				else{
					out.append("1 ");
					b++;
					a[x][y]=1;
					}
			}
			else out.append("0 ");
			break;
			case 'D': if(x+1<row){
				x=x+1;
				if(a[x][y]==1)
					out.append("0 ");
				else{
					b++;
					out.append("1 ");
					a[x][y]=1;
				}
			}
			else out.append("0 ");
			break;
			case 'R': if(y+1<col){
				y=y+1;
				if(a[x][y]==1)
					out.append("0 ");
				else{
					out.append("1 ");
					b++;
					a[x][y]=1;
				}
			}
			else out.append("0 ");
			break;
			}
		}
		int m=row*col-b;
		out.append(Integer.toString(m));
		System.out.println(out);
	}

}

 class MyScanner {
      BufferedReader br;
      StringTokenizer st;

      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }

      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt() {
          return Integer.parseInt(next());
      }

      long nextLong() {
          return Long.parseLong(next());
      }

      double nextDouble() {
          return Double.parseDouble(next());
      }

      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }


import java.util.*;
import java.io.*;
import java.lang.*;
public class contest1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		MyScanner s=new MyScanner();
		int row=s.nextInt();
		int col=s.nextInt();
		int x=s.nextInt()-1;
		int y=s.nextInt()-1;
		int[][] a=new int[row][col];
		String str=s.next();
		StringBuilder out = new StringBuilder("1");
		int b=0;
		if((x<row&&x>=0)&&(y<col&&y>=0)){
			out.append("1 ");
			b++;
		}
		else
			out.append("0 ");
		a[x][y]=1;
		int i;
		for( i=0;i<str.length()-1;i++){
			char c=str.charAt(i);
			switch(c){
			case 'U': if(x-1>=0){
				x=x-1;
				if(a[x][y]==1)
					out.append("0 ");
				else{
					out.append("1 ");
					b++;
					a[x][y]=1;
				}
			}
			else out.append("0 ");
			break;
			case 'L': if(y-1>=0){
				y=y-1;
				if(a[x][y]==1)
					out.append("0 ");
				else{
					out.append("1 ");
					b++;
					a[x][y]=1;
					}
			}
			else out.append("0 ");
			break;
			case 'D': if(x+1<row){
				x=x+1;
				if(a[x][y]==1)
					out.append("0 ");
				else{
					b++;
					out.append("1 ");
					a[x][y]=1;
				}
			}
			else out.append("0 ");
			break;
			case 'R': if(y+1<col){
				y=y+1;
				if(a[x][y]==1)
					out.append("0 ");
				else{
					out.append("1 ");
					b++;
					a[x][y]=1;
				}
			}
			else out.append("0 ");
			break;
			}
		}
		int m=row*col-b;
		out.append(Integer.toString(m));
		System.out.println(out);
	}

}

 class MyScanner {
      BufferedReader br;
      StringTokenizer st;

      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }

      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt() {
          return Integer.parseInt(next());
      }

      long nextLong() {
          return Long.parseLong(next());
      }

      double nextDouble() {
          return Double.parseDouble(next());
      }

      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }


import java.util.*;
import java.io.*;
import java.lang.*;
public class contest1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		MyScanner s=new MyScanner();
		int row=s.nextInt();
		int col=s.nextInt();
		int x=s.nextInt()-1;
		int y=s.nextInt()-1;
		int[][] a=new int[row][col];
		String str=s.next();
		String out="";
		int b=0;
		if((x<row&&x>=0)&&(y<col&&y>=0)){
			out=out+"1 ";
			b++;
		}
		else
			out=out+"0 ";
		a[x][y]=1;
		int i;
		for( i=0;i<str.length()-1;i++){
			char c=str.charAt(i);
			switch(c){
			case 'U': if(x-1>=0){
				x=x-1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					out=out+"1 ";
					b++;
					a[x][y]=1;
				}
			}
			else out=out+"0 ";
			break;
			case 'L': if(y-1>=0){
				y=y-1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					out=out+"1 ";
					b++;
					a[x][y]=1;
					}
			}
			else out=out+"0 ";
			break;
			case 'D': if(x+1<row){
				x=x+1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					b++;
					out=out+"1 ";
					a[x][y]=1;
				}
			}
			else out=out+"0 ";
			break;
			case 'R': if(y+1<col){
				y=y+1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					out=out+"1 ";
					b++;
					a[x][y]=1;
				}
			}
			else out=out+"0 ";
			break;
			}
		}
		int m=row*col-b;
		out=out+Integer.toString(m);
		System.out.println(out);
	}

}

 class MyScanner {
      BufferedReader br;
      StringTokenizer st;

      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }

      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt() {
          return Integer.parseInt(next());
      }

      long nextLong() {
          return Long.parseLong(next());
      }

      double nextDouble() {
          return Double.parseDouble(next());
      }

      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }


import java.util.*;

public class contest1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int row=s.nextInt();
		int col=s.nextInt();
		int x=s.nextInt()-1;
		int y=s.nextInt()-1;
		int[][] a=new int[row][col];
		String str=s.next();
		String out="";
		int b=0;
		if((x<row&&x>=0)&&(y<col&&y>=0)){
			out=out+"1 ";
			b++;
		}
		else
			out=out+"0 ";
		a[x][y]=1;
		int i;
		for( i=0;i<str.length()-1;i++){
			char c=str.charAt(i);
			switch(c){
			case 'U': if(x-1>=0){
				x=x-1;
				out=out+"1 ";
				b++;
				}

			else out=out+"0 ";
			break;
			case 'L': if(y-1>=0){
				y=y-1;
				out=out+"1 ";
				b++;
					}
			else out=out+"0 ";
			break;
			case 'D': if(x+1<row){
				x=x+1;
				b++;
				out=out+"1 ";
				}

			else out=out+"0 ";
			break;
			case 'R': if(y+1<col){
				y=y+1;
				out=out+"1 ";
				b++;
				}

			else out=out+"0 ";
			break;
			}
		}
		int m=row*col-b;
		out=out+Integer.toString(m);
		System.out.println(out);
	}
}


import java.util.*;

public class contest1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int row=s.nextInt();
		int col=s.nextInt();
		int x=s.nextInt()-1;
		int y=s.nextInt()-1;
		int[][] a=new int[row][col];
		String str=s.next();
		String out="";
		int b=0;
		if((x<row&&x>=0)&&(y<col&&y>=0)){
			out=out+"1 ";
			b++;
		}
		else
			out=out+"0 ";
		a[x][y]=1;
		int i;
		for( i=0;i<str.length()-1;i++){
			char c=str.charAt(i);
			switch(c){
			case 'U': if(x-1>=0){
				x=x-1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					out=out+"1 ";
					b++;
				}
			}
			else out=out+"0 ";
			break;
			case 'L': if(y-1>=0){
				y=y-1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					out=out+"1 ";
					b++;
					}
			}
			else out=out+"0 ";
			break;
			case 'D': if(x+1<row){
				x=x+1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					b++;
					out=out+"1 ";
				}
			}
			else out=out+"0 ";
			break;
			case 'R': if(y+1<col){
				y=y+1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					out=out+"1 ";
					b++;
				}
			}
			else out=out+"0 ";
			break;
			}
		}
		int m=row*col-b;
		out=out+Integer.toString(m);
		System.out.println(out);
	}
}


import java.util.*;

public class contest1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		MyScanner s=new MyScanner();
		int row=s.nextInt();
		int col=s.nextInt();
		int x=s.nextInt()-1;
		int y=s.nextInt()-1;
		int[][] a=new int[row][col];
		String str=s.next();
		String out="";
		int b=0;
		if((x<row&&x>=0)&&(y<col&&y>=0)){
			out=out+"1 ";
			b++;
		}
		else
			out=out+"0 ";
		a[x][y]=1;
		int i;
		for( i=0;i<str.length()-1;i++){
			char c=str.charAt(i);
			switch(c){
			case 'U': if(x-1>=0){
				x=x-1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					out=out+"1 ";
					b++;
					a[x][y]=1;
				}
			}
			else out=out+"0 ";
			break;
			case 'L': if(y-1>=0){
				y=y-1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					out=out+"1 ";
					b++;
					a[x][y]=1;
					}
			}
			else out=out+"0 ";
			break;
			case 'D': if(x+1<row){
				x=x+1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					b++;
					out=out+"1 ";
					a[x][y]=1;
				}
			}
			else out=out+"0 ";
			break;
			case 'R': if(y+1<col){
				y=y+1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					out=out+"1 ";
					b++;
					a[x][y]=1;
				}
			}
			else out=out+"0 ";
			break;
			}
		}
		int m=row*col-b;
		out=out+Integer.toString(m);
		System.out.println(out);
	}

}

public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }

      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt() {
          return Integer.parseInt(next());
      }

      long nextLong() {
          return Long.parseLong(next());
      }

      double nextDouble() {
          return Double.parseDouble(next());
      }

      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }


import java.util.*;

public class contest1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int row=s.nextInt();
		int col=s.nextInt();
		int x=s.nextInt()-1;
		int y=s.nextInt()-1;
		int[][] a=new int[row][col];
		String str=s.next();
		String out="";
		int b=0;
		if((x<row&&x>=0)&&(y<col&&y>=0)){
			out=out+"1 ";
			b++;
		}
		else
			out=out+"0 ";
		a[x][y]=1;
		int i;
		for( i=0;i<str.length()-1;i++){
			char c=str.charAt(i);
			switch(c){
			case 'U': if(x-1>=0){
				x=x-1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					out=out+"1 ";
					b++;
					a[x][y]=1;
				}
			}
			else out=out+"0 ";
			break;
			case 'L': if(y-1>=0){
				y=y-1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					out=out+"1 ";
					b++;
					a[x][y]=1;
					}
			}
			else out=out+"0 ";
			break;
			case 'D': if(x+1<row){
				x=x+1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					b++;
					out=out+"1 ";
					a[x][y]=1;
				}
			}
			else out=out+"0 ";
			break;
			case 'R': if(y+1<col){
				y=y+1;
				if(a[x][y]==1)
					out=out+"0 ";
				else{
					out=out+"1 ";
					b++;
					a[x][y]=1;
				}
			}
			else out=out+"0 ";
			break;
			}
		}
		int m=row*col-b;
		out=out+Integer.toString(m);
		System.out.println(out);
	}
}


import java.util.Scanner;

public class TestingRobots {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int x = scan.nextInt();
		int y = scan.nextInt();

		int[][] field = new int[x][y];

		int i = scan.nextInt()-1;
		int j = scan.nextInt()-1;
		scan.nextLine();
		String s = scan.nextLine();

		int n = 0;

		for(int k = 0; k < s.length(); k++) {
			if(field[i][j]==0) {
				System.out.print("1 ");
				n++;
			}
			else
				System.out.print("0 ");
			field[i][j] = 1;
			char c = s.charAt(k);
			if(c=='U') {
				if(i>0)
					i--;
			} else if (c=='D') {
				if(i<x-1)
					i++;
			} else if(c=='L') {
				if(j>0)
					j--;
			} else if (c=='R') {
				if(j<y-1)
					j++;
			}
		}

		System.out.println(x*y-n);

		scan.close();

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static int MOD = 1000 * 1000 * 1000 + 7;

	public static void main(String[] args) {

		InputStream inputStream = System.in;

		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		solve(in, out);
		out.close();
		System.exit(0);
	}

	private static void solve(InputReader in, PrintWriter out) {

		int[][] dir = new int['Z' + 1][2];

		dir['U'][0] = -1;
		dir['U'][1] = 0;
		dir['D'][0] = 1;
		dir['D'][1] = 0;
		dir['L'][0] = 0;
		dir['L'][1] = -1;
		dir['R'][0] = 0;
		dir['R'][1] = 1;

		int x = in.nextInt();
		int y = in.nextInt();
		int x0 = in.nextInt();
		int y0 = in.nextInt();
		char[] s = in.next().toCharArray();
		int[][] tab = new int[x + 1][y + 1];
		boolean[] visitedBefore = new boolean[s.length + 1];
		int[] dist = new int[s.length + 1];
		tab[x0][y0] = 1;
		int time = 1;

		dist[0] = 1;
		int distance = 0;

		for (char c : s) {
			int dx = x0 + dir[c][0];
			int dy = y0 + dir[c][1];
			if (dx >= 1 && dx <= x) {
				x0 = dx;
			}
			if (dy >= 1 && dy <= y) {
				y0 = dy;
			}

			if (tab[x0][y0] == 1) {
				visitedBefore[time] = true;
			} else {
				distance++;
			}

			dist[time] = distance;
			tab[x0][y0] = 1;
			time++;
		}

		for (int i = 0; i < visitedBefore.length; i++) {
			if (i != s.length) {
				out.print((visitedBefore[i] ? 0 : 1) + " ");
				continue;
			}

			if (!visitedBefore[i]) {
				out.print((x * y - dist[i]) + " ");
			} else {
				out.print((x * y - dist[i] - 1) + " ");
			}

		}

	}

	/*
	 *
	 */
	// --------------------------------------------------------
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String nextLine() {
			String str = "";
			try {
				str = reader.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}

			return str;
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static int MOD = 1000 * 1000 * 1000 + 7;

	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		solve(in, out);
		out.close();
		System.exit(0);
	}

	private static void solve(InputReader in, PrintWriter out) {
		int[][] dir = new int['Z' + 1][2];
		dir['U'][0] = -1;
		dir['U'][1] = 0;
		dir['D'][0] = 1;
		dir['D'][1] = 0;
		dir['L'][0] = 0;
		dir['L'][1] = -1;
		dir['R'][0] = 0;
		dir['R'][1] = 1;

		int x = in.nextInt(), y = in.nextInt(), a = in.nextInt(), b = in.nextInt();
		boolean[][] visited = new boolean[x + 1][y + 1];
		char[] s = in.next().toCharArray();
		int[] res = new int[s.length + 1];
		res[0] = 1;
		visited[a][b] = true;
		for (int i = 0; i < s.length; i++) {
			int dx = a + dir[s[i]][0];
			int dy = b + dir[s[i]][1];
			if (dx >= 1 && dx <= x) {
				a = dx;
			}
			if (dy >= 1 && dy <= y) {
				b = dy;
			}
			if (!visited[a][b]) {
				res[i + 1] = 1;
			}
			visited[a][b] = true;
		}
		int count = x * y;
		for (int i = 0; i < res.length; i++) {
			if (res[i] == 1) {
				count--;
			}
		}
		res[res.length - 1] += count;
		for (int i = 0; i < res.length; i++) {
			out.print(res[i] + " ");
		}
	}

	/*
	 *
	 */
	// --------------------------------------------------------
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String nextLine() {
			String str = "";
			try {
				str = reader.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}

			return str;
		}
	}
}


import java.util.Scanner;
import java.lang.StringBuilder;

public class TestingRobots {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String q = sc.nextLine();

		String[] r = q.split("\\s");

     	int x = Integer.parseInt(r[0]);
     	int y = Integer.parseInt(r[1]);
     	int xx = Integer.parseInt(r[2]);
     	int yy = Integer.parseInt(r[3]);

		String s = sc.nextLine();

		int[][] field = new int[x][y];
		boolean[][] fieldb = new boolean[x][y];

		int curx = xx-1;
		int cury = yy-1;

		int explode = 0;

		StringBuilder output = new StringBuilder();

		for (int i = 0; i < s.length(); i++) {

			if (fieldb[curx][cury]) {
				output.append("0 ");
			} else {
				fieldb[curx][cury] = true;
				output.append("1 ");
				explode++;
			}

			if (s.charAt(i)=='U' && curx>0) {
				curx--;
			}
			if (s.charAt(i)=='D' && curx<x-1) {
				curx++;
			}
			if (s.charAt(i)=='L' && cury>0) {
				cury--;
			}
			if (s.charAt(i)=='R' && cury<y-1) {
				cury++;
			}

		}

		output.append(x*y-explode);

		System.out.println(output);
	}

}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by slycer on 10/15/15.
 */
public class P2 {

    public static void main ( String [] args ) throws IOException {
        FastReader reader = new FastReader();
        int [] data = reader.nextLineAsInt();
        int n = data[0];
        int m = data[1];
        int i = data[2];
        int j = data[3];

        int [][] table = new int[501][501];
        String commands = reader.nextLine();
        int libere = n * m; // numarul de pozitii ramase libere
        for ( int k=0; k<commands.length(); k++ ){

            if ( table[i][j] == 1 ){ // deja a bubuit
                System.out.print("0 " );
            } else {
                table[i][j] = 1;
                libere --;
                System.out.print( "1 " ); // bomba trebuie sa fix aici
            }

            char c = commands.charAt( k );
            if ( c == 'U' ){
                if ( i>1 ) i--;
            }
            if ( c == 'D' ) {
                if ( i<n ) i++;
            }
            if ( c == 'L' ){
                if ( j > 1 ) j--;
            }
            if ( c == 'R' ){
                if ( j < m ) j++;
            }

        }

        System.out.print( libere );

    }

    public static class FastReader {
        BufferedReader reader;

        public FastReader (){
            reader = new BufferedReader( new InputStreamReader( System.in ) );
        }

        public int [] nextLineAsInt() throws IOException {
            String [] aux = reader.readLine().split( " " );
            int [] ret = new int[ aux.length ];
            for ( int i=0; i<aux.length; i++ ){
                ret[i] = Integer.valueOf( aux[i] );
            }
            return ret;
        }

        public String nextLine() throws IOException {
            return reader.readLine();
        }
    }
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by slycer on 10/15/15.
 */
public class P2 {

    public static void main ( String [] args ) throws IOException {
        FastReader reader = new FastReader();
        int [] data = reader.nextLineAsInt();
        int n = data[0];
        int m = data[1];
        int i = data[2];
        int j = data[3];

        int [][] table = new int[501][501];
        String commands = reader.nextLine();
        int libere = n * m; // numarul de pozitii ramase libere
        for ( int k=0; k<commands.length(); k++ ){

            if ( table[i][j] == 1 ){ // deja a bubuit
                System.out.print("0 " );
            } else {
                table[i][j] = 1;
                libere --;
                System.out.print( "1 " ); // bomba trebuie sa fix aici
            }

            char c = commands.charAt( k );
            if ( c == 'U' ){
                if ( i>1 ) i--;
            }
            if ( c == 'D' ) {
                if ( i<n ) i++;
            }
            if ( c == 'L' ){
                if ( j > 1 ) j--;
            }
            if ( c == 'R' ){
                if ( j < m ) j++;
            }

        }

        if ( table[i][j] == 1 ){
            System.out.print( "0 " );
        } else {
            System.out.print( libere );
        }
    }

    public static class FastReader {
        BufferedReader reader;

        public FastReader (){
            reader = new BufferedReader( new InputStreamReader( System.in ) );
        }

        public int [] nextLineAsInt() throws IOException {
            String [] aux = reader.readLine().split( " " );
            int [] ret = new int[ aux.length ];
            for ( int i=0; i<aux.length; i++ ){
                ret[i] = Integer.valueOf( aux[i] );
            }
            return ret;
        }

        public String nextLine() throws IOException {
            return reader.readLine();
        }
    }
}


import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int x, y, x0, y0;
	static String str;
	static boolean matrix[][];

	public static void main(String[] args) {
		x = sc.nextInt();
		y = sc.nextInt();
		x0 = sc.nextInt();
		y0 = sc.nextInt();

		matrix = new boolean[x][y];

		str = sc.next();

		System.out.print(1 + " ");
		matrix[x0 - 1][y0 - 1] = true;

		for (int i = 0; i != str.length(); i++) {
			move(str.charAt(i));
			if (i != str.length() - 1)
				if (!matrix[x0 - 1][y0 - 1]) System.out.print(1 + " ");
				else System.out.print(0 + " ");

			if (i == str.length() - 1) {
				int counter = 0;
				for (int a = 0; a != x; a++)
					for (int b = 0; b != y; b++)
						if (!matrix[a][b]) counter++;

				System.out.print(counter);
			}

			matrix[x0 - 1][y0 - 1] = true;
		}
	}

	static void move(char c) {
		if (c == 'R')
			if (y0 != y) y0++;

		if (c == 'L')
			if (y0 != 1) y0--;

		if (c == 'D')
			if (x0 != x) x0++;

		if (c == 'U')
			if (x0 != 1) x0--;
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

public class Main{
    public static void main (String[] args) throws java.lang.Exception{
        //BufferedReader in=new BufferedReader(new InputStreamReade(System.in));
        InputReader in=new InputReader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        int x=in.readInt();
        int y=in.readInt();
        int x1=in.readInt()-1;
        int y1=in.readInt()-1;
        String s=in.readString();
        int[][] a=new int[x][y];
        for(int i=0;i<x;i++)
            Arrays.fill(a[i],-1);
        a[x1][y1]=0;
        for(int i=0;i<s.length();i++){
            int ch=s.charAt(i);
            int prevx=x1,prevy=y1;
            switch(ch){
                case 'L':{
                    y1-=1;
                    break;
                }
                case 'R':{
                    y1+=1;
                    break;
                }
                case 'U':{
                    x1-=1;
                    break;
                }
                case 'D':{
                    x1+=1;
                    break;
                }
            }
            try{
                if(a[x1][y1]==-1)
                a[x1][y1]=i+1;
            }catch(Exception e){x1=prevx;y1=prevy;}
        }
        int[] ans=new int[s.length()+1];
        for(int i=0;i<x;i++){
            for(int j=0;j<y;j++){
                if(a[i][j]!=-1){
                    ans[a[i][j]]++;
                }else ans[s.length()]++;
            }
        }
        for(int i=0;i<ans.length;i++){
            out.print(ans[i]+" ");
        }
        out.flush();out.close();
    }
    static final class InputReader{
        private final InputStream stream;
        private final byte[] buf=new byte[1024];
        private int curChar;
        private int numChars;
        public InputReader(InputStream stream){this.stream=stream;}
        private int read()throws IOException{
            if(curChar>=numChars){
                curChar=0;
                numChars=stream.read(buf);
                if(numChars<=0)
                    return -1;
            }
            return buf[curChar++];
        }
        public final int readInt()throws IOException{return (int)readLong();}
        public final long readLong()throws IOException{
            int c=read();
            while(isSpaceChar(c)){
                c=read();
                if(c==-1) throw new IOException();
            }
            boolean negative=false;
            if(c=='-'){
                negative=true;
                c=read();
            }
            long res=0;
            do{
                if(c<'0'||c>'9')throw new InputMismatchException();
                res*=10;
                res+=(c-'0');
                c=read();
            }while(!isSpaceChar(c));
            return negative?(-res):(res);
        }
        public final int[] readIntBrray(int size)throws IOException{
            int[] arr=new int[size];
            for(int i=0;i<size;i++)arr[i]=readInt();
            return arr;
        }
        public final String readString()throws IOException{
            int c=read();
            while(isSpaceChar(c))c=read();
            StringBuilder res=new StringBuilder();
            do{
                res.append((char)c);
                c=read();
            }while(!isSpaceChar(c));
            return res.toString();
        }
        private boolean isSpaceChar(int c){
            return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
        }
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

public class Main{
    public static void main (String[] args) throws java.lang.Exception{
        //BufferedReader in=new BufferedReader(new InputStreamReade(System.in));
        InputReader in=new InputReader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        int x=in.readInt();
        int y=in.readInt();
        int x1=in.readInt()-1;
        int y1=in.readInt()-1;
        String s=in.readString();
        int[][] a=new int[x][y];
        for(int i=0;i<x;i++)
            Arrays.fill(a[i],-1);
        a[x1][y1]=0;
        for(int i=0;i<s.length();i++){
            int ch=s.charAt(i);
            int prevx=x1,prevy=y1;
            switch(ch){
                case 'L':{
                    y1-=1;
                    break;
                }
                case 'R':{
                    y1+=1;
                    break;
                }
                case 'U':{
                    x1-=1;
                    break;
                }
                case 'D':{
                    x1+=1;
                    break;
                }
            }
            try{
                a[x1][y1]=i+1;
            }catch(Exception e){x1=prevx;y1=prevy;}
        }
        int[] ans=new int[s.length()+1];
        for(int i=0;i<x;i++){
            for(int j=0;j<y;j++){
                if(a[i][j]!=-1){
                    ans[a[i][j]]++;
                }else ans[s.length()]++;
            }
        }
        for(int i=0;i<ans.length;i++){
            out.print(ans[i]+" ");
        }
        out.flush();out.close();
    }
    static final class InputReader{
        private final InputStream stream;
        private final byte[] buf=new byte[1024];
        private int curChar;
        private int numChars;
        public InputReader(InputStream stream){this.stream=stream;}
        private int read()throws IOException{
            if(curChar>=numChars){
                curChar=0;
                numChars=stream.read(buf);
                if(numChars<=0)
                    return -1;
            }
            return buf[curChar++];
        }
        public final int readInt()throws IOException{return (int)readLong();}
        public final long readLong()throws IOException{
            int c=read();
            while(isSpaceChar(c)){
                c=read();
                if(c==-1) throw new IOException();
            }
            boolean negative=false;
            if(c=='-'){
                negative=true;
                c=read();
            }
            long res=0;
            do{
                if(c<'0'||c>'9')throw new InputMismatchException();
                res*=10;
                res+=(c-'0');
                c=read();
            }while(!isSpaceChar(c));
            return negative?(-res):(res);
        }
        public final int[] readIntBrray(int size)throws IOException{
            int[] arr=new int[size];
            for(int i=0;i<size;i++)arr[i]=readInt();
            return arr;
        }
        public final String readString()throws IOException{
            int c=read();
            while(isSpaceChar(c))c=read();
            StringBuilder res=new StringBuilder();
            do{
                res.append((char)c);
                c=read();
            }while(!isSpaceChar(c));
            return res.toString();
        }
        private boolean isSpaceChar(int c){
            return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
        }
    }
}


import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class TestingRobots implements Closeable {

    private InputReader in = new InputReader(System.in);
    private PrintWriter out = new PrintWriter(System.out);

    public void solve() {
        int x = in.ni(), y = in.ni(), xo = in.ni(), yo = in.ni();
        char[] c = in.next().toCharArray();
        int n = c.length;
        boolean[][] used = new boolean[x + 1][y + 1];
        int[] result = new int[n + 1];
        Map<Character, int[]> map = new HashMap<Character, int[]>() {{
           put('U', new int[]{-1, 0});
           put('D', new int[]{1, 0});
           put('L', new int[]{0, -1});
           put('R', new int[]{0, 1});
        }};
        used[xo][yo] = true;
        result[0] = 1;
        for (int i = 0; i < n; i++) {
            int[] d = map.get(c[i]);
            if (xo + d[0] > 0 && xo + d[0] <= x && yo + d[1] > 0 && yo + d[1] <= y) {
                if (!used[xo + d[0]][yo + d[1]]) {
                    result[i + 1]++;
                    used[xo + d[0]][yo + d[1]] = true;
                }
                xo += d[0];
                yo += d[1];
            }
        }
        for (int i = 1; i <= x; i++) {
            for (int j = 1; j <= y; j++) {
                if (!used[i][j]) result[n]++;
            }
        }
        for (int i = 0; i <= n; i++) {
            out.print(result[i]);
            out.print(' ');
        }
    }

    @Override
    public void close() throws IOException {
        in.close();
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

        public long nl() {
            return Long.parseLong(next());
        }

        public void close() throws IOException {
            reader.close();
        }
    }

    public static void main(String[] args) throws IOException {
        try (TestingRobots instance = new TestingRobots()) {
            instance.solve();
        }
    }
}


//package CodeForces.Round335;

import java.io.*;
import java.util.Scanner;
import java.util.StringTokenizer;

/**
 * Created by ilya on 10.12.15.
 */
public class B606 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        int x = sc.nextInt();
        int y = sc.nextInt();
        int x0 = sc.nextInt() -1;
        int y0 = sc.nextInt() -1;
        String s = sc.next();
        int[] res = new int[s.length() + 1];
        res[0] = 1;

        boolean[][] matr = new boolean[x][y];
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'U' && x0 > 0) x0--;
            if (s.charAt(i) == 'D' && x0 < x-1) x0++;
            if (s.charAt(i) == 'L' && y0 > 0) y0--;
            if (s.charAt(i) == 'R' && y0 < y-1) y0++;
            if (!matr[x0][y0]) res[i+1]++;
            matr[x0][y0] = true;
        }

        int count = x*y;
        for(int i = 0; i<res.length; i++)
            if(res[i] > 0)
                count--;
        res[res.length-1] += count;
        for(int i = 0; i<res.length; i++) out.print(res[i]+" ");
        out.close();

    }

    public static class sc {
        BufferedReader br;
        StringTokenizer st;

        public sc() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        Integer nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


//package CodeForces.Round335;

import java.io.*;
import java.util.Scanner;
import java.util.StringTokenizer;

/**
 * Created by ilya on 10.12.15.
 */
public class B606 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        int x = sc.nextInt();
        int y = sc.nextInt();
        int x0 = sc.nextInt() -1;
        int y0 = sc.nextInt() -1;
        String s = sc.next();
        int[] res = new int[s.length() + 1];
        res[0] = 1;

        boolean[][] matr = new boolean[x][y];
        matr[x0][y0] = true;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'U' && x0 > 0) x0--;
            if (s.charAt(i) == 'D' && x0 < x-1) x0++;
            if (s.charAt(i) == 'L' && y0 > 0) y0--;
            if (s.charAt(i) == 'R' && y0 < y-1) y0++;
            if (!matr[x0][y0]) res[i+1]++;
            matr[x0][y0] = true;
        }

        int count = x*y;
        for(int i = 0; i<res.length; i++)
            if(res[i] > 0)
                count--;
        res[res.length-1] += count;
        for(int i = 0; i<res.length; i++) out.print(res[i]+" ");
        out.close();

    }

    public static class sc {
        BufferedReader br;
        StringTokenizer st;

        public sc() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        Integer nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.util.Scanner;

/**
 * Created by rritz on 12/25/2015.
 */
public class Robots {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        String line1 = in.nextLine();
        String line2 = in.nextLine();

        System.out.println(process(line1, line2));
    }

    public static String process(String line1, String line2) {
        String[] info = line1.split(" ");
        int x = Integer.parseInt(info[0]);
        int y = Integer.parseInt(info[1]);
        int robotX = Integer.parseInt(info[2]);
        int robotY = Integer.parseInt(info[3]);

        int[][] grid = new int[x+1][y+1];
        StringBuffer ans = new StringBuffer();
        int numVisited = 1;

        grid[robotX][robotY] = 1;
        ans.append("1 ");

        for(int i=0; i<line2.length(); i++) {
            if (line2.charAt(i) == 'U')
                robotX = Math.max(1, robotX - 1);
            else if (line2.charAt(i) == 'D')
                robotX = Math.min(x, robotX + 1);
            else if (line2.charAt(i) == 'R')
                robotY = Math.min(y, robotY + 1);
            else
                robotY = Math.max(1, robotY - 1);

            if(i == line2.length()-1) {
                ans.append(String.valueOf((x * y) - numVisited));
            }
            else {

                if(grid[robotX][robotY] == 1)
                    ans.append("0 ");
                else {
                    numVisited++;
                    ans.append("1 ");
                    grid[robotX][robotY] = 1;
                 }
            }
        }

        return ans.toString().trim();
    }

}


import java.util.Scanner;

/**
 * Created by rritz on 12/25/2015.
 */
public class Robots {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        String line1 = in.nextLine();
        String line2 = in.nextLine();

        System.out.println(process(line1, line2));
    }

    public static String process(String line1, String line2) {
        String[] info = line1.split(" ");
        int x = Integer.parseInt(info[0]);
        int y = Integer.parseInt(info[1]);
        int robotX = Integer.parseInt(info[2]);
        int robotY = Integer.parseInt(info[3]);

        int[][] grid = new int[x+1][y+1];
        StringBuffer ans = new StringBuffer();
        int numVisited = 0;

        grid[robotX][robotY] = 1;
        ans.append("1 ");

        for(int i=0; i<line2.length(); i++) {
            if (line2.charAt(i) == 'U')
                robotX = Math.max(1, robotX - 1);
            else if (line2.charAt(i) == 'D')
                robotX = Math.min(x, robotX + 1);
            else if (line2.charAt(i) == 'R')
                robotY = Math.min(y, robotY + 1);
            else
                robotY = Math.max(1, robotY - 1);

            if (grid[robotX][robotY] == 1)
                ans.append("0 ");
            else {

                numVisited++;

                 if(i == line2.length()-1) {
                     ans.append(String.valueOf((x * y) - numVisited));
                 }
                 else {
                     ans.append("1 ");
                     grid[robotX][robotY] = 1;
                 }
            }
        }

        return ans.toString().trim();
    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // y = c
            int r = in.nextInt();
            int c = in.nextInt();
            int r0 = in.nextInt() - 1;
            int c0 = in.nextInt() - 1;

            String str = in.next();

            int[][] matrix = new int[r][c];

            for (int i = 0; i < r; i++) {
                for (int j = 0; j < c; j++) {
                    matrix[i][j] = -1;
                }
            }

            int count = r * c;

            for (int i = 0; i < str.length(); i++) {
                if (matrix[r0][c0] == -1) {
                    matrix[r0][c0] = i + 1;
                    count--;
                    out.println(1);
                } else {
                    out.println(0);
                }

                if (str.charAt(i) == 'L' && c0 != 0)
                    c0--;
                else if (str.charAt(i) == 'R' && c0 != c - 1)
                    c0++;
                else if (str.charAt(i) == 'U' && r0 != 0)
                    r0--;
                else if (str.charAt(i) == 'D' && r0 != r - 1)
                    r0++;
            }

            out.println(count);

        }

    }
}


import java.awt.Point;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class b {
	public static void main(String[] args) {
		PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
		try (Scanner scan= new Scanner(System.in)){
			int X = scan.nextInt(), Y = scan.nextInt(), x = scan.nextInt()-1, y = scan.nextInt()-1;

			HashSet<Point> list = new HashSet<Point>();
			list.add(new Point(x,y));

			String line = scan.next();
			int[] count = new int[line.length()+1];
			Arrays.fill(count, -1);
			count[0]=1;
			int t = 1;
			for (char c : line.toCharArray()){
				switch(c){
				case 'U':
					if (x==0){t++; continue;}
					else if (list.contains(new Point(x-1, y))){
						x--;
						count[t++]=0;
					}
					else{
						count[t++]=1;
						x--;list.add(new Point(x,y));
					}
					continue;
				case 'D':
					if (x==X-1){t++; continue;}
					else if (list.contains(new Point(x+1, y))){
						count[t++]=0;
						x++;
					}
					else{
						count[t++]=1;
						x++;list.add(new Point(x,y));
					}
					continue;
				case 'L':
					if (y==0){t++; continue;}
					else if (list.contains(new Point(x, y-1))){
						count[t++]=0;y--;
					}
					else{
						count[t++]=1;
						y--;list.add(new Point(x,y));
					}
					continue;
				case 'R':
					if (y==Y-1){t++; continue;}
					else if (list.contains(new Point(x, y+1))){
						count[t++]=0;
						y++;
					}
					else{
						count[t++]=1;
						y++;list.add(new Point(x,y));
					}
					continue;
				}
			}
			for(int i=0;i<count.length;i++){
				if(i==count.length-1)
					out.print(Math.max(count[count.length-1],0)+(X*Y-list.size()));
				else
					out.print(((count[i]>=0)?count[i]:0)+" ");
			}
			out.close();
		}
	}
}


import java.awt.Point;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class b {
	public static void main(String[] args) {
		PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
		try (Scanner scan= new Scanner(System.in)){
			int X = scan.nextInt(), Y = scan.nextInt(), x = scan.nextInt()-1, y = scan.nextInt()-1;

			HashSet<Point> list = new HashSet<Point>();
			list.add(new Point(x,y));

			String line = scan.next();
			int[] count = new int[line.length()+1];
			Arrays.fill(count, -1);
			count[0]=1;
			int t = 1;
			for (char c : line.toCharArray()){
				switch(c){
				case 'U':
					if (x==0){t++; continue;}
					else if (list.contains(new Point(x-1, y)))count[t++]=0;
					else{
						count[t++]=1;
						x--;list.add(new Point(x,y));
					}
					continue;
				case 'D':
					if (x==X-1){t++; continue;}
					else if (list.contains(new Point(x+1, y)))count[t++]=0;
					else{
						count[t++]=1;
						x++;list.add(new Point(x,y));
					}
					continue;
				case 'L':
					if (y==0){t++; continue;}
					else if (list.contains(new Point(x, y-1)))count[t++]=0;
					else{
						count[t++]=1;
						y--;list.add(new Point(x,y));
					}
					continue;
				case 'R':
					if (y==Y-1){t++; continue;}
					else if (list.contains(new Point(x, y+1)))count[t++]=0;
					else{
						count[t++]=1;
						y++;list.add(new Point(x,y));
					}
					continue;
				}
			}

			if (count[line.length()]!=0){
				count[line.length()]+=(X*Y-list.size());
			}
			for(int i=0;i<count.length;i++){
				out.print(((count[i]>=0)?count[i]:0)+" ");
			}
			out.close();
		}
	}
}


import java.awt.Point;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class b {
	public static void main(String[] args) {
		PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
		try (Scanner scan= new Scanner(System.in)){
			int X = scan.nextInt(), Y = scan.nextInt(), x = scan.nextInt()-1, y = scan.nextInt()-1;

			HashSet<Point> list = new HashSet<Point>();
			list.add(new Point(x,y));

			String line = scan.next();
			int[] count = new int[line.length()+1];
			Arrays.fill(count, -1);
			count[0]=1;
			int t = 1;
			for (char c : line.toCharArray()){
				switch(c){
				case 'U':
					if (x==0){t++; continue;}
					else if (list.contains(new Point(x-1, y)))count[t++]=0;
					else{
						count[t++]=1;
						x--;list.add(new Point(x,y));
					}
					continue;
				case 'D':
					if (x==X-1){t++; continue;}
					else if (list.contains(new Point(x+1, y)))count[t++]=0;
					else{
						count[t++]=1;
						x++;list.add(new Point(x,y));
					}
					continue;
				case 'L':
					if (y==0){t++; continue;}
					else if (list.contains(new Point(x, y-1)))count[t++]=0;
					else{
						count[t++]=1;
						y--;list.add(new Point(x,y));
					}
					continue;
				case 'R':
					if (y==Y-1){t++; continue;}
					else if (list.contains(new Point(x, y+1)))count[t++]=0;
					else{
						count[t++]=1;
						y++;list.add(new Point(x,y));
					}
					continue;
				}
			}
			for(int i=0;i<count.length;i++){
				if(i==count.length-1)
					out.print(count[count.length-1]+(X*Y-list.size()));
				else
					out.print(((count[i]>=0)?count[i]:0)+" ");
			}
			out.close();
		}
	}
}


import java.awt.Point;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class b {
	public static void main(String[] args) {
		PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
		try (Scanner scan= new Scanner(System.in)){
			int X = scan.nextInt(), Y = scan.nextInt(), x = scan.nextInt()-1, y = scan.nextInt()-1;

			HashSet<Point> list = new HashSet<Point>();
			list.add(new Point(x,y));

			String line = scan.next();
			int[] count = new int[line.length()+1];
			Arrays.fill(count, -1);
			count[0]=1;
			int t = 1;
			for (char c : line.toCharArray()){
				switch(c){
				case 'U':
					if (x==0){t++; continue;}
					else if (list.contains(new Point(x-1, y)))count[t++]=0;
					else{
						count[t++]=1;
						x--;list.add(new Point(x,y));
					}
					continue;
				case 'D':
					if (x==X-1){t++; continue;}
					else if (list.contains(new Point(x+1, y)))count[t++]=0;
					else{
						count[t++]=1;
						x++;list.add(new Point(x,y));
					}
					continue;
				case 'L':
					if (y==0){t++; continue;}
					else if (list.contains(new Point(x, y-1)))count[t++]=0;
					else{
						count[t++]=1;
						y--;list.add(new Point(x,y));
					}
					continue;
				case 'R':
					if (y==Y-1){t++; continue;}
					else if (list.contains(new Point(x, y+1)))count[t++]=0;
					else{
						count[t++]=1;
						y++;list.add(new Point(x,y));
					}
					continue;
				}
			}
			for(int i=0;i<count.length;i++){
				if(i==count.length-1)
					out.print(Math.max(count[count.length-1],0)+(X*Y-list.size()));
				else
					out.print(((count[i]>=0)?count[i]:0)+" ");
			}
			out.close();
		}
	}
}


import java.util.Scanner;

/**
 *
 * @author AKID(CSE'11,CUET)
 */

public class Main {

   public static int pos[][]=new int[510][510];

    public static void main(String[] args) {
        // TODO code application logic here

        Scanner sc=new Scanner(System.in);

        int x=sc.nextInt();
        int y=sc.nextInt();

        int x0=sc.nextInt();
        int y0=sc.nextInt();

        char ch[]=new char[1000010];

        ch=sc.next().toCharArray();

        int sz=ch.length,k=1;
       // System.out.println(sz);
        System.out.print("1 ");
        for(int i=0;i<sz-1;i++)
        {
            int xx=x0,yy=y0;

           if(ch[i]=='U')   xx--;
           if(ch[i]=='D')   xx++;
           if(ch[i]=='L')   yy--;
           if(ch[i]=='R')   yy++;

           if((xx>=1 && xx<=x) && (yy>=1 && yy<=y))
           {
               x0=xx;
               y0=yy;
           }

           if(pos[x0][y0]==0){
            pos[x0][y0]=1;
               System.out.print("1 ");
               k++;
           }
           else System.out.print("0 ");
        }
        System.out.println(x*y-k);

    }

}


import java.util.Scanner;

/**
 *
 * @author AKID(CSE'11,CUET)
 */

public class Main {

   public static int pos[][]=new int[510][510];

    public static void main(String[] args) {
        // TODO code application logic here

        Scanner sc=new Scanner(System.in);

        int x=sc.nextInt();
        int y=sc.nextInt();

        int x0=sc.nextInt();
        int y0=sc.nextInt();

        char ch[]=new char[1000010];

        ch=sc.next().toCharArray();

        int sz=ch.length,k=1;
       // System.out.println(sz);
        System.out.print("1 ");
        pos[x0][y0]=1;
        for(int i=0;i<sz-1;i++)
        {
            int xx=x0,yy=y0;

           if(ch[i]=='U')   xx--;
           if(ch[i]=='D')   xx++;
           if(ch[i]=='L')   yy--;
           if(ch[i]=='R')   yy++;

           if((xx>=1 && xx<=x) && (yy>=1 && yy<=y))
           {
               x0=xx;
               y0=yy;
           }

           if(pos[x0][y0]==0){
            pos[x0][y0]=1;
               System.out.print("1 ");
               k++;
           }
           else System.out.print("0 ");
        }
        System.out.println(x*y-k);

    }

}


import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class Main {
    private static BufferedReader br;
    private static StringTokenizer st;
    private static PrintWriter pw;

    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        int X = readInt();
        int Y = readInt();

        int[][] board = new int[X + 1][Y + 1];

        int x = readInt();
        int y = readInt();
        String seq = nextToken();

        for (int i = 1; i <= X; i++)
            Arrays.fill(board[i], -1);

        board[x][y] = 0;
        int move = 1;
        for (char cmd : seq.toCharArray()) {
            switch (cmd) {
                case 'L':
                    y = Math.max(y - 1, 1);
                    break;
                case 'R':
                    y = Math.min(y + 1, Y);
                    break;
                case 'U':
                    x = Math.max(x - 1, 1);
                    break;
                default:
                    x = Math.min(x + 1, X);
            }
            if (board[x][y] == -1) board[x][y] = move;
            move++;
        }

        int[] res = new int[seq.length() + 1];
        for (int i = 1; i <= X; i++)
            for (int j = 1; j <= Y; j++) {
                int ct = board[i][j] == -1 ? seq.length() : board[i][j];
                res[ct]++;
            }
        for (int i = 0; i <= seq.length(); i++)
            pw.print(res[i] + " ");
        pw.println();

        pw.close();
    }

    private static void exitImmediately() {
        pw.close();
        System.exit(0);
    }

    private static long readLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private static double readDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private static int readInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private static String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
//            if (!br.ready()) {
//                exitImmediately();
//            }
            st = new StringTokenizer(br.readLine().trim());
        }
        return st.nextToken();
    }
}


import java.util.*;
public class Main {

	static int maxn = 500 + 10;
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int x = cin.nextInt(), y = cin.nextInt(), x0 = cin.nextInt(), y0 = cin.nextInt();
		String s = cin.next();
		int k = 0;
		boolean vis[][] = new boolean[maxn][maxn];
		System.out.printf("1");
		for(int i = 0; i < s.length(); ++i){
			vis[x0][y0] = true;
			if(i == s.length()-1)break;
			int xx = x0, yy = y0;
			if(s.charAt(i) == 'U') x0--;
			if(s.charAt(i) == 'L') y0--;
			if(s.charAt(i) == 'D') x0++;
			if(s.charAt(i) == 'R') y0++;
			if(x0 >= 1 && x0 <= x && y0 >= 1 && y0 <= y){
				if(vis[x0][y0]){
					System.out.printf(" 0");
				}
				else{
					System.out.printf(" 1");
				}
			}
			else{
				System.out.printf(" 0");
				x0 = xx; y0 = yy;
			}
		}
		k = x*y;
		for(int i = 1; i <= x; ++i)
			for(int j = 1; j <= y; ++j)
				if(vis[i][j])k--;
		System.out.printf(" %d", k);
	}

}


import java.util.*;
public class Main {

	static int maxn = 500 + 10;
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int x = cin.nextInt(), y = cin.nextInt(), x0 = cin.nextInt(), y0 = cin.nextInt();
		String s = cin.next();
		int k = 0;
		boolean vis[][] = new boolean[maxn][maxn];
		System.out.printf("1");
		for(int i = 0; i < s.length()-1; ++i){
			vis[x0][y0] = true;
			int xx = x0, yy = y0;
			if(s.charAt(i) == 'U') x0--;
			if(s.charAt(i) == 'L') y0--;
			if(s.charAt(i) == 'D') x0++;
			if(s.charAt(i) == 'R') y0++;
			if(x0 >= 1 && x0 <= x && y0 >= 1 && y0 <= y){
				if(vis[x0][y0]){
					System.out.printf(" 0");
				}
				else{
					System.out.printf(" 1");
				}
			}
			else{
				System.out.printf(" 0");
				x0 = xx; y0 = yy;
			}
		}
		k = x*y;
		for(int i = 1; i <= x; ++i)
			for(int j = 1; j <= y; ++j)
				if(vis[i][j])k--;
		System.out.printf(" %d", k);
	}

}


import java.util.*;
public class Main {

	static int maxn = 500 + 10;
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int x = cin.nextInt(), y = cin.nextInt(), x0 = cin.nextInt(), y0 = cin.nextInt();
		String s = cin.next();
		int k = 0;
		boolean vis[][] = new boolean[maxn][maxn];
		int comeon[] = new int[maxn];
		comeon[0] = 1;
		boolean boom = false;
		for(int i = 0; i < s.length(); ++i){
			int xx = x0, yy = y0;
			if(s.charAt(i) == 'U') x0--;
			if(s.charAt(i) == 'L') y0--;
			if(s.charAt(i) == 'D') x0++;
			if(s.charAt(i) == 'R') y0++;
			if(x0 >= 1 && x0 <= x && y0 >= 1 && y0 <= y){
				if(!vis[x0][y0]){
					comeon[i+1] = 1;
					vis[xx][yy] = true;
					continue;
				}
			}
			else{
				x0 = xx; y0 = yy;
				continue;
			}
		}
		for(int i = 0; i < s.length(); ++i)System.out.printf(" %d", comeon[i]);k = x*y;
		for(int i = 1; i <= x; ++i)
			for(int j = 1; j <= y; ++j)
				if(vis[i][j])k--;
		System.out.printf(" %d", k);
	}

}


import java.util.*;
public class Main {

	static int maxn = 500 + 10;
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int x = cin.nextInt(), y = cin.nextInt(), x0 = cin.nextInt(), y0 = cin.nextInt();
		String s = cin.next();
		int k = 0;
		boolean vis[][] = new boolean[maxn][maxn];
		int comeon[] = new int[maxn];
		comeon[0] = 1;
		boolean boom = false;
		for(int i = 0; i < s.length(); ++i){
			int xx = x0, yy = y0;
			if(s.charAt(i) == 'U') x0--;
			if(s.charAt(i) == 'L') y0--;
			if(s.charAt(i) == 'D') x0++;
			if(s.charAt(i) == 'R') y0++;
			if(x0 >= 1 && x0 <= x && y0 >= 1 && y0 <= y){
				if(!vis[x0][y0]){
					comeon[i+1] = 1;
					vis[xx][yy] = true;
					continue;
				}
			}
			else{
				x0 = xx; y0 = yy;
				continue;
			}
		}
		for(int i = 0; i < s.length(); ++i)System.out.printf("%d ", comeon[i]);k = x*y;
		for(int i = 0; i < s.length(); ++i)k-=comeon[i];
		System.out.printf("%d", k);
	}

}


	import java.util.*;
	import java.io.*;

	public class Main
	{
		public static void main( String[] args )
		{
			Scan scan = new Scan();
			int m=scan.nextInt();
			int n=scan.nextInt();
			int x=scan.nextInt();
			int y=scan.nextInt();
			String s=scan.next();
			boolean[][] used=new boolean[m+1][n+1];
			for(int i=0;i<=m;i++)
				Arrays.fill(used[i], false);
			int[][] move=new int[][]{{-1, 0},{0, 1},{1, 0},{0, -1}};
			int cnt=0;
			for(int i=0;i<=s.length(); i++)
			{
				if(i==0)
				{
					used[x][y]=true;
					cnt++;
					System.out.print( "1 " );
				}
				else if(i<s.length())
				{
					char c=s.charAt(i-1);
					int dir=0;
					if(c=='R')
						dir=1;
					if(c=='D')
						dir=2;
					if(c=='L')
						dir=3;
					x=x+move[dir][0];
					y=y+move[dir][1];
					x=Math.min(x, m);
					x=Math.max(x, 1);
					y=Math.min(y, n);
					y=Math.max(y, 1);
					int ans=0;
					if(!used[x][y])
						ans=1;
					used[x][y]=true;
					cnt+=ans;
					System.out.print( ans+" " );
				}
				else
				{
					System.out.println( m*n-cnt );
				}

			}
		}
	}

	class Scan
	{
		public BufferedReader br;
		public StringTokenizer st;

		public Scan()
		{
			br = new BufferedReader( new InputStreamReader( System.in ) );
		}

		public boolean hasNext()
		{
			while ( st == null ||  ! st.hasMoreElements() )
			{
				try
				{
					st = new StringTokenizer( br.readLine() );
				}
				catch ( Exception e )
				{
					return false;
				}
			}
			return true;
		}

		public String next()
		{
			if ( hasNext() )
				return st.nextToken();
			return null;
		}

		public int nextInt()
		{
			if ( hasNext() )
				return Integer.parseInt( st.nextToken() );
			return -1;
		}

		public String nextLine()
		{
			st = null;
			try
			{
				return br.readLine();
			}
			catch ( Exception e )
			{
				return null;
			}
		}
	}