func main() var n: int :: cui@inputInt() var m: int :: cui@inputInt() var nums: []int :: #[n]int var reverseFlag: bool :: false var id: int :: 0 var prev: []char :: "-" var add: int :: 0 for i(1, m) var s: []char :: cui@inputStr() if(prev[0] = 'd' & s <> prev) do nums[id] :- add do add :: 0 do next(&id, reverseFlag, n) end if do nums[id] :+ 1 switch(s) case "drawtwo" do add :+ 2 case "drawfour" do add :+ 4 case "skip" if(i <> m) do next(&id, reverseFlag, n) end if case "reverse" do reverseFlag :: !reverseFlag end switch do prev :: s if(i <> m) do next(&id, reverseFlag, n) end if end for do cui@print("\{id + 1} \{nums[id]}\n") func next(id: &int, reverseFlag: bool, n: int) do id :+ reverseFlag ?(n - 1, 1) do id :% n end func end func