#include "point.h"

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); 
}