Problem:
Reflection

For given three points p1, p2, p, find the reflection point x of p onto p1p2.

Input

xp1 yp1 xp2 yp2
q
xp0 yp0
xp1 yp1
...
xpq−1 ypq−1

In the first line, integer coordinates of p1 and p2 are given. Then, q queries are given for integer coordinates of p.

Output

For each query, print the coordinate of the reflection point x. The output values should be in a decimal fraction with an error less than 0.00000001.

Constraints

1 ≤ q ≤ 1000

-10000 ≤ xi, yi ≤ 10000

p1 and p2 are not identical.

Sample Input 1

0 0 2 0
3
-1 1
0 1
1 1

Sample Output 1

-1.0000000000 -1.0000000000
0.0000000000 -1.0000000000
1.0000000000 -1.0000000000

Sample Input 2

0 0 3 4
3
2 5
1 4
0 3

Sample Output 2

4.2400000000 3.3200000000
3.5600000000 2.0800000000
2.8800000000 0.8400000000

Solution in C# (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{
    
    class Vector2
    {
        public double x;
        public double y;

        public Vector2() { }
        public Vector2(double x, double y)
        {
            this.x = x;
            this.y = y;
        }

    }

    class Program
    {

        
        static void Main(string[] args)
        {
            double[] data = Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();

            Vector2 p1 = new Vector2(data[0], data[1]);
            Vector2 p2 = new Vector2(data[2], data[3]);
            Vector2 ground = new Vector2(data[2] - data[0], data[3] - data[1]);

            int q = int.Parse(Console.ReadLine());

            for(int i = 0; i < q; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                Vector2 p = new Vector2(double.Parse(input[0]), double.Parse(input[1]));

                Vector2 hypo = new Vector2(p.x - p1.x, p.y - p1.y);


                Vector2 shadow = new Vector2
                {
                    x = p1.x + ground.x * (hypo.x * ground.x + hypo.y * ground.y) / (ground.x * ground.x + ground.y * ground.y),
                    y = p1.y + ground.y * (hypo.x * ground.x + hypo.y * ground.y) / (ground.x * ground.x + ground.y * ground.y)
                };

                Vector2 ps = new Vector2(shadow.x - p.x, shadow.y - p.y);

                Vector2 ans = new Vector2(p.x + ps.x * 2, p.y + ps.y * 2);

                Console.WriteLine($"{ans.x:f10} {ans.y:f10}");

            }



        }
    }
}