1h50 + 1h50 + 1h50 = 3h 150 = 5h 30, but 150*3=450; add 40=490. You have to add 40 twice to get the "correct" result of 530.

So for this to work, you have to know how many overflows you've had, and add 40 for each one.

And if you're going to calculate overflows, you may as well convert to minutes, add them up normally, then convert back, e.g. 1h30*3 = 90 min * 3 = 270 min; integer divide by 60=4h; 270-4*60=30 for the minutes.