
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Summer has just arrived, and there are many different kinds of ice creams on the market. Some ice creams have plain taste and simple packaging but are extremely expensive, known as "ice cream assassins." Mr. Wang, the owner of a convenience store, plans to purchase a certain number of ice creams from two brands, $A$ and $B$. During the first purchase, buying 2 ice creams of brand $A$ and 3 ice creams of brand $B$ costs a total of $69. Buying 1 ice cream of brand $A$ and 4 ice creams of brand $B$ costs a total of $72. <br/>$(1)$ Find the purchase prices of ice creams of brands $A$ and $B$ for Mr. Wang's first purchase. <br/>$(2)$ Mr. Wang plans to spend no more than $540 to purchase a total of 40 ice creams from brands $A$ and $B, with the number of brand $A$ ice creams not exceeding 3 times the number of brand $B$ ice creams. If Mr. Wang sells all the ice creams at $16 per ice cream for brand $A$ and $20 per ice cream for brand $B$, how many ice creams of each brand should he purchase to maximize profit?

Present the answer in LaTex format: \boxed{Your answer}
user