How to use the solve function in this task