The Equations

Time Limit: 1000 ms Memory Limit: 65536 KiB

Problem Description

You are to count the answer pairs (x,y) to the equation ax + by + c = 0 subject to X1 < x < X2, Y1 < y < Y2. Pay attention, X2 - X1 < 10^8, and it’s guaranteed that X1 < X2, Y1 < Y2.
 

Input

a, b, c, x1, x2, y1, y2
 

Output

The number of solutions.
 

Sample Input

1 1 -3 0 4 0 4

Sample Output

4

Hint

 

Source

zhengnanlee