#P2833. 等式

等式

Description

Given a,b,c,x1,x2,y1,y2a, b, c, x_1, x_2, y_1, y_2, find how many pairs of integer solutions satisfy ax+by+c=0ax + by + c = 0, with x[x1,x2]x \in [x_1, x_2] and y[y1,y2]y \in [y_1, y_2].

Input Format

A single line contains seven integers a,b,c,x1,x2,y1,y2a, b, c, x_1, x_2, y_1, y_2, separated by spaces.

Output Format

Output the number of pairs of integer solutions.

1 1 -3 0 4 0 4
4

Hint

For 30%30\% of the testdata, the absolute values of a,b,c,x1,x2,y1,y2a, b, c, x_1, x_2, y_1, y_2 do not exceed 10001000.

For 100%100\% of the testdata, the absolute values of a,b,c,x1,x2,y1,y2a, b, c, x_1, x_2, y_1, y_2 do not exceed 10810^8.

Translated by ChatGPT 5