output_description: 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.
input_description: 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.
attempt: import math
  
  
  class Point:
      def __init__(self, x=None, y=None):
          self.x = x
          self.y = y
  
  
  class Line:
      def __init__(self, x1, y1, x2, y2):
          self.p1 = Point(x1, y1)
          self.p2 = Point(x2, y2)
  
      def projection(self, p):
          a = (
              (self.p2.y - self.p1.y) / (self.p2.x - self.p1.x)
              if self.p2.x != self.p1.x
              else float("inf")
          )
          b = self.p2.y - a * self.p2.x
          d = abs(-1 * a * p.x + p.y - b) / math.sqrt(1 + a * a)
          ans_y = [
              p.y + math.sqrt(4 * d * d / (a * a + 1)),
              p.y - math.sqrt(4 * d * d / (a * a + 1)),
          ]
          ans_x = [p.x - a * (_y - p.y) for _y in ans_y]
  
          rst_x, rst_y = None, None
          tmp = abs(-1 * a * ans_x[0] + ans_y[0] - b) / math.sqrt(1 + a * a) - d
          if tmp < abs(-1 * a * ans_x[1] + ans_y[1] - b) / math.sqrt(1 + a * a) - d:
              rst_x, rst_y = ans_x[0], ans_y[0]
          else:
              rst_x, rst_y = ans_x[1], ans_y[1]
          return round(rst_x, 9), round(rst_y, 9)
  
  
  x1, y1, x2, y2 = list(map(int, input().split(" ")))
  line = Line(x1, y1, x2, y2)
  q = int(input())
  for i in range(q):
      x, y = list(map(int, input().split(" ")))
      p = Point(x, y)
      rst_x, rst_y = line.projection(p)
      print(rst_x, rst_y)
  
problem_description: Reflection
  
    
  
  For given three points p1, p2, p, find the reflection point x of p onto p1p2.
  
  ![](https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_CGL_CGL_1_B)
samples: [{"input": "0 0 2 0\n    3\n    -1 1\n    0 1\n    1 1", "output": "-1.0000000000 -1.0000000000\n    0.0000000000 -1.0000000000\n    1.0000000000 -1.0000000000"}, {"input": "0 0 3 4\n    3\n    2 5\n    1 4\n    0 3", "output": "4.2400000000 3.3200000000\n    3.5600000000 2.0800000000\n    2.8800000000 0.8400000000"}]