import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class B {

	public static void main(String[] args) {

		MyScanner in = new MyScanner();
		int x = in.nextInt();
		int y = in.nextInt();
		int x0 = in.nextInt();
		int y0 = in.nextInt();

		String command = in.next();
		boolean[][] board = new boolean[x + 1][y + 1];
		board[x0][y0] = true;
		int left = x * y - 1;
		System.out.print("1 ");
		for (int i = 0; i < command.length(); ++i) {
			char ch = command.charAt(i);
			if (ch == 'L') {
				if (y0 > 1) {
					y0--;
				}
			}
			if (ch == 'R') {
				if (y0 < y) {
					y0++;
				}
			}

			if (ch == 'D') {
				if (x0 <x) {
					x0++;
				}
			}

			if (ch == 'U') {
				if (x0 > 1) {
					x0--;
				}
			}

			if (board[x0][y0]) {
				if (i < command.length() - 1) {
					System.out.print("0 ");
				}
			} else {
				board[x0][y0] = true;
				left--;
				if (i < command.length() - 1) {
					System.out.print("1 ");
				}else{
					left++;
				}
			}
		}
		System.out.print(""+left);

	}

	// -----------PrintWriter for faster output---------------------------------
	public static PrintWriter out = new PrintWriter(System.out);

	// -----------MyScanner class for faster input----------
	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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class B {

	public static void main(String[] args) {

		MyScanner in = new MyScanner();
		int x = in.nextInt();
		int y = in.nextInt();
		int x0 = in.nextInt();
		int y0 = in.nextInt();

		String command = in.next();
		boolean[][] board = new boolean[x + 1][y + 1];
		board[x0][y0] = true;
		int left = x * y ;
		System.out.print("1 ");
		for (int i = 0; i < command.length(); ++i) {
			char ch = command.charAt(i);
			if (ch == 'L') {
				if (y0 > 1) {
					y0--;
				}
			}
			if (ch == 'R') {
				if (y0 < y) {
					y0++;
				}
			}

			if (ch == 'D') {
				if (x0 <x) {
					x0++;
				}
			}

			if (ch == 'U') {
				if (x0 > 1) {
					x0--;
				}
			}

			if (board[x0][y0]) {
				if (i < command.length() - 1) {
					System.out.print("0 ");
				}
			} else {
				board[x0][y0] = true;
				if (i < command.length() - 1) {
					System.out.print("1 ");
				}
				left--;
			}
		}
		System.out.print(""+left);

	}

	// -----------PrintWriter for faster output---------------------------------
	public static PrintWriter out = new PrintWriter(System.out);

	// -----------MyScanner class for faster input----------
	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.io.*;
import java.util.*;

public class Cf606B {

    public static void main(String args[]) throws IOException {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int x = in.nextInt();
        int y = in.nextInt();
        int i = in.nextInt()-1;
        int j = in.nextInt()-1;
        char s[] = in.readString().toCharArray();
        int field[][] = new int[x][y];

        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[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);
        w.close();
    }

    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar, 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 int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        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 com.sun.javafx.scene.layout.region.Margins;

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

public class GGWPLivaem implements Runnable {
    boolean withFiles = false;
    class cc implements Comparable<cc> {
        public int x, y;
        cc(int x, int y) {
            this.x = x;
            this.y = y;
        }
        public int compareTo(cc other) {
            if (this.x == other.x) {
                return Integer.compare(this.y, other.y);
            }
            return Integer.compare(this.x, other.x);
        }
    }

    private void solve() throws IOException {
        int n = in.nextInt(), m = in.nextInt();
        int ii = in.nextInt(), jj = in.nextInt();
        int used[][] = new int[1000][1000];
        int ans[] = new int[1000000];
        String s = in.next();
        ans[0] = 1;
        int p = 1;
        for (int i = 0; i < s.length(); ++i) {
            used[ii][jj] = 1;
            if (s.charAt(i) == 'U') {
                if (ii == 1) {
                    if (i == s.length()- 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    --ii;
                    if (i == s.length() - 1 && used[ii][jj] == 1) {
                        p = 0;
                    }
                    ans[i + 1] = 1;
                }
            }
            if (s.charAt(i) == 'D') {
                if (ii == n) {
                    if (i == s.length() - 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    ++ii;
                    if (i == s.length() - 1 && used[ii][jj] == 1) {
                        p = 0;
                    }
                    ans[i + 1] = 1;
                }
            }
            if (s.charAt(i) == 'L') {
                if (jj == 1) {
                    if (i == s.length() - 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    --jj;
                    if (i == s.length() - 1 && used[ii][jj] == 1) {
                        p = 0;
                    }
                    ans[i + 1] = 1;
                }
            }
            if (s.charAt(i) == 'R') {
                if (jj == m) {
                    if (i == s.length() - 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    ++jj;
                    if (i == s.length() - 1 && used[ii][jj] == 1) {
                        p = 0;
                    }
                    ans[i + 1] = 1;
                }
            }
        }
        used[ii][jj] = 1;
        int ss = 0;
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= m; ++j) {
                if (used[i][j] == 0){
                    ss++;
                }
            }
        }
        ans[s.length()] = ss + p;
        for (int i = 0; i <= s.length(); ++i) {
            out.printf("%d ", ans[i]);
        }
    }

    private static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;
        String cache;
        int cur;

        FastScanner(Reader r) throws IOException {
            reader = new BufferedReader(r);
            tokenizer = new StringTokenizer("");
            cache = null;
            cur = 0;
        }

        public boolean hasNext() {
            if (cache != null && cur < cache.length())
                return true;
            try {
                while (!tokenizer.hasMoreTokens()) {
                    String line = reader.readLine();
                    if (line == null)
                        return false;
                    tokenizer = new StringTokenizer(line);
                }
                cache = tokenizer.nextToken();
                cur = 0;
            }
            catch (IOException e) {
                return false;
            }
            return true;
        }

        public char nextChar() throws IOException {
            if (!hasNext())
                throw new EOFException();
            return cache.charAt(cur++);
        }

        public String next() throws IOException {
            if (!hasNext())
                throw new EOFException();
            String result = (cur == 0) ? cache : cache.substring(cur);
            cache = null;
            return result;
        }

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

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

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

        public BigInteger nextBigInteger() throws IOException {
            return new BigInteger(this.next());
        }

        public void close() throws IOException {
            reader.close();
            tokenizer = new StringTokenizer("");
        }
    }

    public static void main(String args[]) throws IOException {
        new Thread(null, new GGWPLivaem(), "Thread #228", 64 * 1024 * 1024).start();
    }

    public void run() {
        try {
            if (withFiles) {
                in = new FastScanner(new FileReader("input.txt"));
                out = new PrintWriter(new FileWriter("output.txt"));
            }
            else {
                in = new FastScanner(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            }
            solve();
            in.close();
            out.close();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }

    FastScanner in;
    PrintWriter out;
}


import com.sun.javafx.scene.layout.region.Margins;

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

public class GGWPLivaem implements Runnable {
    boolean withFiles = false;
    class cc implements Comparable<cc> {
        public int x, y;
        cc(int x, int y) {
            this.x = x;
            this.y = y;
        }
        public int compareTo(cc other) {
            if (this.x == other.x) {
                return Integer.compare(this.y, other.y);
            }
            return Integer.compare(this.x, other.x);
        }
    }

    private void solve() throws IOException {
        int n = in.nextInt(), m = in.nextInt();
        int ii = in.nextInt(), jj = in.nextInt();
        int used[][] = new int[1000][1000];
        int ans[] = new int[1000000];
        String s = in.next();
        ans[0] = 1;
        int p = 1;
        for (int i = 0; i < s.length(); ++i) {
            used[ii][jj] = 1;
            if (s.charAt(i) == 'U') {
                if (ii == 1) {
                    if (i == s.length()- 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    --ii;
                    if (i == s.length() - 1 && used[ii][jj] == 1) {
                        p = 0;
                    }
                    ans[i + 1] = used[ii][jj] == 1 ? 0 : 1;
                }
            }
            if (s.charAt(i) == 'D') {
                if (ii == n) {
                    if (i == s.length() - 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    ++ii;
                    if (i == s.length() - 1 && used[ii][jj] == 1) {
                        p = 0;
                    }
                    ans[i + 1] = used[ii][jj] == 1 ? 0 : 1;
                }
            }
            if (s.charAt(i) == 'L') {
                if (jj == 1) {
                    if (i == s.length() - 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    --jj;
                    if (i == s.length() - 1 && used[ii][jj] == 1) {
                        p = 0;
                    }
                    ans[i + 1] = used[ii][jj] == 1 ? 0 : 1;
                }
            }
            if (s.charAt(i) == 'R') {
                if (jj == m) {
                    if (i == s.length() - 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    ++jj;
                    if (i == s.length() - 1 && used[ii][jj] == 1) {
                        p = 0;
                    }
                    ans[i + 1] = used[ii][jj] == 1 ? 0 : 1;
                }
            }
        }
        used[ii][jj] = 1;
        int ss = 0;
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= m; ++j) {
                if (used[i][j] == 0){
                    ss++;
                }
            }
        }
        ans[s.length()] = ss + p;
        for (int i = 0; i <= s.length(); ++i) {
            out.printf("%d ", ans[i]);
        }
    }

    private static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;
        String cache;
        int cur;

        FastScanner(Reader r) throws IOException {
            reader = new BufferedReader(r);
            tokenizer = new StringTokenizer("");
            cache = null;
            cur = 0;
        }

        public boolean hasNext() {
            if (cache != null && cur < cache.length())
                return true;
            try {
                while (!tokenizer.hasMoreTokens()) {
                    String line = reader.readLine();
                    if (line == null)
                        return false;
                    tokenizer = new StringTokenizer(line);
                }
                cache = tokenizer.nextToken();
                cur = 0;
            }
            catch (IOException e) {
                return false;
            }
            return true;
        }

        public char nextChar() throws IOException {
            if (!hasNext())
                throw new EOFException();
            return cache.charAt(cur++);
        }

        public String next() throws IOException {
            if (!hasNext())
                throw new EOFException();
            String result = (cur == 0) ? cache : cache.substring(cur);
            cache = null;
            return result;
        }

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

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

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

        public BigInteger nextBigInteger() throws IOException {
            return new BigInteger(this.next());
        }

        public void close() throws IOException {
            reader.close();
            tokenizer = new StringTokenizer("");
        }
    }

    public static void main(String args[]) throws IOException {
        new Thread(null, new GGWPLivaem(), "Thread #228", 64 * 1024 * 1024).start();
    }

    public void run() {
        try {
            if (withFiles) {
                in = new FastScanner(new FileReader("input.txt"));
                out = new PrintWriter(new FileWriter("output.txt"));
            }
            else {
                in = new FastScanner(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            }
            solve();
            in.close();
            out.close();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }

    FastScanner in;
    PrintWriter out;
}


import com.sun.javafx.scene.layout.region.Margins;

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

public class GGWPLivaem implements Runnable {
    boolean withFiles = false;
    class cc implements Comparable<cc> {
        public int x, y;
        cc(int x, int y) {
            this.x = x;
            this.y = y;
        }
        public int compareTo(cc other) {
            if (this.x == other.x) {
                return Integer.compare(this.y, other.y);
            }
            return Integer.compare(this.x, other.x);
        }
    }

    private void solve() throws IOException {
        int n = in.nextInt(), m = in.nextInt();
        int ii = in.nextInt(), jj = in.nextInt();
        int used[][] = new int[1000][1000];
        int ans[] = new int[1000000];
        String s = in.next();
        ans[0] = 1;
        int p = 1;
        for (int i = 0; i < s.length(); ++i) {
            used[ii][jj] = 1;
            if (s.charAt(i) == 'U') {
                if (ii == 1) {
                    if (i == s.length()- 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    --ii;
                    if (i == s.length() - 1 && used[ii][jj] == 1) {
                        p = 0;
                    }
                    ans[i + 1] = used[ii][jj] == 1 ? 1 : 0;
                }
            }
            if (s.charAt(i) == 'D') {
                if (ii == n) {
                    if (i == s.length() - 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    ++ii;
                    if (i == s.length() - 1 && used[ii][jj] == 1) {
                        p = 0;
                    }
                    ans[i + 1] = used[ii][jj] == 1 ? 1 : 0;
                }
            }
            if (s.charAt(i) == 'L') {
                if (jj == 1) {
                    if (i == s.length() - 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    --jj;
                    if (i == s.length() - 1 && used[ii][jj] == 1) {
                        p = 0;
                    }
                    ans[i + 1] = used[ii][jj] == 1 ? 1 : 0;
                }
            }
            if (s.charAt(i) == 'R') {
                if (jj == m) {
                    if (i == s.length() - 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    ++jj;
                    if (i == s.length() - 1 && used[ii][jj] == 1) {
                        p = 0;
                    }
                    ans[i + 1] = used[ii][jj] == 1 ? 1 : 0;
                }
            }
        }
        used[ii][jj] = 1;
        int ss = 0;
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= m; ++j) {
                if (used[i][j] == 0){
                    ss++;
                }
            }
        }
        ans[s.length()] = ss + p;
        for (int i = 0; i <= s.length(); ++i) {
            out.printf("%d ", ans[i]);
        }
    }

    private static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;
        String cache;
        int cur;

        FastScanner(Reader r) throws IOException {
            reader = new BufferedReader(r);
            tokenizer = new StringTokenizer("");
            cache = null;
            cur = 0;
        }

        public boolean hasNext() {
            if (cache != null && cur < cache.length())
                return true;
            try {
                while (!tokenizer.hasMoreTokens()) {
                    String line = reader.readLine();
                    if (line == null)
                        return false;
                    tokenizer = new StringTokenizer(line);
                }
                cache = tokenizer.nextToken();
                cur = 0;
            }
            catch (IOException e) {
                return false;
            }
            return true;
        }

        public char nextChar() throws IOException {
            if (!hasNext())
                throw new EOFException();
            return cache.charAt(cur++);
        }

        public String next() throws IOException {
            if (!hasNext())
                throw new EOFException();
            String result = (cur == 0) ? cache : cache.substring(cur);
            cache = null;
            return result;
        }

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

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

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

        public BigInteger nextBigInteger() throws IOException {
            return new BigInteger(this.next());
        }

        public void close() throws IOException {
            reader.close();
            tokenizer = new StringTokenizer("");
        }
    }

    public static void main(String args[]) throws IOException {
        new Thread(null, new GGWPLivaem(), "Thread #228", 64 * 1024 * 1024).start();
    }

    public void run() {
        try {
            if (withFiles) {
                in = new FastScanner(new FileReader("input.txt"));
                out = new PrintWriter(new FileWriter("output.txt"));
            }
            else {
                in = new FastScanner(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            }
            solve();
            in.close();
            out.close();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }

    FastScanner in;
    PrintWriter out;
}


import com.sun.javafx.scene.layout.region.Margins;

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

public class GGWPLivaem implements Runnable {
    boolean withFiles = false;
    class cc implements Comparable<cc> {
        public int x, y;
        cc(int x, int y) {
            this.x = x;
            this.y = y;
        }
        public int compareTo(cc other) {
            if (this.x == other.x) {
                return Integer.compare(this.y, other.y);
            }
            return Integer.compare(this.x, other.x);
        }
    }

    private void solve() throws IOException {
        int n = in.nextInt(), m = in.nextInt();
        int ii = in.nextInt(), jj = in.nextInt();
        int used[][] = new int[1000][1000];
        int ans[] = new int[1000000];
        String s = in.next();
        ans[0] = 1;
        int p = 1;
        for (int i = 0; i < s.length(); ++i) {
            used[ii][jj] = 1;
            if (s.charAt(i) == 'U') {
                if (ii == 1) {
                    if (i == s.length()) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    --ii;
                    ans[i + 1] = 1;
                }
            }
            if (s.charAt(i) == 'D') {
                if (ii == n) {
                    if (i == s.length()) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    ++ii;
                    ans[i + 1] = 1;
                }
            }
            if (s.charAt(i) == 'L') {
                if (jj == 1) {
                    if (i == s.length()) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    --jj;
                    ans[i + 1] = 1;
                }
            }
            if (s.charAt(i) == 'R') {
                if (jj == m) {
                    if (i == s.length()) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    ++jj;
                    ans[i + 1] = 1;
                }
            }
        }
        used[ii][jj] = 1;
        int ss = 0;
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= m; ++j) {
                if (used[i][j] == 0){
                    ss++;
                }
            }
        }
        ans[s.length()] = ss + p;
        for (int i = 0; i <= s.length(); ++i) {
            out.printf("%d ", ans[i]);
        }
    }

    private static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;
        String cache;
        int cur;

        FastScanner(Reader r) throws IOException {
            reader = new BufferedReader(r);
            tokenizer = new StringTokenizer("");
            cache = null;
            cur = 0;
        }

        public boolean hasNext() {
            if (cache != null && cur < cache.length())
                return true;
            try {
                while (!tokenizer.hasMoreTokens()) {
                    String line = reader.readLine();
                    if (line == null)
                        return false;
                    tokenizer = new StringTokenizer(line);
                }
                cache = tokenizer.nextToken();
                cur = 0;
            }
            catch (IOException e) {
                return false;
            }
            return true;
        }

        public char nextChar() throws IOException {
            if (!hasNext())
                throw new EOFException();
            return cache.charAt(cur++);
        }

        public String next() throws IOException {
            if (!hasNext())
                throw new EOFException();
            String result = (cur == 0) ? cache : cache.substring(cur);
            cache = null;
            return result;
        }

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

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

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

        public BigInteger nextBigInteger() throws IOException {
            return new BigInteger(this.next());
        }

        public void close() throws IOException {
            reader.close();
            tokenizer = new StringTokenizer("");
        }
    }

    public static void main(String args[]) throws IOException {
        new Thread(null, new GGWPLivaem(), "Thread #228", 64 * 1024 * 1024).start();
    }

    public void run() {
        try {
            if (withFiles) {
                in = new FastScanner(new FileReader("input.txt"));
                out = new PrintWriter(new FileWriter("output.txt"));
            }
            else {
                in = new FastScanner(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            }
            solve();
            in.close();
            out.close();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }

    FastScanner in;
    PrintWriter out;
}


import com.sun.javafx.scene.layout.region.Margins;

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

public class GGWPLivaem implements Runnable {
    boolean withFiles = false;
    class cc implements Comparable<cc> {
        public int x, y;
        cc(int x, int y) {
            this.x = x;
            this.y = y;
        }
        public int compareTo(cc other) {
            if (this.x == other.x) {
                return Integer.compare(this.y, other.y);
            }
            return Integer.compare(this.x, other.x);
        }
    }

    private void solve() throws IOException {
        int n = in.nextInt(), m = in.nextInt();
        int ii = in.nextInt(), jj = in.nextInt();
        int used[][] = new int[1000][1000];
        int ans[] = new int[1000000];
        String s = in.next();
        ans[0] = 1;
        int p = 1;
        for (int i = 0; i < s.length(); ++i) {
            used[ii][jj] = 1;
            if (s.charAt(i) == 'U') {
                if (ii == 1) {
                    if (i == s.length()- 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    --ii;
                    ans[i + 1] = 1;
                }
            }
            if (s.charAt(i) == 'D') {
                if (ii == n) {
                    if (i == s.length() - 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    ++ii;
                    ans[i + 1] = 1;
                }
            }
            if (s.charAt(i) == 'L') {
                if (jj == 1) {
                    if (i == s.length() - 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    --jj;
                    ans[i + 1] = 1;
                }
            }
            if (s.charAt(i) == 'R') {
                if (jj == m) {
                    if (i == s.length() - 1) {
                        p = 0;
                    }
                    ans[i + 1] = 0;
                }
                else {
                    ++jj;
                    ans[i + 1] = 1;
                }
            }
        }
        used[ii][jj] = 1;
        int ss = 0;
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= m; ++j) {
                if (used[i][j] == 0){
                    ss++;
                }
            }
        }
        ans[s.length()] = ss + p;
        for (int i = 0; i <= s.length(); ++i) {
            out.printf("%d ", ans[i]);
        }
    }

    private static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;
        String cache;
        int cur;

        FastScanner(Reader r) throws IOException {
            reader = new BufferedReader(r);
            tokenizer = new StringTokenizer("");
            cache = null;
            cur = 0;
        }

        public boolean hasNext() {
            if (cache != null && cur < cache.length())
                return true;
            try {
                while (!tokenizer.hasMoreTokens()) {
                    String line = reader.readLine();
                    if (line == null)
                        return false;
                    tokenizer = new StringTokenizer(line);
                }
                cache = tokenizer.nextToken();
                cur = 0;
            }
            catch (IOException e) {
                return false;
            }
            return true;
        }

        public char nextChar() throws IOException {
            if (!hasNext())
                throw new EOFException();
            return cache.charAt(cur++);
        }

        public String next() throws IOException {
            if (!hasNext())
                throw new EOFException();
            String result = (cur == 0) ? cache : cache.substring(cur);
            cache = null;
            return result;
        }

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

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

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

        public BigInteger nextBigInteger() throws IOException {
            return new BigInteger(this.next());
        }

        public void close() throws IOException {
            reader.close();
            tokenizer = new StringTokenizer("");
        }
    }

    public static void main(String args[]) throws IOException {
        new Thread(null, new GGWPLivaem(), "Thread #228", 64 * 1024 * 1024).start();
    }

    public void run() {
        try {
            if (withFiles) {
                in = new FastScanner(new FileReader("input.txt"));
                out = new PrintWriter(new FileWriter("output.txt"));
            }
            else {
                in = new FastScanner(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            }
            solve();
            in.close();
            out.close();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }

    FastScanner in;
    PrintWriter out;
}


import com.sun.javafx.scene.layout.region.Margins;

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

public class GGWPLivaem implements Runnable {
    boolean withFiles = false;
    class cc implements Comparable<cc> {
        public int x, y;
        cc(int x, int y) {
            this.x = x;
            this.y = y;
        }
        public int compareTo(cc other) {
            if (this.x == other.x) {
                return Integer.compare(this.y, other.y);
            }
            return Integer.compare(this.x, other.x);
        }
    }

    private void solve() throws IOException {
        int n = in.nextInt(), m = in.nextInt();
        int ii = in.nextInt(), jj = in.nextInt();
        int used[][] = new int[1000][1000];
        int ans[] = new int[1000000];
        String s = in.next();
        ans[0] = 1;
        for (int i = 0; i < s.length(); ++i) {
            used[ii][jj] = 1;
            if (s.charAt(i) == 'U') {
                if (ii == 1) {
                    ans[i + 1] = 0;
                }
                else {
                    --ii;
                    ans[i + 1] = 1;
                }
            }
            if (s.charAt(i) == 'D') {
                if (ii == n) {
                    ans[i + 1] = 0;
                }
                else {
                    ++ii;
                    ans[i + 1] = 1;
                }
            }
            if (s.charAt(i) == 'L') {
                if (jj == 1) {
                    ans[i + 1] = 0;
                }
                else {
                    --jj;
                    ans[i + 1] = 1;
                }
            }
            if (s.charAt(i) == 'R') {
                if (jj == m) {
                    ans[i + 1] = 0;
                }
                else {
                    ++jj;
                    ans[i + 1] = 1;
                }
            }
        }
        used[ii][jj] = 1;
        int ss = 0;
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= m; ++j) {
                if (used[i][j] == 0){
                    ss++;
                }
            }
        }
        ans[s.length()] = ss + 1;
        for (int i = 0; i <= s.length(); ++i) {
            out.printf("%d ", ans[i]);
        }
    }

    private static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;
        String cache;
        int cur;

        FastScanner(Reader r) throws IOException {
            reader = new BufferedReader(r);
            tokenizer = new StringTokenizer("");
            cache = null;
            cur = 0;
        }

        public boolean hasNext() {
            if (cache != null && cur < cache.length())
                return true;
            try {
                while (!tokenizer.hasMoreTokens()) {
                    String line = reader.readLine();
                    if (line == null)
                        return false;
                    tokenizer = new StringTokenizer(line);
                }
                cache = tokenizer.nextToken();
                cur = 0;
            }
            catch (IOException e) {
                return false;
            }
            return true;
        }

        public char nextChar() throws IOException {
            if (!hasNext())
                throw new EOFException();
            return cache.charAt(cur++);
        }

        public String next() throws IOException {
            if (!hasNext())
                throw new EOFException();
            String result = (cur == 0) ? cache : cache.substring(cur);
            cache = null;
            return result;
        }

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

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

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

        public BigInteger nextBigInteger() throws IOException {
            return new BigInteger(this.next());
        }

        public void close() throws IOException {
            reader.close();
            tokenizer = new StringTokenizer("");
        }
    }

    public static void main(String args[]) throws IOException {
        new Thread(null, new GGWPLivaem(), "Thread #228", 64 * 1024 * 1024).start();
    }

    public void run() {
        try {
            if (withFiles) {
                in = new FastScanner(new FileReader("input.txt"));
                out = new PrintWriter(new FileWriter("output.txt"));
            }
            else {
                in = new FastScanner(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            }
            solve();
            in.close();
            out.close();
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }

    FastScanner in;
    PrintWriter out;
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int x0 = scanner.nextInt() - 1;
        int y0 = scanner.nextInt() - 1;
        char[] commands = scanner.next().toCharArray();
        int[] results = new int[commands.length + 1];
        int[][] routes = new int[x][y];
        for (int i = 0; i < x; i++) for (int j = 0; j < y; j++) routes[i][j] = -1;
        routes[x0][y0] = 0;
        for (int i = 0; i < commands.length; i++) {
            char command = commands[i];
            if (command == 'U' && x0 > 0) x0--;
            else if (command == 'D' && x0 < x - 1) x0++;
            else if (command == 'R' && y0 < y - 1) y0++;
            else if (command == 'L' && y0 > 0) y0--;
            if (routes[x0][y0] == -1) routes[x0][y0] = i + 1;
        }
        for (int i = 0; i < x; i++) {
            for (int j = 0; j < y; j++) {
                if (routes[i][j] == -1) results[commands.length]++;
                else results[routes[i][j]]++;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < results.length; i++) {
            sb.append(results[i]);
            if (i < results.length - 1) sb.append(" ");
        }
        System.out.println(sb.toString());
    }
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int x0 = scanner.nextInt() - 1;
        int y0 = scanner.nextInt() - 1;
        char[] commands = scanner.next().toCharArray();
        int[][] K = new int[x][y];
        for (int i = 0; i < x; i++) for (int j = 0; j < y; j++) K[i][j] = -1;
        K[x0][y0] = 0;
        for (int i = 0; i < commands.length; i++) {
            char c = commands[i];
            if (c == 'U' && x0 > 0) x0--;
            else if (c == 'R' && y0 < y - 1) y0++;
            else if (c == 'D' && x0 < x - 1) x0++;
            else if (c == 'L' && y0 > 0) y0--;
            if (K[x0][y0] == -1) K[x0][y0] = i + 1;
        }
        int[] A = new int[commands.length + 1];
        for (int i = 0; i < x; i++)
            for (int j = 0; j < y; j++) {
                if (K[i][j] == -1) A[A.length - 1]++;
                else A[K[i][j]]++;
            }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < A.length; i++) {
            if (i > 0) sb.append(" ");
            sb.append(A[i]);
        }
        System.out.println(sb.toString());
    }
}


import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;

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

class TaskB {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int x = in.readInt(), y = in.readInt(), x0 = in.readInt()-1, y0 = in.readInt()-1;
        boolean vst[][] = new boolean[x][y];
        char seq[] = in.readString().toCharArray();
        int k = seq.length, ans[] = new int[k+1], cnt=0;
        for(int i=0; i<k; i++) {
            if(!vst[x0][y0]) {
                ans[i]++;
                cnt++;
            }
            vst[x0][y0] = true;
            if( seq[i]=='L' ) {
                if( y0>0 ) y0--;
            }
            if( seq[i]=='R' ) {
                if( y0<y-1 ) y0++;
            }
            if( seq[i]=='U' ) {
                if( x0>0 ) x0--;
            }
            if( seq[i]=='D' ) {
                if( x0<x-1 ) x0++;
            }
        }
        ans[k] = x*y - cnt;
        for(int a : ans) out.print(a + " ");
    }
}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

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

    public 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++];
    }

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

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return isWhitespace(c);
    }

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

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

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void close() {
        writer.close();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Problem606B
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x = Integer.parseInt(st.nextToken());
		int y = Integer.parseInt(st.nextToken());
		int currentPosX = Integer.parseInt(st.nextToken()) - 1;
		int currentPosY = Integer.parseInt(st.nextToken()) - 1;
		char[] input = new StringBuffer(br.readLine()).toString().toCharArray();

		boolean[][] field = new boolean[x][y];
		field[currentPosX][currentPosY] = true;
		int counter = 1;
		System.out.print("1 ");

		for(int i=0 ; i<input.length-1 ; i++)
		{
			if(input[i] == 'U' && currentPosX > 0)
			{
				currentPosX--;
			}
			else if(input[i] == 'D' && currentPosX < x-1)
			{
				currentPosX++;
			}
			else if(input[i] == 'L' && currentPosY > 0)
			{
				currentPosY--;
			}
			else if(input[i] == 'R' && currentPosY < y-1)
			{
				currentPosY++;
			}

			if(field[currentPosX][currentPosY] == false)
			{
				field[currentPosX][currentPosY] = true;
				counter++;
				System.out.print("1 ");
			}
			else
				System.out.print("0 ");
		}
		//print the number of untouched fields
		System.out.println(x*y-counter);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Problem606B
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x = Integer.parseInt(st.nextToken());
		int y = Integer.parseInt(st.nextToken());
		int x0 = Integer.parseInt(st.nextToken());
		int y0 = Integer.parseInt(st.nextToken());
		int currentPosX = x0-1;
		int currentPosY = y0-1;

		char[] input = new StringBuffer(br.readLine()).toString().toCharArray();

		boolean[][] field = new boolean[x][y];
		field[x0][y0] = true;
		int counter = 1;
		System.out.print("1 ");

		for(int i=0 ; i<input.length ; i++)
		{
			if(input[i] == 'U' && currentPosX > 0)
			{
				currentPosX--;
			}
			else if(input[i] == 'D' && currentPosX < x-1)
			{
				currentPosX++;
			}
			else if(input[i] == 'L' && currentPosY > 0)
			{
				currentPosY--;
			}
			else if(input[i] == 'R' && currentPosY < y-1)
			{
				currentPosY++;
			}

			if(!field[currentPosX][currentPosY])
			{
				field[currentPosX][currentPosY] = true;
				counter++;
				System.out.print("1 ");
			}
			else
				System.out.print("0 ");
		}
		//print the number of untouched fields
		System.out.print(x*y-counter);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Problem606B
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x = Integer.parseInt(st.nextToken());
		int y = Integer.parseInt(st.nextToken());
		int x0 = Integer.parseInt(st.nextToken());
		int y0 = Integer.parseInt(st.nextToken());
		int currentPosX = x0-1;
		int currentPosY = y0-1;

		char[] input = new StringBuffer(br.readLine()).toString().toCharArray();

		boolean[][] field = new boolean[x][y];
		field[x0][y0] = true;
		int counter = 1;
		System.out.print("1 ");

		for(int i=0 ; i<input.length ; i++)
		{
			if(input[i] == 'U' && currentPosX > 0)
			{
				currentPosX--;
			}
			else if(input[i] == 'D' && currentPosX < x-1)
			{
				currentPosX++;
			}
			else if(input[i] == 'L' && currentPosY > 0)
			{
				currentPosY--;
			}
			else if(input[i] == 'R' && currentPosY < y-1)
			{
				currentPosY++;
			}

			if(!field[currentPosX][currentPosY])
			{
				field[currentPosX][currentPosY] = true;
				counter++;
				System.out.print("1 ");
			}
			else
				System.out.print("0 ");
		}
		//print the number of untouched fields
		System.out.println(x*y-counter);
	}
}


import java.io.*;

public class TestRobots{
static BufferedReader br;
public static void main(String[] arg) throws Exception
{
br =new BufferedReader(new InputStreamReader(System.in));

String[] axis= br.readLine().split(" ");
String commands = br.readLine();
int x =Integer.parseInt(axis[0]);
int y =Integer.parseInt(axis[1]);
boolean[][] matrix =new boolean[x][y];
int xCur =Integer.parseInt(axis[2])-1;
int yCur = Integer.parseInt(axis[3])-1;
int total =x*y;
x--;y--;
System.out.print("1 ");
matrix[xCur][yCur]=true;
total--;
for(int i=0;i<(commands.length()-1);i++){
char a= commands.charAt(i);
if(a=='U' && (xCur-1)>=0)
{
 xCur--;
}
else if(a=='D' && (xCur+1)<=x) xCur++;
else if(a=='L' && (yCur-1)>=0) yCur--;
else if(a=='R' && (yCur+1)<=y) yCur++;
if(!matrix[xCur][yCur])
{
System.out.print("1 ");
matrix[xCur][yCur] =true;
total--;
}
else{
System.out.print("0 ");
}
}
System.out.print(total);
}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

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

	static class TaskB {
		private int n;
		private int m;

		public void solve(int testNumber, InputReader in, OutputWriter out) {
			n = in.readInt();
			m = in.readInt();
			int x0 = in.readInt() - 1;
			int y0 = in.readInt() - 1;
			int xcur = x0;
			int ycur = y0;
			int usedCount = 1;

			boolean[][] used = new boolean[n][m];
			used[x0][y0] = true;

			char[] s = in.next().toCharArray();
			out.print("1 ");
			for (int i = 0; i < s.length; i++) {
				char c = s[i];
				IntPair cur = parseChar(c);
				int xnew = xcur + cur.first;
				int ynew = ycur + cur.second;
				if (i == s.length - 1) out.print(n * m - usedCount);
				else if (!checkRange(xnew, ynew)) out.print("0 ");
				else {
					xcur = xnew;
					ycur = ynew;
					if (used[xcur][ycur]) out.print("0 ");
					else {
						if (i == s.length - 1) out.print(n * m - usedCount);
						else {
							out.print("1 ");
							used[xcur][ycur] = true;
							usedCount++;
						}
					}
				}
			}
		}

		private boolean checkRange(int x, int y) {
			return 0 <= x && x < n && 0 <= y && y < m;
		}

		private IntPair parseChar(char c) {
			switch (c) {
				case 'U':
					return new IntPair(-1, 0);
				case 'D':
					return new IntPair(1, 0);
				case 'L':
					return new IntPair(0, -1);
				case 'R':
					return new IntPair(0, 1);
				default:
					return null;
			}
		}

	}

	static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void close() {
			writer.close();
		}

		public void print(int i) {
			writer.print(i);
		}

	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

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

		public 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++];
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

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

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return isWhitespace(c);
		}

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

		public String next() {
			return readString();
		}

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

		}

	}

	static class IntPair implements Comparable<IntPair> {
		public final int first;
		public final int second;

		public IntPair(int first, int second) {
			this.first = first;
			this.second = second;
		}

		public String toString() {
			return "(" + first + "," + second + ")";
		}

		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || getClass() != o.getClass()) return false;

			IntPair intPair = (IntPair) o;

			return first == intPair.first && second == intPair.second;

		}

		public int hashCode() {
			int result = first;
			result = 31 * result + second;
			return result;
		}

		public int compareTo(IntPair o) {
			if (first < o.first)
				return -1;
			if (first > o.first)
				return 1;
			if (second < o.second)
				return -1;
			if (second > o.second)
				return 1;
			return 0;
		}

	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

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

	static class TaskB {
		private int n;
		private int m;

		public void solve(int testNumber, InputReader in, OutputWriter out) {
			n = in.readInt();
			m = in.readInt();
			int x0 = in.readInt() - 1;
			int y0 = in.readInt() - 1;
			int xcur = x0;
			int ycur = y0;
			int usedCount = 1;

			boolean[][] used = new boolean[n][m];
			used[x0][y0] = true;

			char[] s = in.next().toCharArray();
			out.print("1 ");
			for (int i = 0; i < s.length; i++) {
				char c = s[i];
				IntPair cur = parseChar(c);
				int xnew = xcur + cur.first;
				int ynew = ycur + cur.second;
				if (!checkRange(xnew, ynew)) out.print("0 ");
				else {
					xcur = xnew;
					ycur = ynew;
					if (used[xcur][ycur]) out.print("0 ");
					else {
						if (i == s.length - 1) out.print(n * m - usedCount);
						else {
							out.print("1 ");
							used[xcur][ycur] = true;
							usedCount++;
						}
					}
				}
			}
		}

		private boolean checkRange(int x, int y) {
			return 0 <= x && x < n && 0 <= y && y < m;
		}

		private IntPair parseChar(char c) {
			switch (c) {
				case 'U':
					return new IntPair(-1, 0);
				case 'D':
					return new IntPair(1, 0);
				case 'L':
					return new IntPair(0, -1);
				case 'R':
					return new IntPair(0, 1);
				default:
					return null;
			}
		}

	}

	static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void close() {
			writer.close();
		}

		public void print(int i) {
			writer.print(i);
		}

	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

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

		public 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++];
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

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

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return isWhitespace(c);
		}

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

		public String next() {
			return readString();
		}

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

		}

	}

	static class IntPair implements Comparable<IntPair> {
		public final int first;
		public final int second;

		public IntPair(int first, int second) {
			this.first = first;
			this.second = second;
		}

		public String toString() {
			return "(" + first + "," + second + ")";
		}

		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || getClass() != o.getClass()) return false;

			IntPair intPair = (IntPair) o;

			return first == intPair.first && second == intPair.second;

		}

		public int hashCode() {
			int result = first;
			result = 31 * result + second;
			return result;
		}

		public int compareTo(IntPair o) {
			if (first < o.first)
				return -1;
			if (first > o.first)
				return 1;
			if (second < o.second)
				return -1;
			if (second > o.second)
				return 1;
			return 0;
		}

	}
}


import java.util.*;
public class B606 {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt(), y = scan.nextInt();
		int x0 = scan.nextInt(), y0 = scan.nextInt();
		scan.nextLine();
		String s = scan.nextLine();
		//System.out.println(s);
		int[][] seq = new int[s.length()+1][2];
		seq[0][0] = x0;
		seq[0][1] = y0;
		for(int i=1; i<seq.length; i++)
		{
			char ind = s.charAt(i-1);
			if(ind == 'R')
			{
					seq[i][0] = seq[i-1][0];
					seq[i][1] = seq[i-1][1]+1;
					if(seq[i][1] > y) seq[i][1]--;
			}
			if(ind == 'L')
			{
					seq[i][0] = seq[i-1][0];
					seq[i][1] = seq[i-1][1]-1;
					if(seq[i][1] <= 0) seq[i][1]++;
			}
			if(ind == 'U')
			{
					seq[i][0] = seq[i-1][0]-1;
					seq[i][1] = seq[i-1][1];
					if(seq[i][0] <= 0) seq[i][0]++;
			}
			if(ind == 'D')
			{
					seq[i][0] = seq[i-1][0]+1;
					seq[i][1] = seq[i-1][1];
					if(seq[i][0] > x) seq[i][0]--;
			}
			//System.out.println(seq[i][0] + " " +seq[i][1]);
		}

		int[][] m = new int[x+1][y+1];
		for(int i=1; i<m.length; i++)
		{
			for(int j =1; j<m[i].length; j++)
			{
				m[i][j] = s.length();
			}
		}
		int[][] fo = new int[x+1][y+1];
		for(int i=0; i<fo.length; i++)
			for(int j =0; j<fo[i].length; j++)
				fo[i][j] = -1;
		for(int i=0; i<seq.length; i++)
		{
			if(fo[seq[i][0]][seq[i][1]] == -1) //has not occurred yet
			{
				//System.out.println(seq[i][0] + " " +seq[i][1]);
				fo[seq[i][0]][seq[i][1]] = i;
			}
		}

		for(int i=0; i<seq.length; i++)
		{
			//System.out.println(seq[i][0] + " " +seq[i][1] + " "  +fo[seq[i][0]][seq[i][1]]);
			m[seq[i][0]][seq[i][1]] = fo[seq[i][0]][seq[i][1]];
		}

		int[] o = new int[s.length()+1];
		for(int i=1; i<m.length; i++)
		{
			for(int j =1; j<m[i].length; j++)
			{
				o[m[i][j]]++;
			}
		}
		for(int i=0; i<o.length; i++)
		{
			System.out.print(o[i] + " ");
		}
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Prob2 {

    static int x,y;
    static int x0, y0;

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer l1 = new StringTokenizer(br.readLine());
        x = Integer.parseInt(l1.nextToken());
        y = Integer.parseInt(l1.nextToken());
        x0 = Integer.parseInt(l1.nextToken());
        y0 = Integer.parseInt(l1.nextToken());
        String s = br.readLine();
        int[][] a = new int[x][y];
        a[x0-1][y0-1]++;
        System.out.print("1");
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c == 'U') move(-1, 0);
            else if (c == 'D') move(1, 0);
            else if (c == 'R') move(0, 1);
            else if (c == 'L') move(0, -1);
            a[x0-1][y0-1]++;
            int result = 0;
            if (i == s.length() - 1) {
                for (int u = 0; u < x; u++) for (int v=0; v < y; v++) if (a[u][v] == 0) result++;
            }
            if (a[x0-1][y0-1]==1) {
                result+=1;
            }
            System.out.print(" " + result);
        }
    }

    private static void move(int i, int j) {
        if (1<=x0+i && x0+i <= x && 1<=j+y0 && j+y0<=y) {
            x0+=i; y0+=j;
        }
    }

}


import java.util.Scanner;

public class Main {
	public static void main(String[] argv){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(),y=sc.nextInt(),x0=sc.nextInt(),y0=sc.nextInt(),all=0;
		sc.nextLine();
		String s = sc.nextLine();
		int[] arr=new int[s.length()], results=new int[s.length()+1];
		boolean[][] visited = new boolean[x+1][y+1];
		char[] moves =  s.toCharArray();
		all=x*y;
		results[0]=1;
		all--;
		for (int i = 0; i < moves.length; i++) {
			boolean flag = true;
			switch (moves[i]) {
			case 'U':
				if(x0-1>=1){
					if(!visited[x0-1][y0]){
						x0=x0-1;
						results[i+1]+=1;
//						System.out.println("U");
						visited[x0][y0]=true;
					}
					else
					flag=false;
				}
				else
					flag=false;
				break;
			case 'D':
				if(x0+1<=x){
					if(!visited[x0+1][y0]){
						x0=x0+1;
						results[i+1]=1;
//						System.out.println("D");
						visited[x0][y0]=true;
					}
					else
					flag=false;
				}
				else
					flag=false;
				break;
			case 'R':
				if(y0+1<=y){
					if(!visited[x0][y0+1]){
						y0=y0+1;
						results[i+1]=1;
//						System.out.println("R");
						visited[x0][y0]=true;
					}
					else
					flag=false;
				}
				else
					flag=false;
				break;
			case 'L':
				if(y0-1>=1){
					if(!visited[x0][y0-1]){
						y0=y0-1;
						results[i+1]=1;
//						System.out.println("L");
						visited[x0][y0]=true;
					}
					else
					flag=false;
				}
				else
					flag=false;
				break;

			default:
				break;
			}
			if(flag){
				all--;
			}
			else
				results[i+1]=0;
		}
		int last=0;
		for (int j = 0; j < results.length; j++) {
			if(results[j]!=0)
				last=j;
		}
		results[last]+=all;
		for (int j = 0; j < results.length; j++) {
			if(results[j]!=0)
				last=j;
			System.out.print(results[j]+" ");
		}
		sc.close();
	}
}


import java.util.Scanner;

public class Main {
	public static void main(String[] argv){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(),y=sc.nextInt(),x0=sc.nextInt(),y0=sc.nextInt(),all=0,l=-1,last=0;
		sc.nextLine();
		String s = sc.nextLine();
		int[] arr=new int[s.length()], results=new int[s.length()+1];
		boolean[][] visited = new boolean[x+1][y+1];
		char[] moves =  s.toCharArray();
		all=x*y;
		results[0]=1;
		all--;
		for (int i = 0; i < moves.length; i++) {
			boolean flag = true;
			switch (moves[i]) {
			case 'U':
				if(x0-1>=1){
					if(!visited[x0-1][y0]){
						x0=x0-1;
						results[i+1]+=1;
//						System.out.println("U");
						visited[x0][y0]=true;
						last=i;
					}
					else{
						flag=false;
						x0=x0-1;
						last=i;
					}
				}
				else{
					flag=false;
					l=i;
				}
				break;
			case 'D':
				if(x0+1<=x){
					if(!visited[x0+1][y0]){
						x0=x0+1;
						results[i+1]=1;
//						System.out.println("D");
						visited[x0][y0]=true;
						last=i;
					}
					else{
						flag=false;
						x0=x0+1;
						last=i;
					}
				}
				else{
					flag=false;
					l=i;
				}
				break;
			case 'R':
				if(y0+1<=y){
					if(!visited[x0][y0+1]){
						y0=y0+1;
						results[i+1]=1;
//						System.out.println("R");
						visited[x0][y0]=true;
						last=i;
					}
					else{
						flag=false;
						y0=y0+1;
						last=i;
					}
				}
				else{
					flag=false;
					l=i;
				}
				break;
			case 'L':
				if(y0-1>=1){
					if(!visited[x0][y0-1]){
						y0=y0-1;
						results[i+1]=1;
//						System.out.println("L");
						visited[x0][y0]=true;
						last=i;
					}
					else{
						flag=false;
						y0=y0-1;
						last=i;
					}
				}
				else{
					flag=false;
					l=i;
				}
				break;

			default:
				break;
			}
			if(flag){
				all--;
			}
			else
				results[i+1]=0;
//			System.out.println(x0 +" "+y0);
		}
		results[last+1]+=all;
		for (int j = 0; j < results.length; j++) {
			System.out.print(results[j]+" ");
		}
		sc.close();
	}
}


import java.util.Scanner;

public class Main {
	public static void main(String[] argv){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(),y=sc.nextInt(),x0=sc.nextInt(),y0=sc.nextInt(),all=0,l=-1,last=0;
		sc.nextLine();
		String s = sc.nextLine();
		int[] arr=new int[s.length()], results=new int[s.length()+1];
		boolean[][] visited = new boolean[x+1][y+1];
		char[] moves =  s.toCharArray();
		all=x*y;
		results[0]=1;
		visited[x0][y0]=true;
		all--;
		for (int i = 0; i < moves.length; i++) {
			boolean flag = true;
			switch (moves[i]) {
			case 'U':
				if(x0-1>=1){
					if(!visited[x0-1][y0]){
						x0=x0-1;
						results[i+1]+=1;
//						System.out.println("U");
						visited[x0][y0]=true;
						last=i;
					}
					else{
						flag=false;
						x0=x0-1;
						last=i;
					}
				}
				else{
					flag=false;
					l=i;
				}
				break;
			case 'D':
				if(x0+1<=x){
					if(!visited[x0+1][y0]){
						x0=x0+1;
						results[i+1]=1;
//						System.out.println("D");
						visited[x0][y0]=true;
						last=i;
					}
					else{
						flag=false;
						x0=x0+1;
						last=i;
					}
				}
				else{
					flag=false;
					l=i;
				}
				break;
			case 'R':
				if(y0+1<=y){
					if(!visited[x0][y0+1]){
						y0=y0+1;
						results[i+1]=1;
//						System.out.println("R");
						visited[x0][y0]=true;
						last=i;
					}
					else{
						flag=false;
						y0=y0+1;
						last=i;
					}
				}
				else{
					flag=false;
					l=i;
				}
				break;
			case 'L':
				if(y0-1>=1){
					if(!visited[x0][y0-1]){
						y0=y0-1;
						results[i+1]=1;
//						System.out.println("L");
						visited[x0][y0]=true;
						last=i;
					}
					else{
						flag=false;
						y0=y0-1;
						last=i;
					}
				}
				else{
					flag=false;
					l=i;
				}
				break;

			default:
				break;
			}
			if(flag){
				all--;
			}
			else
				results[i+1]=0;
//			System.out.println(x0 +" "+y0);
		}
		results[last+1]+=all;
		for (int j = 0; j < results.length; j++) {
			System.out.print(results[j]+" ");
		}
		sc.close();
	}
}


import java.util.Scanner;

public class Main {
	public static void main(String[] argv){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(),y=sc.nextInt(),x0=sc.nextInt(),y0=sc.nextInt(),all=0;
		sc.nextLine();
		String s = sc.nextLine();
		int[] arr=new int[s.length()], results=new int[s.length()+1];
		boolean[][] visited = new boolean[x+1][y+1];
		char[] moves =  s.toCharArray();
		all=x*y;
		results[0]=1;
		all--;
		for (int i = 0; i < moves.length; i++) {
			boolean flag = true;
			switch (moves[i]) {
			case 'U':
				if(x0-1>=1){
					if(!visited[x0-1][y0]){
						x0=x0-1;
						results[i+1]+=1;
//						System.out.println("U");
						visited[x0][y0]=true;
					}
					else{
						flag=false;
						x0=x0-1;
					}
				}
				else
					flag=false;
				break;
			case 'D':
				if(x0+1<=x){
					if(!visited[x0+1][y0]){
						x0=x0+1;
						results[i+1]=1;
//						System.out.println("D");
						visited[x0][y0]=true;
					}
					else{
						flag=false;
						x0=x0+1;
					}
				}
				else
					flag=false;
				break;
			case 'R':
				if(y0+1<=y){
					if(!visited[x0][y0+1]){
						y0=y0+1;
						results[i+1]=1;
//						System.out.println("R");
						visited[x0][y0]=true;
					}
					else{
						flag=false;
						y0=y0+1;
					}
				}
				else
					flag=false;
				break;
			case 'L':
				if(y0-1>=1){
					if(!visited[x0][y0-1]){
						y0=y0-1;
						results[i+1]=1;
//						System.out.println("L");
						visited[x0][y0]=true;
					}
					else{
						flag=false;
						y0=y0-1;
					}
				}
				else
					flag=false;
				break;

			default:
				break;
			}
			if(flag){
				all--;
			}
			else
				results[i+1]=0;
		}
		int last=0;
		for (int j = 0; j < results.length; j++) {
			if(results[j]!=0)
				last=j;
		}
		results[last]+=all;
		for (int j = 0; j < results.length; j++) {
			if(results[j]!=0)
				last=j;
			System.out.print(results[j]+" ");
		}
		sc.close();
	}
}


import java.util.ArrayList;
import java.util.Scanner;
import java.util.Vector;

public class Algorithm {

	public static void main(String[] args) {

		Algorithm a = new Algorithm();
	}

	Scanner scan;

	public Algorithm() {
		scan = new Scanner(System.in);
		readData();
	}

	int x, y, a, b;
	int[][] g;
	String moves;
	public void readData() {
		x = scan.nextInt();
		y = scan.nextInt();
		a = scan.nextInt();
		b = scan.nextInt();
		g = new int[x + 1][y + 1];
		moves = scan.next();
		System.out.print(1 + " ");
		g[a][b] = 1;
		int count = 1;
		for (int k = 0; k < moves.length() - 1; k++){
			move(moves.charAt(k));
//			System.out.println(a + " " + b);

			if (g[a][b] != 1){
				count++;
				System.out.print(1 + " ");
			} else
				System.out.print(0 + " ");
			g[a][b] = 1;
		}
		move(moves.charAt(moves.length() - 1));

		System.out.print(x * y - count);
//		System.out.println(g[a][b]);
	}
	public void move(char h){
		switch(h){
			case 'L':
				if (b != 1)
					b--;
				break;
			case 'R':
				if (b != y)
					b++;
				break;
			case 'U':
				if (a != 1)
					a--;
				break;
			case 'D':
				if (a != x)
					a++;
				break;
		}
	}

}


import java.util.ArrayList;
import java.util.Scanner;
import java.util.Vector;

public class Algorithm {

	public static void main(String[] args) {

		Algorithm a = new Algorithm();
	}

	Scanner scan;

	public Algorithm() {
		scan = new Scanner(System.in);
		readData();
	}

	int x, y, a, b;
	int[][] g;
	String moves;
	public void readData() {
		x = scan.nextInt();
		y = scan.nextInt();
		a = scan.nextInt();
		b = scan.nextInt();
		g = new int[x + 1][y + 1];
		moves = scan.next();
		System.out.print(1 + " ");
		g[a][b] = 1;
		int count = 1;
		for (int k = 0; k < moves.length() - 1; k++){
			move(moves.charAt(k));
//			System.out.println(a + " " + b);

			if (g[a][b] != 1){
				count++;
				System.out.print(1 + " ");
			} else
				System.out.print(0 + " ");
			g[a][b] = 1;
		}
		move(moves.charAt(moves.length() - 1));
		System.out.print(x * y - count - g[a][b]);
//		System.out.println(g[a][b]);
	}
	public void move(char h){
		switch(h){
			case 'L':
				if (b != 1)
					b--;
				break;
			case 'R':
				if (b != y)
					b++;
				break;
			case 'U':
				if (a != 1)
					a--;
				break;
			case 'D':
				if (a != x)
					a++;
				break;
		}
	}

}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Artyom Korzun
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(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, FastScanner in, PrintWriter out) {
            int x = in.nextInt();
            int y = in.nextInt();

            int x0 = in.nextInt() - 1;
            int y0 = in.nextInt() - 1;

            char[] s = in.nextWord();

            int free = x * y - 1;
            boolean[][] was = new boolean[x][y];
            was[x0][y0] = true;

            out.print(1);
            for (int i = 0; i < s.length - 1; i++) {
                int deltaX = 0;
                int deltaY = 0;

                if (s[i] == 'U')
                    deltaX = -1;
                else if (s[i] == 'D')
                    deltaX = 1;
                else if (s[i] == 'L')
                    deltaY = -1;
                else
                    deltaY = 1;

                int newX = x0 + deltaX;
                int newY = y0 + deltaY;
                if (newX >= 0 && newX < x && newY >= 0 && newY < y) {
                    x0 = newX;
                    y0 = newY;
                }

                if (was[x0][y0]) {
                    out.print(" " + 0);
                } else {
                    out.print(" " + 1);
                    free--;
                }

                was[x0][y0] = true;
            }

            out.print(" " + free);
        }

    }

    static class FastScanner {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public FastScanner(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

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

        public char[] nextWord() {
            return next().toCharArray();
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(nextLine());

            return tokenizer.nextToken();
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

    }
}


//package c335;

import java.util.Scanner;

public class q2
{

    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int x=s.nextInt();
        int y=s.nextInt();
        int x0=s.nextInt()-1;
        int y0=s.nextInt()-1;
        int used=0;
        String a=s.next();
        boolean b[][]=new boolean[x][y];

        for(int i=0;i<a.length();i++)
        {
            if(b[x0][y0])
                System.out.print("0 ");
            else
                {
                System.out.print("1 ");
                used++;
                }
            b[x0][y0]=true;

            if(a.charAt(i)=='U' && x0!=0)
            {
                x0--;
            }
            else
                if(a.charAt(i)=='D' && x0!=x-1)
                {
                    x0++;
                }
                else
                    if(a.charAt(i)=='L' && y0!=0)
                    {
                        y0--;
                    }
                    else
                        if(a.charAt(i)=='R' && y0!=y-1)
                        {
                            y0++;
                        }
        }

        System.out.println(x*y-used);
    }

}


import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Div335B {
    static class N implements Comparable<N> {
        int a;
        long b;

        N(int x, int y) {
            a = x;
            b = y;
        }

        @Override
        public int compareTo(N o) {

            return Integer.compare(a, o.a);
        }
    }

    public static void main(String[] args) throws Exception {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String[] l = bf.readLine().split(" ");
        int n = Integer.parseInt(l[0]);
        int m = Integer.parseInt(l[1]) ;
        int leftCells = (n) * (m);
        int x = Integer.parseInt(l[2]) - 1;
        int y = Integer.parseInt(l[3]) - 1;
        boolean visited[][] = new boolean[n][m];
        char[] seq = bf.readLine().toCharArray();
        int ans[] = new int[seq.length + 1];
        ans[0] = 1;
        visited[x][y]=true;
        leftCells--;
        for (int i = 0; i < seq.length; i++) {
            int nX = seq[i] == 'U' ? x - 1 : seq[i] == 'D' ? x + 1 : x;
            int nY = seq[i] == 'L' ? y - 1 : seq[i] == 'R' ? y + 1 : y;
            if (nX < 0 || nX >= n || nY < 0 || nY >= m)
                ans[i + 1] = 0;
            else if (visited[nX][nY]) {
                x = nX;
                y = nY;
                ans[i + 1] = 0;
            } else {
                leftCells--;
                visited[nX][nY] = true;
                ans[i + 1] = 1;
                x = nX;
                y = nY;
            }
        }
        StringBuffer sb = new StringBuffer();
        ans[ans.length - 1] += leftCells;
        for (int i = 0; i < ans.length; i++) {
            sb.append(ans[i] + " ");
        }
        System.out.println(sb);
    }
}


import java.util.*;
public class ProB {
	static int n,m,a,b,l,ct;
	static String ss;
	static char[] s;
	static int[] ans=new int[100005];
	static int[][] vis=new int[505][505];
	static int[][] aa=new int[100005][2];

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		n=in.nextInt();m=in.nextInt();
		a=in.nextInt();b=in.nextInt();
		ss=in.next();s=ss.toCharArray();
		aa[0][0]=a;aa[0][1]=b;
		l=ss.length();
		for(int i=0;i<l;i++)
		{
			if(s[i]=='U'&&a>1) a--;
			else if(s[i]=='D'&&a<n) a++;
			else if(s[i]=='L'&&b>1) b--;
			else if(s[i]=='R'&&b<m) b++;
			aa[i+1][0]=a;aa[i+1][1]=b;
		}
		for(int i=0;i<=l;i++)
		{
			if(vis[aa[i][0]][aa[i][1]]==0)
			{
				ans[i]++;ct++;
			}
			vis[aa[i][0]][aa[i][1]]=1;
		}
		ans[l]+=n*m-ct;
		for(int i=0;i<=l;i++)
			System.out.print(ans[i]+(i==l?"":" "));
	}
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;

public class Cf606B {
    public static void main(String[] args) throws Exception {
        Scanner cin = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        PrintWriter cout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = cin.nextInt();
        int m = cin.nextInt();
        int x = cin.nextInt() - 1;
        int y = cin.nextInt() - 1;
        String s = cin.next();
        int steps = s.length();
        boolean[][] used = new boolean[n][m];
        int total = 0;
        for (int i = 0; i < steps; i++) {
            if (!used[x][y]) {
                total++;
                used[x][y] = true;
                cout.print("1 ");
            } else {
                cout.print("0 ");
            }
            switch (s.charAt(i)) {
                case 'U':
                    if (x - 1 >= 0) x--;
                    break;
                case 'D':
                    if (x + 1 < n) x++;
                    break;
                case 'L':
                    if (y - 1 >= 0) y--;
                    break;
                case 'R':
                    if (y + 1 < m) y++;
                    break;
                default:
                    assert false;
            }
        }
        cout.println(n * m - total);
        cout.close();
    }
}


import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static boolean local = false;
    static FReader sc;
    static PrintWriter pw;

    public static void main(String args[]) throws FileNotFoundException {
        if (args.length != 0) {
            local = true;
            sc = new FReader("/Users/qjex/prj/jolymp/src/input.txt");
            try {
                pw = new PrintWriter(new FileOutputStream("/Users/qjex/prj/jolymp/src/output.txt"), false);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            sc = new FReader(System.in);
            pw = new PrintWriter(System.out);
        }
        solve();
        pw.close();
        sc.close();
    }

    public static void solve(){
        int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt(), y = sc.nextInt();
        String s = sc.next();
        int f[][] = new int[n + 1][m + 1];
        for(int i = 1; i <= n; i++)
            for(int j = 1; j <= m; j++)
                f[i][j] = 1;
        f[x][y] = 0;
        int cnt = n * m - 1;
        pw.print(1 + " ");
        for(int i = 0; i < s.length(); i++){
            switch (s.charAt(i)){
                case 'U' : x--; break;
                case 'D' : x++; break;
                case 'L' : y--; break;
                case 'R' : y++; break;
            }
            if (i == s.length() - 1){
                pw.print(cnt);
                continue;
            }
            x = Math.max(x, 1);
            y = Math.max(y, 1);
            x = Math.min(x, n);
            y = Math.min(y, m);
            if (f[x][y] == 0){
                pw.print(0 + " ");
                continue;
            }
            pw.print(1 + " ");
            f[x][y] = 0;
            cnt--;
        }
    }
}

class FReader {

    BufferedReader br;
    StringTokenizer st;

    FReader(String file) {
        try {
            br = new BufferedReader(new FileReader(file));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        st = new StringTokenizer("");
    }

    FReader(InputStream is) {
        br = new BufferedReader(new InputStreamReader(is));
        st = new StringTokenizer("");
    }

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

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

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

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

    BigInteger nextBigInteger(){ return new BigInteger(next()); }

    public void close() {
        try {
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

class Pair<L,R> {

    private final L left;
    private final R right;

    public Pair(L left, R right) {
        this.left = left;
        this.right = right;
    }

    public L getLeft() { return left; }
    public R getRight() { return right; }
}

class Algo {

}


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

public class Solution {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;

    static final int Mod = 1000000007;

    void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        int x = nextInt();
        int y = nextInt();
        String s = nextString();
        int f[][] = new int[n + 1][m + 1];
        for (int i[] : f) Arrays.fill(i, -1);
        f[x][y] = 0;
        int k[] = new int[s.length() + 1];
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c == 'U') {
                if (x - 1 > 0) {
                    x--;
                    if (f[x][y] == -1) f[x][y] = i + 1;
                }
            } else if (c == 'D') {
                if (x + 1 <= n) {
                    x++;
                    if (f[x][y] == -1) f[x][y] = i + 1;
                }
            } else if (c == 'R') {
                if (y + 1 <= m) {
                    y++;
                    if (f[x][y] == -1) f[x][y] = i + 1;
                }
            } else if (c == 'L') {
                if (y - 1 > 0) {
                    y--;
                    if (f[x][y] == -1) f[x][y] = i + 1;
                }
            }
        }
        int cnt = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++)
                if (f[i][j] != -1) {
                    k[f[i][j]]++;
                } else cnt++;
        }
        for (int i = 0; i < k.length - 1; i++) out.print(k[i] + " ");
        out.println(cnt + 1);
    }

    Solution() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }

    String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }

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

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

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


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

public class Solution {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;

    static final int Mod = 1000000007;

    void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        int x = nextInt();
        int y = nextInt();
        String s = nextString();
        boolean f[][] = new boolean[n + 1][m + 1];
        for (boolean i[] : f) Arrays.fill(i, false);
        int q = 0;
        for (int i = 0; i < s.length(); i++) {
            if (!f[x][y]) {
                out.print(1 + " ");
                q++;
            } else out.print(0 + " ");
            f[x][y] = true;
            char c = s.charAt(i);
            if (c == 'L' && y - 1 > 0) y--;
            else if (c == 'R' && y + 1 <= m) y++;
            else if (c == 'U' && x - 1 > 0) x--;
            else if (c == 'D' && x + 1 <= n) x++;
        }
        out.println(n * m - q);
    }

    Solution() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }

    String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }

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

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

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author baukaman
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(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, InputReader in, PrintWriter out) {
      int n = in.nextInt(), m = in.nextInt();
      int x0 = in.nextInt();
      int y0 = in.nextInt();
      Set<Integer> hm = new HashSet<>();
      String s = in.next();

      for (int i = 0; i < s.length(); i++) {
        if (hm.contains(x0 * m + y0))
          out.print(0 + " ");
        else
          out.print(1 + " ");

        hm.add(x0 * m + y0);

        switch (s.charAt(i)) {
          case 'U':
            x0 = (x0 > 1 ? x0 - 1 : x0);
            break;
          case 'D':
            x0 = (x0 + 1 <= n ? x0 + 1 : x0);
            break;
          case 'L':
            y0 = (y0 > 1 ? y0 - 1 : y0);
            break;
          case 'R':
            y0 = (y0 + 1 <= m ? y0 + 1 : y0);
            break;
        }
      }

      out.println(n * m - hm.size());
    }

  }

  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());
    }

  }
}


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

public class Solution {
    public static void main(String[] args)
        throws Exception {
        new Solution().start();
    }

    public void start()
        throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        calc(br);
    }

    void calc(BufferedReader br) throws Exception {
        String[] line1 = br.readLine().split(" ");
        String line2 = br.readLine();
        int x = Integer.parseInt(line1[2]);
        int y = Integer.parseInt(line1[3]);
        int maxX = Integer.parseInt(line1[0]);
        int maxY = Integer.parseInt(line1[1]);
        List<Integer> l = new ArrayList<Integer>();
        l.add(x);
        l.add(y);

        HashSet<List<Integer>> set = new HashSet<List<Integer>>();
        set.add(l);
        System.out.print("1");
        int cnt = 1;
        for (int i = 0; i <= line2.length() - 2; i++) {
            char c = line2.charAt(i);
            switch(c) {
                case 'U':
                    if (x - 1 > 0) {
                        x--;
                    }
                    break;
                case 'D':
                    if (x + 1 <= maxX) {
                        x++;
                    }
                    break;
                case 'L':
                    if (y - 1 > 0) {
                        y--;
                    }
                    break;
                case 'R':
                    if (y + 1 <= maxY) {
                        y++;
                    }
                    break;
                default:
                    break;
            }
            List<Integer> list = new ArrayList<Integer>();
            list.add(x);
            list.add(y);
            if (set.contains(list) == false) {
                System.out.print(" 1");
                set.add(list);
                cnt++;
            } else {
                System.out.print(" 0");
            }
        }
        char c = line2.charAt(line2.length() - 1);
        switch(c) {
            case 'U':
                if (x - 1 > 0) {
                    x--;
                }
                break;
            case 'D':
                if (x + 1 <= maxX) {
                    x++;
                }
                break;
            case 'L':
                if (y - 1 > 0) {
                    y--;
                }
                break;
            case 'R':
                if (y + 1 <= maxY) {
                    y++;
                }
                break;
            default:
                break;
        }
        List<Integer> list = new ArrayList<Integer>();
        list.add(x);
        list.add(y);
        System.out.print(" " + ((maxX * maxY) - cnt));
    }
}