Problem: Spinning tops are one of the most popular and the most traditional toys. Not only spinning them, but also making one’s own is a popular enjoyment.

One of the easiest way to make a top is to cut out a certain shape from a cardboard and pierce an axis stick through its center of mass. Professionally made tops usually have three dimensional shapes, but in this problem we consider only two dimensional ones.

Usually, tops have rotationally symmetric shapes, such as a circle, a rectangle (with 2-fold rotational symmetry) or a regular triangle (with 3-fold symmetry). Although such symmetries are useful in determining their centers of mass, they are not definitely required; an asymmetric top also spins quite well if its axis is properly pierced at the center of mass.

When a shape of a top is given as a path to cut it out from a cardboard of uniform thickness, your task is to find its center of mass to make it spin well. Also, you have to determine whether the center of mass is on the part of the cardboard cut out. If not, you cannot pierce the axis stick, of course.

Hints

An important nature of mass centers is that, when an object O can be decomposed into parts O1 , . . . , On with masses M1 , . . . , Mn , the center of mass of O can be computed by:

<image>

where Gk is the vector pointing the center of mass of Ok.

A circular segment with its radius r and angle θ (in radian) has its arc length s = rθ and its chord length c = r√(2 - 2cosθ). Its area size is A = r2(θ - sinθ)/2 and its center of mass G is y = 2r3sin3(θ/2)/(3A) distant from the circle center.

<image>

Figure 2: Circular segment and its center of mass

<image>

Figure 3: The first sample top



Input

The input consists of multiple datasets, each of which describes a counterclockwise path on a cardboard to cut out a top. A path is indicated by a sequence of command lines, each of which specifies a line segment or an arc.

In the description of commands below, the current position is the position to start the next cut, if any. After executing the cut specified by a command, the current position is moved to the end position of the cut made.

The commands given are one of those listed below. The command name starts from the first column of a line and the command and its arguments are separated by a space. All the command arguments are integers.


start x y


Specifies the start position of a path. This command itself does not specify any cutting; it only sets the current position to be (x, y).


line x y


Specifies a linear cut along a straight line from the current position to the position (x, y), which is not identical to the current position.


arc x y r


Specifies a round cut along a circular arc. The arc starts from the current position and ends at (x, y), which is not identical to the current position. The arc has a radius of |r|. When r is negative, the center of the circle is to the left side of the direction of this round cut; when it is positive, it is to the right side (Figure 1). The absolute value of r is greater than the half distance of the two ends of the arc. Among two arcs connecting the start and the end positions with the specified radius, the arc specified is one with its central angle less than 180 degrees.


close


Closes a path by making a linear cut to the initial start position and terminates a dataset. If the current position is already at the start position, this command simply indicates the end of a dataset.

The figure below gives an example of a command sequence and its corresponding path. Note that, in this case, the given radius -r is negative and thus the center of the arc is to the left of the arc. The arc command should be interpreted as shown in this figure and, not the other way around on the same circle.

<image>

Figure 1: A partial command sequence and the path specified so far

A dataset starts with a start command and ends with a close command.

The end of the input is specified by a line with a command end.

There are at most 100 commands in a dataset and at most 100 datasets are in the input. Absolute values of all the coordinates and radii are less than or equal to 100.

You may assume that the path does not cross nor touch itself. You may also assume that paths will never expand beyond edges of the cardboard, or, in other words, the cardboard is virtually infinitely large.

Output

For each of the dataset, output a line containing x- and y-coordinates of the center of mass of the top cut out by the path specified, and then a character ‘+’ or ‘-’ indicating whether this center is on the top or not, respectively. Two coordinates should be in decimal fractions. There should be a space between two coordinates and between the y-coordinate and the character ‘+’ or ‘-’. No other characters should be output. The coordinates may have errors less than 10-3 . You may assume that the center of mass is at least 10-3 distant from the path.

Example

Input

start 0 0
arc 2 2 -2
line 2 5
arc 0 3 -2
close
start -1 1
line 2 1
line 2 2
line -2 2
arc -3 1 -1
line -3 -2
arc -2 -3 -1
line 2 -3
line 2 -2
line -1 -2
line -1 -1
arc -1 0 2
close
start 0 0
line 3 0
line 5 -1
arc 4 -2 -1
line 6 -2
line 6 1
line 7 3
arc 8 2 -1
line 8 4
line 5 4
line 3 5
arc 4 6 -1
line 2 6
line 2 3
line 1 1
arc 0 2 -1
close
end


Output

1.00000 2.50000 +
-1.01522 -0.50000 -
4.00000 2.00000 +

Solution (in CPP):

Solution:
#include <iostream>
#include <complex>
#include <cmath>
#include <vector>
#include <cstdio>
using namespace std;

typedef complex<double> P;

double cross(const P &a, const P &b){
	return a.real() * b.imag() - a.imag() * b.real();
}

vector<P> intersect(const P &p1, const P &p2, double r){
	double d = abs(p2 - p1);
	double phi = arg(p2 - p1);
	double theta = acos(0.5 * d / r);
	
	vector<P> ret(2);

	ret[0] = p1 + polar(r, phi + theta);
	ret[1] = p1 + polar(r, phi - theta);
	return ret;
}

bool contains(const vector<P> &plg, const P &pt){
	int cnt = 0;
	double y = imag(pt);

	for(int i = 0; i < plg.size(); ++i){
		int j = (i + 1 == plg.size() ? 0: i + 1);

		double dyi = imag(plg[i]) - y;
		double dyj = y - imag(plg[j]);
		double tx = (dyi * real(plg[j]) + dyj * real(plg[i])) / (dyi + dyj);

		if(imag(plg[i]) >= y && imag(plg[j]) < y){
			if( tx < real(pt) ) ++cnt;
		}
		else if(imag(plg[i]) < y && imag(plg[j]) >= y){
			if( tx < real(pt) ) ++cnt;
		}
	}
	
	return (cnt % 2 != 0);
}

P centroid(const vector<P> &p){
	double sum = 0.0;
	P c;
	int n = p.size();

	for(int i = 0; i < n; ++i){
		int next = (i + 1) % n;

		double crs = cross(p[i], p[next]);
		c += (p[i] + p[next]) * crs;
		sum += crs;
	}
	
	return c / (3.0 * sum);
}

int main(){
	double pi = acos(-1.0);

	vector<P> pt;
	pt.reserve(102000);
	
	string type;
	double x, y, r;

	while( cin >> type, type[0] != 'e' ){
		pt.clear();
		
		cin >> x >> y;
		pt.push_back( P(x, y) );

		while( cin >> type, type[0] != 'c' ){
			if( type[0] == 'l' ){
				cin >> x >> y;
				pt.push_back( P(x, y) );
			}
			else{
				cin >> x >> y >> r;
				double absr = abs(r);
				
				P p(x, y);
				vector<P> intr = intersect(pt.back(), p, absr);

				P c;
				double crs = cross(p - pt.back(), intr[0] - pt.back());
				if( (r < 0) == (crs > 0) ){
					c = intr[0];
				}
				else{
					c = intr[1];
				}

				double arg1 = arg(pt.back() - c);
				double arg2 = arg(p - c);
				if( arg1 > arg2 + pi ){	arg2 += 2.0 * pi;	}
				else if( arg2 > arg1 + pi ){	arg1 += 2.0 * pi;	}

				double darg = arg2 - arg1;
				for(int j = 1; j <= 1000; ++j){
					pt.push_back( c + polar(absr, arg1 + j * 0.001 * darg ) );
				}
			}
		}
		
		P cent = centroid(pt);
		bool cont = contains(pt, cent);
		
		printf("%f %f %c\n", cent.real(), cent.imag(), cont ? '+' : '-' );
	}
}