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.
#### 600