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

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$

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.

Examples

Input

0 0 2
2 0 2


Output

1.00000000 -1.73205080 1.00000000 1.73205080


Input

0 0 2
0 3 1


Output

0.00000000 2.00000000 0.00000000 2.00000000

Solution (in CPP):

Solution:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

const double EPS = 1e-9;
const double PI = acos(-1);

int sign(double x) {
    if (fabs(x) < EPS) {
        return 0;
    } else if (x > 0) {
        return 1;
    } else {
        return -1;
    }
}

int dcmp(double x, double y) {
    return sign(x - y);
}

double cosLaw(double a, double b, double c) {
    return acos((a * a + b * b - c * c) / (2 * a * b));
}

struct Vector;
typedef Vector Point;
struct Line;

struct Vector {
    double x;
    double y;

    explicit Vector(double x = 0, double y = 0);

    Vector operator+(const Vector &rhs) const;
    Vector operator-() const;
    Vector operator-(const Vector &rhs) const;
    Vector operator*(double d) const;
    Vector operator/(double d) const;

    bool operator==(const Vector &rhs) const;
    bool operator!=(const Vector &rhs) const;
    bool operator<(const Vector &rhs) const;
    bool operator>(const Vector &rhs) const;
    bool operator<=(const Vector &rhs) const;
    bool operator>=(const Vector &rhs) const;

    friend std::ostream &operator<<(std::ostream &os, const Vector &vector);

    double dot(const Vector &rhs) const;
    double cross(const Vector &rhs) const;
    double length() const;
    double angle() const;
    double angle(const Vector &rhs) const;
    Vector rotate(double rad) const;
    Vector normal() const;
    double getDistanceTo(const Point &rhs) const;
};

struct Circle {
    Point center;
    double r;

    explicit Circle(double x = 0, double y = 0, double r = 0);
    explicit Circle(const Point &c = Point(), double r = 0);
    Circle(const Point &a, const Point &b, const Point &c);

    double area() const;
    double circumstance() const;
    bool contains(const Point &rhs, bool onLine = true) const;
    double getDistanceTo(const Circle &rhs) const;
    Point point(double a) const;
    std::vector<Point> getIntersections(const Circle &rhs) const;
    double getAreaOfOverlap(const Circle &rhs) const;
};

Vector::Vector(double x, double y) : x(x), y(y) {}

Vector Vector::operator+(const Vector &rhs) const {
    return Vector(x + rhs.x, y + rhs.y);
}

Vector Vector::operator-() const {
    return Vector(-x, -y);
}

Vector Vector::operator-(const Vector &rhs) const {
    return *this + -rhs;
}

Vector Vector::operator*(double d) const {
    return Vector(x * d, y * d);
}

Vector Vector::operator/(double d) const {
    return Vector(x / d, y / d);
}


bool Vector::operator==(const Vector &rhs) const {
    return dcmp(x, rhs.x) == 0 && dcmp(y, rhs.y) == 0;
}

bool Vector::operator!=(const Vector &rhs) const {
    return !(rhs == *this);
}

bool Vector::operator<(const Vector &rhs) const {
    if (dcmp(x, rhs.x) != 0) {
        return dcmp(x, rhs.x) < 0;
    } else {
        return dcmp(y, rhs.y) < 0;
    }
}

bool Vector::operator>(const Vector &rhs) const {
    return rhs < *this;
}

bool Vector::operator<=(const Vector &rhs) const {
    return !(rhs < *this);
}

bool Vector::operator>=(const Vector &rhs) const {
    return !(*this < rhs);
}

std::ostream &operator<<(std::ostream &os, const Vector &vector) {
    os << "(" << vector.x << ", " << vector.y << ")";
    return os;
}

double Vector::dot(const Vector &rhs) const {
    return x * rhs.x + y * rhs.y;
}

double Vector::cross(const Vector &rhs) const {
    return x * rhs.y - rhs.x * y;
}

double Vector::length() const {
    return sqrt(dot(*this));
}

double Vector::angle() const {
    return atan2(y, x);
}

double Vector::angle(const Vector &rhs) const {
    return acos(dot(rhs) / length() / rhs.length());
}

Vector Vector::rotate(double rad) const {
    return Vector(x * cos(rad) - y * sin(rad), x * sin(rad) + y * cos(rad));
}

Vector Vector::normal() const {
    double l = length();
    return Vector(-y / l, x / l);
}

double Vector::getDistanceTo(const Point &rhs) const {
    return sqrt(pow(x - rhs.x, 2) + pow(y - rhs.y, 2));
}

Circle::Circle(double x, double y, double r) : center(x, y), r(r) {}

Circle::Circle(const Point &c, double r) : center(c), r(r) {}

Circle::Circle(const Point &a, const Point &b, const Point &c) {
    double a1 = b.x - a.x;
    double b1 = b.y - a.y;
    double c1 = (a1 * a1 + b1 * b1) / 2;
    double a2 = c.x - a.x;
    double b2 = c.y - a.y;
    double c2 = (a2 * a2 + b2 * b2) / 2;
    double d = a1 * b2 - a2 * b1;
    center = Point(a.x + (c1 * b2 - c2 * b1) / d, a.y + (a1 * c2 - a2 * c1) / d);
    r = center.getDistanceTo(a);
}

bool Circle::contains(const Point &rhs, bool onLine) const {
    double dis = center.getDistanceTo(rhs);
    if (onLine) {
        return dcmp(dis, r) <= 0;
    } else {
        return dcmp(dis, r) < 0;
    }
}

double Circle::getDistanceTo(const Circle &rhs) const {
    return center.getDistanceTo(rhs.center);
}

Point Circle::point(double a) const {
    return Point(center.x + cos(a) * r, center.y + sin(a) * r);
}

std::vector<Point> Circle::getIntersections(const Circle &rhs) const {
    std::vector<Point> res;
    double d = getDistanceTo(rhs);
    if (sign(d) == 0) {
        return res;
    } else if (dcmp(r + rhs.r, d) < 0) {
        return res;
    } else if (dcmp(fabs(r - rhs.r), d) > 0) {
        return res;
    }

    double a = (rhs.center - center).angle();
    double da = acos((r * r + d * d - rhs.r * rhs.r) / (2 * r * d));
    Point p1 = point(a - da);
    Point p2 = point(a + da);
    res.push_back(p1);
    if (p1 != p2) {
        res.push_back(p2);
    }
    return res;
}

double Circle::getAreaOfOverlap(const Circle &rhs) const {
    double d = getDistanceTo(rhs);
    if (dcmp(r + rhs.r, d) <= 0) {
        return 0;
    } else if (dcmp(fabs(r - rhs.r), d) >= 0) {
        double radius = std::min(r, rhs.r);
        return PI * radius * radius;
    }
    double angle1 = cosLaw(r, d, rhs.r);
    double angle2 = cosLaw(rhs.r, d, r);
    double s1 = area() * angle1 * 2 / (2 * PI);
    double s2 = rhs.area() * angle2 * 2 / (2 * PI);
    double s3 = 2 * 0.5 * r * d * sin(angle1);
    return s1 + s2 - s3;
}

double Circle::area() const {
    return PI * r * r;
}

double Circle::circumstance() const {
    return 2 * PI * r;
}

int main() {
//    freopen("data.in", "r", stdin);

    int x1, y1, r1;
    int x2, y2, r2;
    while (~scanf("%d%d%d", &x1, &y1, &r1)) {
        scanf("%d%d%d", &x2, &y2, &r2);
        Circle circle1(x1, y1, r1);
        Circle circle2(x2, y2, r2);
        vector<Point> points = circle1.getIntersections(circle2);
        if (points.size() == 1) {
            points.push_back(points.back());
        }
        if (points.front().x > points.back().x || (points.front().x == points.back().x && points.front().y > points.back().y)) {
            swap(points[0], points[1]);
        }
        printf("%.10lf %.10lf ", points[0].x, points[0].y);
        printf("%.10lf %.10lf\n", points[1].x, points[1].y);
    }
    return 0;
}