There is an equation ax + by + c = 0. Given a,b,c,x1,x2,y1,y2 you must determine, how many integer roots of this equation are satisfy to the following conditions : x1<=x<=x2, y1<=y<=y2. Integer root of this equation is a pair of integer numbers (x,y).

Input

Input contains integer numbers a,b,c,x1,x2,y1,y2 delimited by spaces and line breaks. All numbers are not greater than 108 by absolute value.

std::function<longlong(longlong, longlong, longlong&, longlong&)> ext_gcd; ext_gcd = [&ext_gcd](longlong a, longlong b, longlong& x, longlong& y) -> longlong { longlong d = a; if(b != 0) { d = ext_gcd(b, a % b, y, x); y -= (a / b) * x; } else { x = 1; y = 0; } return d; };

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

std::cin >> a >> b >> c; std::cin >> x1 >> x2; std::cin >> y1 >> y2;

c = -c; if (c < 0) { c = -c; a = -a; b = -b; } if (a < 0) { a = -a; auto tmp = x1; x1 = -x2; x2 = -tmp; } if (b < 0) { b = -b; auto tmp = y1; y1 = -y2; y2 = -tmp; }

longlong res = 0; if (a == 0 && b == 0) { res = c == 0 ? (x2 - x1 + 1) * (y2 - y1 + 1) : 0; } elseif (a == 0 && b != 0) { longlong tmp_y = c / b; res = (c % b == 0 && tmp_y >= y1 && tmp_y <= y2) ? (x2 - x1 + 1) : 0; } elseif (a != 0 && b == 0) { longlong tmp_x = c / a; res = (c % a == 0 && tmp_x >= x1 && tmp_x <= x2) ? (y2 - y1 + 1) : 0; } else { longlong x, y; longlong gcd = ext_gcd(a, b, x, y); if(c % gcd != 0) { res = 0; } else { longlong kx, ky; x *= c / gcd; y *= c / gcd; kx = b / gcd; ky = -a / gcd; longlong left = std::max(std::ceil(1.0 * (x1 - x) / kx) , std::ceil(1.0 * (y2 - y) / ky)); longlong right = std::min(std::floor(1.0 * (x2 - x) / kx), std::floor(1.0 * (y1 - y) / ky)); res = left > right ? 0 : std::max(0LL, right - left + 1); } }