import sys input = sys.stdin.readline A,B=map(int,input().split()) S=input().strip() NOW=[A,B] USED=set() USED.add((A,B)) ANS=[] for s in S: x,y=NOW if 0<=x<=A and 0<=y<=B: True else: print(-1) sys.exit() if s=="L": NOW[1]-=1 USED.add(tuple(NOW)) elif s=="U": NOW[0]-=1 USED.add(tuple(NOW)) elif s=="R": x,y=NOW if (x,y+1) in USED: NOW=[x,y+1] else: ANS.append((x,y+1)) elif s=="D": x,y=NOW if (x+1,y) in USED: NOW=[x+1,y] else: ANS.append((x+1,y)) for x,y in USED: if 0<=x<=A and 0<=y<=B: True else: print(-1) sys.exit() print(len(ANS)) for x,y in ANS: print(x,y)