Modular SUM doubt

what is the difference between:

( (a%m)+(b%m) )%m; // if say, x

( ( ( (a%m)+(b%m) )%m )+m)%m; // then (x+m) % m

which one to use ? (I have an intuition that 2nd is a superset but I’m not sure ! )

yes second one is superset

if a and b are positive then both are correct
but if a and b can be negative then first one is wrong

@asaurabh_26

Ok… using above I can have below for multiply:
( ( ( (a%m)*(b%m) )%m )+m)%m;

How can I convert following ? Can you please convert these two as sub and div have different formulas w.r.t mul/add

// for SUB
((a%m)-(b%m)+m)%m;

// for DIV
((a%m)*( B %m))%m; // B is mult. inverse

@asaurabh_26

let me re-frame my doubt

Like you said that
this,
( ( ( (a%m)+(b%m) )%m )+m)%m;

is a superset of this,
( (a%m)+(b%m) )%m;

as the prior also works for negative integers !

I am asking for superset formula for the following two:-

// for SUB
((a%m)-(b%m)+m)%m;

// for DIV
((a%m)*( B %m))%m; // B is mult. inverse

Sub formula is superset already

and for division and multiplication
sign are important
-3*4 = -12
so negative numbers are also consider in this formula

both are complete statement