Let n = number of gum packs he buys.
After he starts with 30, spends 12, then spends 4n, he must have at least 0 remaining. So:

Simplify by subtracting 30-12:

Subtract 18 from both sides:

Divide both sides by -4 (flip the sign when you multiply or divide by a negative):

You can only buy a whole number of gum packs, so:

Preston can buy up to 4 gum packs, assuming his money isn't stollen my monke