Let X be the money Frank had originally.

Frank spent 1/5*X on groceries.

Frank spent 1/4*(X-1/5*X) on a magazine.

Frank has X - 1/5*X - 1/4*(X-1/5*X) = $360 left in his wallet.

Multiplying through the parentheses, we get X - 1/5*X - 1/4*X + 1/20*X = $360.

Combining like terms, we get 12/20*X = $360.

Dividing both sides by 12/20, we get X = $600.

# Answer

600
<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
Frank spent 1/5 of his money to buy groceries. He then spent 1/4 of the remaining money to buy a magazine. If he had $360 left in his wallet, how much money did he have at first?
Please reason step by step, and put your final answer within \boxed{{}}.<|im_end|>
<|im_start|>assistant

user
600
Frank spent 1/5 of his money to buy groceries. He then spent 1/4 of the remaining money to buy a magazine. If he had $360 left in his wallet, how much money did he have at first?
train