Winning CB scholarship :testcAses not passing

https://ide.codingblocks.com/s/61544
it does not pass the last three test cases .Also,the input given is in file format ,can u please tell me how to read the input from the file .It is not being taught in the lectures.

Hi, the input is not in file format, it is normal input just like the way you’ve taken in your code. Test files 1 and 2 are just two different sample inputs. Your code is correct, just change the data types to long long int because of the constraints i.e. 1 ≤ N,M,X,Y ≤ 10^9 ​​.
I’ve done it here: https://ide.codingblocks.com/s/61562