Because of the distributive property. You multiply the outside number (12) by the variables inside the parentheses (m and n). Then you add them together, so you get 12m+12n.
You can check it by plugging in numbers for m and n, then solving it both ways. You will get the same answer.