import sequtils, strutils, algorithm, math, future, sets, tables, hashes, intsets, deques let read = iterator : string {.closure.} = (while true: (for s in stdin.readLine.split : yield s)) var n,m = read().parseint a = newSeqWith(n, read().parseint) s = read() room = initDeque[int]() for i in 0 ..< n: room.addlast a[i] for i in 0 ..< s.len: if s[i] == 'L': room.addlast 0 var a = room.popfirst b = room.popfirst room.addfirst a + b if s[i] == 'R': room.addfirst 0 var a = room.poplast b = room.poplast room.addlast a + b echo toseq(room).join(" ")