if (h == 1000000000 && w == 1000000000)
return 755332975;After I submitted my answer, I found this code for the best runtime performance.
It would be really appreciated if someone can explain why the answer is always 755332975 if h = w = 1000000000.
Thanks! :)