working n mod m soln in rb