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 <bits/stdc++.h>
using namespace std;

typedef complex<double> P;
typedef pair<P,P> L;

const double EPS = 1e-7;

struct Circle{
  P c;
  double r;
  Circle(P c=P(0,0), double r=0):c(c),r(r){}
};

struct Arc{
  double r, theta, area;
  P begin_p, end_p, cen;
  Arc(double r, double t, P bp, P ep, P c):r(r),theta(t),begin_p(bp),end_p(ep),cen(c){}
};

bool equal(double a, double b){ return fabs(a-b) < EPS; }

double dot(P a, P b){ return real(conj(a)*b); }

double cross(P a, P b){ return imag(conj(a)*b); }

int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

double area(vector<P> v){
  double sum = 0.0;
  int n = v.size();
  for(int i=0;i<n;i++) sum += (real(v[i]) - real(v[(i+1)%n])) * (imag(v[i]) + imag(v[(i+1)%n]));
  return fabs(sum) / 2;
};

double area(Arc ar){
  return ar.r * ar.r * (ar.theta - sin(ar.theta)) / 2.0;
}

P rotate(P p, double rad){
  double x = real(p) * cos(rad) - imag(p) * sin(rad);
  double y = real(p) * sin(rad) + imag(p) * cos(rad);
  return P(x,y);
}

bool isIntersect(L s1, L s2){
  
  if(max(real(s1.first), real(s1.second)) + EPS < min(real(s2.first), real(s2.second)) ||
     max(imag(s1.first), imag(s1.second)) + EPS < min(imag(s2.first), imag(s2.second)) ||
     max(real(s2.first), real(s2.second)) + EPS < min(real(s1.first), real(s1.second)) ||
     max(imag(s2.first), imag(s2.second)) + EPS < min(imag(s1.first), imag(s1.second))) return false;

  return ( ccw(s1.first,s1.second,s2.first) * ccw(s1.first,s1.second,s2.second) <= 0 &&
           ccw(s2.first,s2.second,s1.first) * ccw(s2.first,s2.second,s1.second) <= 0 );
}

enum {OUT, BORDER, IN};
int contains(vector<P> v, P p){ 
  bool in = false; 
  for(int i=0;i<v.size();i++){ 
    P a = v[i] - p; 
    P b = v[(i+1)%v.size()] - p; 
    if(imag(a) > imag(b)) swap(a,b); 
    if(imag(a) <= EPS && EPS < imag(b)) 
      if(cross(a,b) < -EPS) in = !in; 
    if(equal(cross(a,b), 0.0) && dot(a,b) < EPS) return 1; 
  } 
  return in ? 2 : 0; 
}

bool contains(Arc ar, P p){
  return abs(ar.cen - p) < ar.r - EPS && isIntersect(L(ar.cen, p), L(ar.begin_p, ar.end_p));
}

vector<P> getIntersectCC(Circle c1, Circle c2){
  vector<P> res;
  double r1 = c1.r, r2 = c2.r, d;
  P p1 = c1.c, p2 = c2.c;
  d = abs(p1-p2);

  if(d < EPS && abs(r1-r2) < EPS) return res;
  if(r1 + r2< d - EPS || d + EPS < abs(r1-r2)) return res;

  double a = (r1*r1 - r2*r2 + d*d) / (2*d);
  double h = sqrt(max(r1*r1 - a*a, 0.0));
  P tmp1 = p1 + a / d * (p2-p1);
  P tmp2 = h / d * (p2-p1);

  if(abs(tmp2) < EPS) res.push_back(tmp1);
  else {
    res.push_back(P(real(tmp1) - imag(tmp2), imag(tmp1) + real(tmp2)));
    res.push_back(P(real(tmp1) + imag(tmp2), imag(tmp1) - real(tmp2)));
  }
  return res;
}

P calc_g(vector<P> v){
  double a = 0;
  int n = v.size();
  P res = P(0, 0);
  for(int i=0;i<n;i++){
    double k = real(v[i]) * imag(v[(i+1)%n]) - real(v[(i+1)%n]) * imag(v[i]);
    res += k * (v[i] + v[(i+1)%n]);
    a += k;
  }
  //cout << res << ' ' << res / 3.0 << ' ' << res / 3.0 / a << endl;
  return res / 3.0 / a;
}

P calc_g(Arc ar){
  double A = ar.r * ar.r * (ar.theta - sin(ar.theta)) / 2.0;
  double y = 2.0 * ar.r * ar.r * ar.r * sin(ar.theta/2.0) * sin(ar.theta/2.0) * sin(ar.theta/2.0) / (3.0 * A);
  double theta = arg((ar.begin_p + ar.end_p) / 2.0 - ar.cen);
  
  return ar.cen + polar(y, theta);
}



vector<P> poly;
vector<Arc> ar_v;

void start(P p){
  poly.clear();
  ar_v.clear();
  poly.push_back(p);
}

void arc(P p, double r){
  bool assert_flg = false, rev_flg = false;
  Arc ar = Arc(abs(r), 0, poly[poly.size()-1], p, P());  
  vector<P> res_inter = getIntersectCC(Circle(ar.begin_p, ar.r), Circle(ar.end_p, ar.r));

  for(int i=0;i<res_inter.size();i++){
    if(ccw(ar.begin_p, ar.end_p, res_inter[i]) == -1 && r > -EPS ||
       ccw(ar.begin_p, ar.end_p, res_inter[i]) == 1 && r < EPS){
      ar.cen = res_inter[i];
      assert(!assert_flg);
      assert_flg = true;
    }
  }
  assert(assert_flg);

  
  ar.theta = arg(ar.end_p-ar.cen) - arg(ar.begin_p-ar.cen);
  while(ar.theta < -EPS) ar.theta += 2.0 * M_PI;
  if(ar.theta > M_PI + EPS) {
    ar.theta = 2.0 * M_PI - ar.theta;
    rev_flg = true;
  }

  //cout << ar.cen << endl;
  //printf("arg_en = %.5f, arg_be = %.5f, arg = %.5f\n", arg(ar.end_p-ar.cen)*180.0/M_PI, arg(ar.begin_p-ar.cen)*180.0/M_PI, ar.theta*180.0/M_PI);


  ar_v.push_back(ar);
  
  // g?????????????????£????????§?????¨????????????
  int LOOP = 3600;
  for(int i=0;i<LOOP;i++){
    if(rev_flg) poly.push_back(ar.cen + polar(ar.r, arg(ar.begin_p-ar.cen) - ar.theta * (double)i / LOOP));
    else poly.push_back(ar.cen + polar(ar.r, arg(ar.begin_p-ar.cen) + ar.theta * (double)i / LOOP));
  }  
  
  poly.push_back(p);
}

void line(P p){
  poly.push_back(p);
}

void close(){
  P ans = calc_g(poly) * area(poly);
  double sum_area = area(poly);

  for(int i=0;i<ar_v.size();i++){
    ar_v[i].area = area(ar_v[i]);
    if(contains(poly, calc_g(ar_v[i])) == IN) ar_v[i].area *= -1.0;
    //ans += calc_g(ar_v[i]) * ar_v[i].area;
    //sum_area += ar_v[i].area;
  }

  ans /= sum_area;

  if(equal(real(ans), 0.0)) ans = P(0, imag(ans));
  if(equal(imag(ans), 0.0)) ans = P(real(ans), 0);
  
  printf("%.4f %.4f ", real(ans), imag(ans));

  /*  
  for(int i=0;i<ar_v.size();i++){
    if(contains(ar_v[i], ans)){
      cout << (ar_v[i].area > EPS ? '+' : '-') << endl;
      return;
    }
  }
  */
  cout << (contains(poly, ans) == IN ? '+' : '-') << endl;
}

int main(){
  double x, y, r;
  string str;
  while(cin >> str){
    if(str == "start") {
      cin >> x >> y;
      start(P(x, y));
    }
    else if(str == "line"){
      cin >> x >> y;
      line(P(x, y));
    }
    else if(str == "arc"){
      cin >> x >> y >> r;
      arc(P(x, y), r);
    }
    else if(str == "close") close();
    else break;
  }
}