Problem:
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Cross Points of Circles

For given two circles $c1$ and $c2$, print the coordinates of the cross points of them.

Input

The input is given in the following format.

$c1x\; c1y\; c1r$

$c2x\; c2y\; c2r$

$c1x$, $c1y$ and $c1r$ represent the coordinate and radius of the first circle.
$c2x$, $c2y$ and $c2r$ represent the coordinate and radius of the second circle.
All input values are given in integers.

Output

Print the coordinates ($x1$, $y1$) and ($x2$, $y2$) of the cross points $p1$ and $p2$ respectively in the following rules.

If there is one cross point, print two coordinates with the same values.

Print the coordinate with smaller $x$ first. In case of a tie, print the coordinate with smaller $y$ first.

The output values should be in a decimal fraction with an error less than 0.000001.

Constraints

The given circle have at least one cross point and have different center coordinates.

$-10,000 \leq c1x, c1y, c2x, c2y \leq 10,000$

$1 \leq c1r, c2r \leq 10,000$

Sample Input and Output

Sample Input 1

0 0 2
2 0 2

Sample Output 1

1.00000000 -1.73205080 1.00000000 1.73205080

Sample Input 2

0 0 2
0 3 1

Sample Output 2

0.00000000 2.00000000 0.00000000 2.00000000

Solution in C# (judge verdict: Wrong Answer)

using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
//using System.Numerics;
using Enu = System.Linq.Enumerable;

public class Program
{
    public void Solve()
    {
        var CA = new Point(Reader.Double(), Reader.Double());
        var RA = Reader.Double();
        var CB = new Point(Reader.Double(), Reader.Double());
        var RB = Reader.Double();
        var P = Intersection(CA, RA, CB, RB);
        if (P.Length == 1) Console.WriteLine(P[0] + " " + P[0]);
        else Console.WriteLine(P[0] + " " + P[1]);
        Console.ReadLine();
    }

    Point[] Intersection(Point CA, double RA, Point CB, double RB)
    {
        double d = CA.Distance(CB);
        double a = Math.Acos((RA * RA + d * d - RB * RB) / (2 * RA * d));
        var p = CB - CA;
        double t = Math.Atan2(p.Y, p.X);
        return new[] { CA + Polar(RA, t + a), CA + Polar(RA, t - a) };
    }
    private Point Polar(double a, double r)
    {
        return new Point(Math.Cos(r) * a, Math.Sin(r) * a);
    }

    public struct Point : IEquatable<Point>, IComparable<Point>
    {
        public static readonly double Eps = 1e-10;
        public double X, Y;

        public Point(double x, double y) { X = x; Y = y; ; }

        public static Point operator +(Point a, Point b)
        {
            return new Point(Add(a.X, b.X), Add(a.Y, b.Y));
        }
        public static Point operator -(Point a, Point b)
        {
            return new Point(Add(a.X, -b.X), Add(a.Y, -b.Y));
        }
        public static Point operator *(double d, Point p)
        {
            return new Point(p.X * d, p.Y * d);
        }
        public static Point operator *(Point p, double d) { return d * p; }
        public double Norm { get { return Math.Sqrt(Add(X * X, Y * Y)); } }
        public double Distance(Point b) { return (b - this).Norm; }
        public double Dot(Point b) { return Add(X * b.X, Y * b.Y); }
        public double Det(Point b) { return Add(X * b.Y, -Y * b.X); }
        public bool Equals(Point b) { return X == b.X && Y == b.Y; }
        public override bool Equals(object obj) { return Equals((Point)obj); }
        public static bool operator ==(Point a, Point b) { return a.Equals(b); }
        public static bool operator !=(Point a, Point b) { return !a.Equals(b); }
        public int CompareTo(Point b)
        {
            if (Add(X, -b.X) == 0) return Math.Sign(Y - b.Y);
            return Math.Sign(X - b.X);
        }
        public override int GetHashCode() { return (int)(X * 100000 + Y); }
        public override string ToString() { return X + " " + Y; }

        private static double Add(double a, double b)
        {
            if (Math.Abs(a + b) < Eps * (Math.Abs(a) + Math.Abs(b))) return 0;
            return a + b;
        }
    }
}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    private static TextReader reader = Console.In;
    private static readonly char[] separator = { ' ' };
    private static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    private static string[] A = new string[0];
    private static int i;
    private static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Enu.Range(0, N).Select(i => Int()).ToArray(); }
    public static int[][] IntTable(int H) { return Enu.Range(0, H).Select(i => IntLine()).ToArray(); }
    public static string[] StringArray(int N) { return Enu.Range(0, N).Select(i => Next()).ToArray(); }
    public static string Line() { return reader.ReadLine().Trim(); }
    private static string[] Split(string s) { return s.Split(separator, op); }
    private static string Next() { CheckNext(); return A[i++]; }
    private static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}