#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines A, B = map(int, readline().split()) S = readline().rstrip().decode() wall = set() path = set() path.add((A, B)) H = A W = B for s in S: if s == 'R': if (A, B + 1) not in path: wall.add((A, B + 1)) else: B += 1 elif s == 'L': if (A, B - 1) in wall or B == 0: continue B -= 1 path.add((A, B)) elif s == 'U': if (A - 1, B) in wall or A == 0: continue A -= 1 path.add((A, B)) elif s == 'D': if (A + 1, B) not in path: wall.add((A + 1, B)) if (A,B) != (0, 0): print(-1) exit() wall = [(x, y) for x, y in wall if 0 <= x <= H and 0 <= y <= W] print(len(wall)) for x, y in wall: print(x, y)