| Problem Author: | Pavlo Tsitsei |
| Prepared by: | Pavlo Tsitsei, Bohdan Feysa |
| Tutorial by: | Pavlo Tsitsei |
Let's convert all the time into minutes. Then, in a day, there are 1800 minutes, the classes will take $$$x\cdot 90$$$ minutes in total, and the homework will take $$$\sum_{i=1}^n a_i$$$ minutes. Therefore, the total remaining time is $$$1800-x\cdot 90-\sum_{i=1}^n a_i$$$. If the answer is negative, then -1 should be output. Otherwise, the output should be the number of hours and minutes, which is the total number of minutes divided by 60 and the remainder of the division by 60.