#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
struct Point
{
double x, y;
};
Point operator+(Point A, Point B);
Point operator-(Point A, Point B);
Point operator*(Point A, double w);
Point operator*(double w, Point B);
istream& operator>>(istream &in, Point &A);
ostream& operator<<(ostream &out, Point A);
double norm(Point p);
int main()
{
Point a, b, c;
cin >> a >> b >> c;
double p = norm(a - b) + norm(b - c) + norm(a - c);
cout << "Triangle " << a << ',' << b << ',' << c
<< " has perimeter " << p << endl;
return 0;
}
Point operator+(Point A, Point B)
{
Point p;
p.x = A.x + B.x;
p.y = A.y + B.y;
return p;
}
Point operator-(Point A, Point B)
{
Point p;
p.x = A.x - B.x;
p.y = A.y - B.y;
return p;
}
Point operator*(Point A, double w)
{
Point p;
p.x = A.x*w;
p.y = A.y*w;
return p;
}
Point operator*(double w, Point B)
{
return B*w;
}
istream& operator>>(istream &in, Point &A)
{
char c;
return in >> c >> A.x >> c >> A.y >> c;
}
ostream& operator<<(ostream &out, Point A)
{
return out << '(' << A.x << ',' << A.y << ')';
}
double norm(Point p)
{
return sqrt(p.x*p.x + p.y*p.y);
}