#include <bits/stdc++.h>
using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-8;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

class Point{
public:
  double x, y;

  Point(double x = 0.0, double y = 0.0) : x(x), y(y){}

  Point& operator += (const Point& p){ x += p.x; y += p.y; return *this;}
  Point operator + (const Point& p) const{ Point q = *this;return q += p;}
  Point& operator -= (const Point& p){ x -= p.x; y -= p.y; return *this;}
  Point operator - (const Point& p) const{ Point q = *this; return q -= p;}
  Point& operator *= (double a){ x *= a; y *= a; return *this;}
  Point operator * (double a) const{ Point q = *this; return q *= a;}
  Point& operator /= (double a){ x /= a; y /= a; return *this;}
  Point operator / (double a) const{ Point q = *this; return q /= a;}

  double abs() const { return sqrt(norm()); }
  double norm() const { return x*x + y*y; }
  Point& normalize(){ return *this /= abs(); }
  
  bool operator < (const Point &p) const{
	return x != p.x ? x < p.x : y < p.y;
  }
  
  //EPS??????????°??????????
  bool operator == (const Point &p) const {
	return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }
  friend ostream& operator <<(ostream& os, const Point& p);
};
Point operator*(double c, const Point& p){
  return Point(p.x*c, p.y*c);
}
ostream& operator <<(ostream& os, const Point& p){
  return os << "(" << p.x << ","<<p.y << ")";
}
Point rotate(Point p,double angle){
  return Point(p.x*cos(angle) - p.y*sin(angle),
			   p.x*sin(angle) + p.y*cos(angle));
}

double D;
void pyon(double lrad, double rrad, Point& l, Point& r){
  if(abs(lrad - rrad) < EPS){
	Point dv = r - l;
	dv /= dv.abs();
	dv = rotate(dv, PI / 2.);
	l += lrad * dv;
	r += rrad * dv;
	
	return;
  }

  Point ct = (lrad * r - rrad * l) / (lrad - rrad);
  Point dl = l - ct;
  Point dr = r - ct;
  bool isl = dl.norm() < dr.norm();
  if(lrad * rrad < 0){
	if(dl.abs() > EPS) l = ct + rotate(dl, - lrad / dl.abs());
	if(dr.abs() > EPS) r = ct + rotate(dr, rrad / dr.abs());
  }
  else{
	if(dl.abs() > EPS) l = ct + rotate(dl, (isl?1:-1)*lrad / dl.abs());
	if(dr.abs() > EPS) r = ct + rotate(dr, (isl?1:-1)*rrad / dr.abs());
  }
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  while(cin>>N>>D,N){
	Point l(-D, 0), r(D, 0);
	
	REP(i,N){
	  double lv, rv, t;
	  cin >> lv >> rv >> t;
	  pyon(lv / 360 * 2 * PI * t, rv / 360 * 2 * PI * t, l, r);
	}
	Point c = (l + r) / 2.;
	cout << fixed << setprecision(9) << c.x << endl << c.y << endl;
  }

  return 0;
}

Measured memory_bytes: 3520