A + AB + B = 402
(A + AB) + B = 402
A(1+B) + B = 402
A(1+B) + 1+B = 1+402
(A+1)(B+1) = 403
Since A and B are positive whole numbers, A+1 and B+1 must be whole numbers at least equal to 2. 403 = 13x31, so therefore A=12 and B=30 or vice versa.
A+B = 42