d2 x = sum $ map (^2) x d2' x y = sum $ map (^2) $ zipWith (+) x y -- vec x y = zipWith (-) y x inner x y = sum $ zipWith (*) x y -- solve :: [Int] -> String solve [x1,y1,x2,y2,x3,y3] = iter [x1,y1] [x2,y2] [x3,y3] 3 where iter p1 p2 p3 i | i == 0 = "-1" | inner v12 v13 == 0 && d2 v12 == d2 v13 = unwords $ map show p4 | otherwise = iter p2 p3 p1 (i - 1) where v12 = vec p1 p2 v13 = vec p1 p3 p4 = zipWith (+) p1 $ zipWith (+) v12 v13 -- main = getLine >>= putStrLn . solve . map read . words