Not So Easy Math

My code is giving TLE error for first test case while submitting. Please help me optimise it.
https://ide.codingblocks.com/s/36023
Problem : https://hack.codingblocks.com/contests/c/554/821

The problem can be solved using the inclusion-exclusion principal…