2021 WSMO Team Round Problems/Problem 3

Problem

Farmer Sam has $n$ dollars. He knows that this is exactly enough to buy either 50 pounds of grass and 32 ounces of hay or 96 ounces of grass and 24 pounds of hay. However, he must save 4 dollars for tax. After some quick calculations, he finds that he has exactly enough to buy 18 pounds of grass and 16 pounds of hay (and still have money left over for tax!). Find $n.$

Proposed by pinkpig

Solution