The Cybernetics Failures (CF) organisation made a prototype of a bomb technician robot. To find the possible problems it was decided to carry out a series of tests. At the beginning of each test the robot prototype will be placed in cell (x_0, y_0) of a rectangular squared field of size x × y, after that a mine will be installed into one of the squares of the field. It is supposed to conduct exactly x·y tests, each time a mine is installed into a square that has never been used before. The starting cell of the robot always remains the same.

After placing the objects on the field the robot will have to run a sequence of commands given by string s, consisting only of characters 'L', 'R', 'U', 'D'. These commands tell the robot to move one square to the left, to the right, up or down, or stay idle if moving in the given direction is impossible. As soon as the robot fulfills all the sequence of commands, it will blow up due to a bug in the code. But if at some moment of time the robot is at the same square with the mine, it will also blow up, but not due to a bug in the code.

Moving to the left decreases coordinate y, and moving to the right increases it. Similarly, moving up decreases the x coordinate, and moving down increases it.

The tests can go on for very long, so your task is to predict their results. For each k from 0 to length(s) your task is to find in how many tests the robot will run exactly k commands before it blows up.


-----Input-----

The first line of the input contains four integers x, y, x_0, y_0 (1 ≤ x, y ≤ 500, 1 ≤ x_0 ≤ x, 1 ≤ y_0 ≤ y) — the sizes of the field and the starting coordinates of the robot. The coordinate axis X is directed downwards and axis Y is directed to the right.

The second line contains a sequence of commands s, which should be fulfilled by the robot. It has length from 1 to 100 000 characters and only consists of characters 'L', 'R', 'U', 'D'.


-----Output-----

Print the sequence consisting of (length(s) + 1) numbers. On the k-th position, starting with zero, print the number of tests where the robot will run exactly k commands before it blows up.


-----Examples-----
Input
3 4 2 2
UURDRDRL

Output
1 1 0 1 1 1 1 0 6

Input
2 2 2 2
ULD

Output
1 1 1 1



-----Note-----

In the first sample, if we exclude the probable impact of the mines, the robot's route will look like that: $(2,2) \rightarrow(1,2) \rightarrow(1,2) \rightarrow(1,3) \rightarrow(2,3) \rightarrow(2,4) \rightarrow(3,4) \rightarrow(3,4) \rightarrow(3,3)$.

Difficulty: interview

Starter code:

Solutions:
a, b, x, y = map(int, input().split())
s = input()
p = []
for i in range(a + 1):
    p.append([0] * (b + 1))
sum = 0
for i in range(len(s)):
    if p[x][y] == 0:
        p[x][y] = 1
        print(1, end = ' ')
        sum += 1
    else:
        print(0, end = ' ')
    if s[i] == 'U' and x != 1:
        x -= 1
    if s[i] == 'D' and x != a:
        x += 1
    if s[i] == 'L' and y != 1:
        y -= 1
    if s[i] == 'R' and y != b:
        y += 1
print(a * b - sum)

        


x, y, x0, y0 = map(int, input().split())
moves = input()

seen = [[False] * y for i in range(x)]
currX, currY = x0 - 1, y0 - 1

total = 0

for i in range(len(moves)):
    #print(currX, currY)
    #print("Seen:", seen[currX][currY])
    #print()
    if not seen[currX][currY]:
        print("1", end=" ")
        total += 1
    else:
        print("0", end=" ")
    seen[currX][currY] = True
    if moves[i] == "L":
        currY = max(currY - 1, 0)
    elif moves[i] == "R":
        currY = min(currY + 1, y - 1)
    elif moves[i] == "U":
        currX = max(currX - 1, 0)
    else:
        currX = min(currX + 1, x - 1)
print(x * y - total)

#!/usr/bin/env python3

DELTAS = {
    'U': (-1, 0),
    'R': (0, 1),
    'D': (1, 0),
    'L': (0, -1),
}

try:
    while True:
        h, w, y, x = map(int, input().split())
        y -= 1
        x -= 1
        s = input()
        total = h * w - 1
        used = [[False] * w for i in range(h)]
        used[y][x] = True
        print(end="1 ")
        last = len(s) - 1
        for i, c in enumerate(s):
            dy, dx = DELTAS[c]
            ny = y + dy
            nx = x + dx
            if 0 <= ny < h and 0 <= nx < w:
                if i != last:
                    if used[ny][nx]:
                        print(end="0 ")
                    else:
                        print(end="1 ")
                        used[ny][nx] = True
                        total -= 1
                y = ny
                x = nx
            elif i != last:
                print(end="0 ")
        print(total)

except EOFError:
    pass


x, y, x0, y0 = list(map(int, input().split()))
a = [[0] * (y + 1) for i in range(x + 1)]
s = input()
count = x * y
result = [0] * (len(s))
for i in range(len(s)):
    if a[x0][y0] == 0:
        a[x0][y0] = 1
        result[i] = 1
        count -= 1
    if s[i] == 'U' and x0 > 1:
        x0 -=1
    elif s[i] == 'D' and x0 < x:
        x0 +=1
    elif s[i] == 'L' and y0 > 1:
        y0 -= 1
    elif s[i] == 'R' and y0 < y:
        y0 += 1
        
print(" ".join(map(str,result)), count)


#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import time

#   = input()
#   = int(input())

#() = (i for i in input().split())
#   = [i for i in input().split()]

(a, b, x, y) = (int(i) for i in input().split())

s   = input()
ans = [0 for i in range(len(s) + 1) ]

start = time.time()

acc = 0
x  -= 1
y  -= 1

map = [[ 0 for i in range(b)] for j in range(a)]

for i in range(len(s)):
    if map[x][y] == 0:
        ans[i] += 1
        map[x][y] = 1
    if s[i] == 'L' and y > 0:
        y -= 1
    elif s[i] == 'R' and y < b-1:
        y += 1
    elif s[i] == 'D' and x < a-1:
        x += 1
    elif s[i] == 'U' and x > 0:
        x -= 1


ans[len(s)] = a*b - sum([sum(i) for i in map])

for i in ans:
    print(i, end= ' ')
print()
finish = time.time()
#print(finish - start)


x, y, a, b = list(map(int, input().split()))

s = input()

m = [[0] * y for i in range(x)]

ans = '1 '
k = 1
m[a - 1][b - 1] = 1

for i in range(len(s)):
    if s[i] == 'D':
        a = min (a + 1, x)
        m[a - 1][b - 1] += 1
        if m[a - 1][b - 1] == 1:
            k += 1
            ans += '1 '
        else:
            ans += '0 '

    elif s[i] == 'U':
        a = max (a - 1, 1)
        m[a - 1][b - 1] += 1
        if m[a - 1][b - 1] == 1:
            k += 1
            ans += '1 '
        else:
            ans += '0 '

    elif s[i] == 'R':
        b = min (b + 1, y)
        m[a - 1][b - 1] += 1
        if m[a - 1][b - 1] == 1:
            k += 1
            ans += '1 '
        else:
            ans += '0 '

    else:
        b = max (b - 1, 1)
        m[a - 1][b - 1] += 1
        if m[a - 1][b - 1] == 1:
            k += 1
            ans += '1 '
        else:
            ans += '0 '


ans = ans[:-1]
k -= int(ans[-1])
ans = ans[:-1]
ans += str(x * y - k)

print(ans)
        
    


x, y, x0, y0 = map(int, input().split())

S = input()

s = []
for i in range(len(S)):
    s.append(S[i])

X = [[0 for i in range(y + 2)] for j in range(x + 2)]

for i in range(y + 2):
    X[0][i] = -1
    X[x + 1][i] = -1

for i in range(x + 2):
    X[i][0] = -1
    X[i][y + 1] = -1


X[x0][y0] = 1
result = [1]
nr_explore = 1

for move in s:
    dx = 0
    dy = 0
    if move == 'U':
        dx = -1
        dy = 0
    elif move == 'D':
        dx = 1
        dy = 0
    elif move == 'R':
        dx = 0
        dy = 1
    elif move == 'L':
        dx = 0
        dy = -1

    if X[x0 + dx][y0 + dy] != -1:
        x0 += dx
        y0 += dy
        if X[x0][y0] == 0:
            nr_explore += 1
            X[x0][y0] = 1
            result.append(1)
        else:
            result.append(0)
    else:
        result.append(0)

result[-1] += x * y - nr_explore
for r in result:
    print(r, end=" ")


A, B, C, D = input().split()
a = int(A)
b = int(B)
c = int(C)
d = int(D)
lista = [[0 for i in range(555)] for j in range(555)]
c -= 1
d -= 1
lista[c][d] = 1
s = input()
k = len(s)
l = 1
print("1 ", end = "")
for i in range(k):
	if i + 1 == k:
		print(a * b - l)
		break
	if s[i] == 'U':
		if c:
			c -= 1
	elif s[i] == 'D':
		if c < a-1:
			c += 1
	elif s[i] == 'R':
		if d < b - 1:
			d += 1
	else:
		if d:
			d -= 1
	if lista[c][d] == 0:
		print("1 ", end = "")
		l += 1
	else:
		print("0 ", end = "")
	lista[c][d] = 1
	


x, y, x0, y0 = [int(x) for x in input().split()]
x0 -= 1
y0 -= 1
commands = input()
xy = x * y
l = len(commands)
a = [0] * (l + 1)
n = 0
field = [[-1]*y for i in range(x)]
field[x0][y0] = 0
for i in range(l):
	command = commands[i];
	if command == 'U':
		if x0 > 0:
			x0 -= 1
	elif command == 'D':
		if x0 + 1 < x:
			x0 += 1
	elif command == 'L':
		if y0 > 0:
			y0 -= 1
	elif command == 'R':
		if y0 + 1 < y:
			y0 += 1
	if field[x0][y0] < 0:
		field[x0][y0] = i + 1
for i in range(x):
	for j in range(y):
		a[field[i][j]] += 1
print(' '.join(str(x) for x in a))



__author__ = 'MoonBall'

import sys
# sys.stdin = open('data/B.in', 'r')
T = 1

def process():
    x, y, x0, y0 = list(map(int, input().split()))
    s = input()
    d = {}
    L = len(s)

    cnt = [0] * (L + 1)
    d[x0] = {}
    d[x0][y0] = 0

    for idx, _s in enumerate(s):
        if _s == 'L':
            y0 = max(1, y0 - 1)
        elif _s == 'R':
            y0 = min(y, y0 + 1)
        elif _s == 'U':
            x0 = max(1, x0 - 1)
        elif _s == 'D':
            x0 = min(x, x0 + 1)

        if not d.get(x0):
            d[x0] = {}
        t = d[x0]
        if t.get(y0) == None:
            t[y0] = idx + 1

    for i, _ in list(d.items()):
        for j, v in list(_.items()):
            cnt[v] = cnt[v] + 1

    cnt[L] = cnt[L] + x * y - sum(cnt)
    print(' '.join(map(str, cnt[0:L+1])))







for _ in range(T):
    process()


x, y, x0, y0 = tuple(map(int, input().split()))
s = input()
l = len(s)
res = [0] * (l + 1)
location = [x0, y0]
movement = {tuple(location)}
for i in range(1, l + 1):
    let = s[i - 1]
    #print(location)
    if let == 'L':
        if location[1] - 1 > 0: 
            location[1] -= 1
    if let == 'R':
        if location[1] + 1 <= y:
            location[1] += 1
    if let == 'U':
        if location[0] - 1 > 0:
            location[0] -= 1        
    if let == 'D':
        if location[0] + 1 <= x:
            location[0] += 1
    if tuple(location) in movement: res[i] = 0
    else: res[i] = 1
    movement.add(tuple(location))
res[0] = 1


res[l] += x * y - sum(res)
    
    
        
print(' '.join(list(map(str, res))))
        


# fin = open("cfr335a.in", "r")

# x, y, xc, yc = map(int, fin.readline().strip().split())
x, y, xc, yc = map(int, input().strip().split())
yc -= 1; xc -= 1
# program = fin.readline().strip()
program = input().strip()
commands = {'U': (-1, 0), 'D': (1, 0), 'R': (0, 1), 'L': (0, -1)}

used = [[False] * y for i in range(x)]
used[xc][yc] = True

result = []

print(1, end=' ')
# print(xc + 1, yc + 1)
cnt = 1
for i in range(len(program)):
    cmd = program[i]
    xc += commands[cmd][0] if -1 < xc + commands[cmd][0] < x else 0
    yc += commands[cmd][1] if -1 < yc + commands[cmd][1] < y else 0
    if not used[xc][yc] and i != len(program) - 1:
        print(1, end=' ')
        result.append(1)
        cnt += 1
        # used[xc][yc] = True
    elif i != len(program) - 1:
        print(0, end=' ')
        result.append(0)
    else:
        # print(x*y - cnt - (1 if used[xc][yc] else 0), end=' ')
        print(x*y - cnt, end=' ')
    used[xc][yc] = True
    # print(xc + 1, yc + 1)
# print()
# print(1, end=' ')
# for res in result:
#     print(res, end=' ')
# # print(x*y - cnt - (1 if used[xc][yc] else 0))
# print(x*y - cnt)

x, y, x0, y0 = list(map(int, input().split()))
s = input()
s = s[:len(s) - 1]
visited = [[False for i in range(y + 1)] for j in range(x + 1)]
visited[x0][y0] = True
ans = '1 '
cnt = 1
for i in s:
    if i == 'U':
        if x0 != 1:
            x0 -= 1
            if not visited[x0][y0]:
                ans += '1 '
                cnt += 1
                visited[x0][y0] = True
            else:
                ans += '0 '
        else:
            ans += '0 '
    elif i == 'D':
        if x0 != x:
            x0 += 1
            if not visited[x0][y0]:
                ans += '1 '
                cnt += 1
                visited[x0][y0] = True
            else:
                ans += '0 '
        else:
            ans += '0 '
    elif i == 'L':
        if y0 != 1:
            y0 -= 1
            if not visited[x0][y0]:
                ans += '1 '
                cnt += 1
                visited[x0][y0] = True
            else:
                ans += '0 '
        else:
            ans += '0 '
    else:
        if y0 != y:
            y0 += 1
            if not visited[x0][y0]:
                ans += '1 '
                cnt += 1
                visited[x0][y0] = True
            else:
                ans += '0 '
        else:
            ans += '0 '
z = str(x * y - cnt)
print(ans + z)


__author__ = 'Utena'
x,y,x0,y0=list(map(int,input().split()))
x1=x0
y1=y0
s=list(input())
k=0
l=[]
l1=[[x0,y0]]
l2=[[0]*(y+1)for i in range(x+1)]
for i in s:
    if i=="R" and y0<y:
        y0+=1
        l1.append([x0,y0])
    elif i=="L" and y0>1:
        y0-=1
        l1.append([x0,y0])
    elif i=="U" and x0>1:
        x0-=1
        l1.append([x0,y0])
    elif i=="D" and x0<x:
        x0+=1
        l1.append([x0,y0])
    else:
        l1.append([x0,y0])
for j in range(len(s)):
    x1=l1[j][0]
    y1=l1[j][1]
    l2[x1][y1]+=1
    if l2[x1][y1]>1:l.append('0')
    else:
        l.append("1")
        k+=1
print(" ".join(l)+" %d"%(x*y-k))


x, y, x0, y0 = [int(x) for x in input().split()]
s = input()
was_in = [[False for y1 in range(y+1)] for x1 in range(x + 1)]
length = 1
moves = {'D' : (1, 0), 'U' : (-1, 0), 'R' : (0, 1), 'L' : (0, -1)}
state = (x0, y0)
count = [1]
was_in[x0][y0] = True
for c in s:
    new_state = (state[0] + moves[c][0], state[1] + moves[c][1])
    new_state = new_state if 0 < new_state[0] <= x and 0 < new_state[1] <= y else state
    state = new_state
    if was_in[state[0]][state[1]]:
        count.append(0)
    else:
        count.append(1)
        was_in[state[0]][state[1]] = True
        length += 1
count[-1] += x * y - length
for i in count:
    print(i, end = ' ')


x, y, x0, y0 = list(map(int, input().split(' ')))
g = [[0]* (y+1) for i in range(x + 1)]
s = input()
result = [0] * len(s)
count = x*y
for i in range(len(s)):
	if g[x0][y0] == 0:
		g[x0][y0] = 1
		result[i] = 1
		count -= 1
	if s[i] == 'U' and x0 > 1:
		x0 -=1
	if s[i] == 'D' and x0 < x:
		x0 += 1
	if s[i] == 'L' and y0 > 1:
		y0 -= 1
	if s[i] == 'R' and y0 < y:
		y0 += 1
print(' '.join(map(str, result)), count)


q,b,c,d = map(int,input().split())
s = input()
x,y =c,d
l = 1
print(1,end = ' ')
a = set()
a.add((c,d))
for i in range(len(s)-1):
    item = s[i]
    if (item == 'U'):
        if(x == 1 or (x-1,y) in a):
            print(0,end = ' ')
            if(x-1,y) in a:
                x-=1
        else:
            print(1,end = ' ')
            x-=1
            l+=1
    elif item == 'R':
        if(y == b or (x,y+1) in a):
            print(0,end =' ')
            if(x,y+1) in a:
                y+=1
        else:
            print(1,end = ' ')
            y+=1
            l+=1
    elif item == 'L':
        if(y == 1 or (x,y-1) in a):
            print(0,end = ' ')
            if(x,y-1) in a:
                y-=1
        else:
            print(1,end = ' ')
            y-=1
            l+=1
    else:
        if(x == q or (x+1,y) in a):
            print(0,end = ' ')
            if(x+1,y) in a:
                x+=1
        else:
            print(1,end = ' ')
            x+=1
            l+=1
    a.add((x,y))
print(q*b-l)

x, y, sx, sy = map(int, input().split())
sx, sy = sx - 1, sy - 1

direction = {'U' : (-1, 0), 'D' : (1, 0), 'L' : (0, -1), 'R' : (0, 1)}

visited = [[False] * y for i in range(x)]
prev = sx, sy

s = input()
sm = x * y - 1

print (1, end = ' ')
visited[prev[0]][prev[1]] = True

for c in s[:-1]:
    d = direction[c]
    cur = tuple(map(sum, zip(prev, d)))
    if not 0 <= cur[0] < x or not 0 <= cur[1] < y:
        cur = prev
    p = 1 - visited[cur[0]][cur[1]]
    print (p, end = ' ')
    sm -= p
    visited[cur[0]][cur[1]] = True
    prev = cur

print (sm)




n, m, x, y = [int(x) for x in input().split(" ")]
commands = input()

#n, m, x, y = [3, 4, 2, 2]
#commands = "UURDRDRL"

x, y = x - 1, y - 1

move = dict([
    ("U", (-1, 0)),
    ("D", (1, 0)),
    ("L", (0, -1)),
    ("R", (0, 1))
])

place = set()
place.add((x, y))
print("1", end=" ")

for command in commands[:-1]:
    oldX, oldY = x, y
    x, y = x + move[command][0], y + move[command][1]
    # print("x,y: ", x, y)
    if (x < 0 or y < 0) or (x >= n or y >= m):
        print("0", end=" ")
        x, y = oldX, oldY
        continue
    else:
        if (x, y) in place:
            print(0, end=" ")
        else:
            print("1", end=" ")
    place.add((x, y))

x, y = x + move[commands[-1]][0], y + move[commands[-1]][1]

#print()
#print(place)
#print()
if (x < 0 or y < 0) or (x >= n or y >= m):
    print("0")
else:
    print(n * m - len(place))


#!/usr/bin/env python3
# 606B_robots.py - Codeforces.com/problemset/problem/606/B by Sergey 2015

import unittest
import sys

###############################################################################
# Robots Class (Main Program)
###############################################################################


class Robots:
    """ Robots representation """

    def __init__(self, test_inputs=None):
        """ Default constructor """

        it = iter(test_inputs.split("\n")) if test_inputs else None

        def uinput():
            return next(it) if it else sys.stdin.readline().rstrip()

        # Reading single elements
        [self.x, self.y, self.x0, self.y0] = list(map(int, uinput().split()))

        # Reading a single line of multiple elements
        self.nums = list(uinput())

    def calculate(self):
        """ Main calcualtion function of the class """

        xy = self.x * self.y
        loc = (self.x0, self.y0)
        locs = set([loc])
        result = [1]
        for (i, d) in enumerate(self.nums):
            nx, ny = loc
            if d == "U":
                nx = max(1, loc[0] - 1)
            if d == "D":
                nx = min(self.x, loc[0] + 1)
            if d == "L":
                ny = max(1, loc[1] - 1)
            if d == "R":
                ny = min(self.y, loc[1] + 1)
            loc = (nx, ny)
            if len(locs) == xy:
                result.append(0)
            elif i == len(self.nums) - 1:
                result.append(xy - len(locs))
            elif loc in locs:
                result.append(0)
            else:
                result.append(1)
            locs.add(loc)

        return " ".join(map(str, result))

###############################################################################
# Unit Tests
###############################################################################


class unitTests(unittest.TestCase):

    def test_single_test(self):
        """ Robots class testing """

        # Constructor test
        test = "3 4 2 2\nUURDRDRL"
        d = Robots(test)
        self.assertEqual(d.x, 3)
        self.assertEqual(d.y, 4)
        self.assertEqual(d.x0, 2)
        self.assertEqual(d.y0, 2)
        self.assertEqual(d.nums[:2], ["U", "U"])

        # Sample test
        self.assertEqual(Robots(test).calculate(), "1 1 0 1 1 1 1 0 6")

        # Sample test
        test = "2 2 2 2\nULD"
        self.assertEqual(Robots(test).calculate(), "1 1 1 1")

        # Sample test
        test = ""
        # self.assertEqual(Robots(test).calculate(), "0")

        # My tests
        test = ""
        # self.assertEqual(Robots(test).calculate(), "0")

        # Time limit test
        # self.time_limit_test(5000)

    def time_limit_test(self, nmax):
        """ Timelimit testing """
        import random
        import timeit

        # Random inputs
        test = str(nmax) + " " + str(nmax) + "\n"
        numnums = [str(i) + " " + str(i+1) for i in range(nmax)]
        test += "\n".join(numnums) + "\n"
        nums = [random.randint(1, 10000) for i in range(nmax)]
        test += " ".join(map(str, nums)) + "\n"

        # Run the test
        start = timeit.default_timer()
        d = Robots(test)
        calc = timeit.default_timer()
        d.calculate()
        stop = timeit.default_timer()
        print(("\nTimelimit Test: " +
              "{0:.3f}s (init {1:.3f}s calc {2:.3f}s)".
              format(stop-start, calc-start, stop-calc)))

def __starting_point():

    # Avoiding recursion limitaions
    sys.setrecursionlimit(100000)

    if sys.argv[-1] == "-ut":
        unittest.main(argv=[" "])

    # Print the result string
    sys.stdout.write(Robots().calculate())

__starting_point()

"""
Codeforces Round #335 (Div. 2)
Problem 606 B. Testing Robots

@author yamaton
@date 2015-12-11
"""

import itertools as it
import functools
import operator
import collections
import math
import sys


def solve(x, y, x0, y0, s):
    dir = {'L': (0, -1), 'R': (0, 1), 'U': (-1, 0), 'D': (1, 0)}
    seen = set()
    pos = (x0, y0)
    result = []

    for c in s:
        if pos in seen:
            result.append(0)
        else:
            result.append(1)
            seen.add(tuple(pos))
        dx, dy = dir[c]
        (nx, ny) = (pos[0] + dx, pos[1] + dy)
        pos0 = nx if 1 <= nx <= x else pos[0]
        pos1 = ny if 1 <= ny <= y else pos[1]
        pos = (pos0, pos1)
        # pp(pos)

    result.append(x * y - len(seen))
    return result


def pp(*args, **kwargs):
    return print(*args, file=sys.stderr, **kwargs)


def main():
    x, y, x0, y0 = map(int, input().split())
    s =  input().strip()
    result = solve(x, y, x0, y0, s)
    print(*result)


def __starting_point():
    main()

__starting_point()

rows, cols, r, c = map(int, input().split())
s = input()
r -= 1
c -= 1

field = [[0] * cols for i in range(rows)]
res = [0] * len(s)

field[r][c] = 1
cnt = 1

for i in range (len(s)):
    if s[i] == 'U':
        if r > 0 : r -= 1
    elif s[i] == 'R':
        if c < cols - 1: c += 1
    elif s[i] == 'D':
        if r < rows - 1: r += 1
    elif s[i] == 'L':
        if c > 0: c -= 1
    
    if field[r][c] == 0:
        res[i] = 1
        cnt += 1
        field[r][c] = 1    

res[len(s) - 1] += rows * cols - cnt

print (1, ' '.join(map(str, res)))

rs, cs, r, c = map(int, input().split())
s = input()
r -= 1
c -= 1

f = [[0] * cs for i in range(rs)]
res = [0] * len(s)
cnt = 0

for i in range (len(s)):
    if f[r][c] == 0:
        res[i] = 1
        cnt += 1
        f[r][c] = 1    

    if s[i] == 'U' and r > 0:
        r -= 1
    elif s[i] == 'R' and c < cs - 1:
        c += 1
    elif s[i] == 'D' and r < rs - 1:
        r += 1
    elif s[i] == 'L' and c > 0:
        c -= 1
    
print (' '.join(map(str, res)), rs * cs - cnt)

x, y, x0, y0 = map(int, input().split())
s = input()
z = set()
k = (len(s)+1)*[0]
k[0] = 1
u = 0
z.add((x0, y0))
for i in s:
    u += 1
    if i == 'U' and x0 > 1:
        x0 -= 1
    elif i == 'D' and x0 < x:
        x0 += 1
    elif i == 'L' and y0 > 1:
        y0 -= 1
    elif i == 'R' and y0 < y:
        y0 += 1
    
    if not (x0, y0) in z:
        k[u]+=1
        z.add((x0, y0))
    
k[len(s)] += (x*y)-sum(k)
for i in k:
    print(i, end=' ')


x,y,x0,y0=list(map(int,input().split()))
s1=input()
r=x*y
res="1 "
k=1
a = [[0] * y for i in range(x)]
a[x0-1][y0-1]=1
for i in range(len(s1)-1):
    if s1[i]=="U":
        if x0-1>=1 and k<r:
            x0=x0-1
            if a[x0-1][y0-1]==0:
                res=res+"1 "
                k=k+1
                a[x0-1][y0-1]=1
            else:
                res=res+"0 "
        else:
            res=res+"0 "
    if s1[i]=="D":
        if x0+1<=x and k<r:
            x0=x0+1
            if a[x0-1][y0-1]==0:
                res=res+"1 "
                k=k+1
                a[x0-1][y0-1]=1
            else:
                res=res+"0 "
        else:
            res=res+"0 "
    if s1[i]=="L":
        if y0-1>=1 and k<r:
            y0=y0-1
            if a[x0-1][y0-1]==0:
                res=res+"1 "
                k=k+1
                a[x0-1][y0-1]=1
            else:
                res=res+"0 "
        else:
            res=res+"0 "
    if s1[i]=="R":
        if y0+1<=y and k<r:
            y0=y0+1
            if a[x0-1][y0-1]==0:
                res=res+"1 "
                k=k+1
                a[x0-1][y0-1]=1
            else:
                res=res+"0 "
        else:
            res=res+"0 "
print(res+str(r-k))