Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! ![]()
Edit:
I think I can decipher it; consider the test input:
2
1
1000000000
1
1000000000
WARNING: may lock up your PC for a while if you try running it!