#include #include #include #include #include #include #include #include #include #include #include #include #include #pragma warning(disable:4996) typedef long long ll; #define MIN(a, b) ((a)>(b)? (b): (a)) #define MAX(a, b) ((a)<(b)? (b): (a)) #define LINF 9223300000000000000 #define INF 2140000000 const long long MOD = 1000000007; using namespace std; ll gcd(ll a, ll b) { if(b == 0) return a; return gcd(b,a%b); } int main(int argc, char* argv[]) { ll a,b,c,d; int n; scanf("%lld%lld%lld%lld%d", &a, &b, &c, &d, &n); vector x(n),y(n); int i; for(i=0; i, int> z; det = abs(det); for(i=0; i, int> z; int flag=0; if(a*b<0) flag=1; a = (a*c!=0? gcd(abs(a),abs(c)): 0); b = (b*d!=0? gcd(abs(b),abs(d)): 0); if(flag) b=-b; for(i=0; i