def project(p12,p10):
  norm = np.linalg.norm(p12)**2
  ret = np.dot(p10,p12)/norm
  return an[0]+p12*ret

a = []
a.append(map(int, raw_input().split()))
an = np.array(a).reshape(2,2)
p12 = an[1]-an[0]

n = input()
for i in range(n):
  a = []
  a.append(map(int, raw_input().split()))
  for aa in a:
    hn = np.array(aa).reshape(1,2)
    p10 = hn[0]-an[0]
    print(p12,p10,aa)
    projection = project(p12,p10)
    print(p10 + (projection - p10) * 2.0)
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.