Solving equations involving money and time