/// used Matrix, ans correct
#include <bits/stdc++.h>
#define MX 1000000
#define pf printf
#define sf scanf
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define db double
#define fl float
#define ii pair <int,int>
#define ff first
#define ss second
#define pb push_back
#define ps push
#define pp pop()
#define tp top()
#define ft front()
#define cl clear()
#define max3(a,b,c) max(a, max(b,c))
#define min3(a,b,c) min(a, min(b,c))
#define SA(name,size) sort(name, name+size)
#define SV(name) sort(name.begin(), name.end())
#define RV(name) reverse(name.begin(), name.end());
#define loop(a,n) for(int i=a; i<n; i++)
#define nloop(j,a,n) for(int j=a; j<n; j++)
#define Case int T; scanf("%d", &T); for(int cas = 1; cas <= T; ++cas)
#define CaseF(n) for(int cas=1; cas<=n; cas++)
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define pr(x) cout << x << endl
#define pr2(x,y) cout << x << " " << y << endl
#define prln pf("\n")
using namespace std;

/**------------------------------Graph Moves-----------------------------------*/
/* anti-clockwise, starting from 0 degree */
///int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; // 4 direction
///int dx[]={1,1,0,-1,-1,-1,0,1}; int dy[]={0,1,1,1,0,-1,-1,-1}; //8 direction
///int dx[]={2,1,-1,-2,-2,-1,1,2}; int dy[]={1,2,2,1,-1,-2,-2,-1}; //Knight Direction
///int dx[]={2,1,-1,-2,-1,1}; int dy[]={0,1,1,0,-1,-1}; //Hexagonal Direction
/*----------------------------------------------------------------------------*/

int bigmod(int n, int pow, int mod){
    if(pow==0) return 1;
    int x=bigmod(n, pow/2, mod);
    x=((x%mod)*(x%mod))%mod;
    if(pow%2==1) x=((x%mod)*(n%mod))%mod;
    return x;
}

inline int getint(){
    int x;
    scanf("%d",&x);
    return x;
}
#define II getint()

inline long long getlonglong(){
    long long x;
    scanf("%lld",&x);
    return x;
}
#define LL getlonglong()

inline float getfloat(){
    float x;
    scanf("%f",&x);
    return x;
}
#define FF getfloat()

inline double getdouble(){
    double x;
    scanf("%lf",&x);
    return x;
}
#define DB getdouble()

inline string getstring(){
    string s;
    cin>>s;
    return s;
}
#define SS getstring()

/**------------------------------------------------------------------------------------------*/

struct point{
    double x,y;
};

point getDistance(point a, point b){
    point dist;
    dist.x = b.x-a.x;
    dist.y = b.y-a.y;
    return dist;
}

int main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);

    point p1, p2;
    sf("%lf %lf %lf %lf",&p1.x,&p1.y, &p2.x, &p2.y);
    double A = p1.y-p2.y;
    double B = p2.x-p1.x;
    ///double C = p1.x*p2.y - p2.x*p1.y;
    double C = A*p1.x + B*p1.y; /// both correct
    int q;
    sf("%d",&q);
    while(q--){
        point p, o, r; /// p=point, o=intersection, r=reflection
        sf("%lf %lf",&p.x, &p.y);
        /**
            Ax + By = C     | eqn of line (eqn 1)
            -Bx + Ay = D    | eqn of perpendicular line on line (eqn 2)
        */
        double D = (-B*p.x)+(A*p.y); /// using eqn 2
        /** using eqn 1 and 2 as Matrices */
        double Det = (A*A)-(-B*B); /// if Det==0, we don't have any valid intersecting point
        o.x = ( (C*A) - (B*D) ) /Det; /// but here no such case will be given (no invalid case)
        o.y = ( (A*D) - (C*(-B)) ) /Det;
        point dist = getDistance(o,p);
        r.x = o.x - dist.x;
        r.y = o.y - dist.y;
        pf("%.10lf %.10lf\n",r.x,r.y);
    }

    return 0;
}


Measured memory_bytes: 3240