[cpp] add n mod m