#include #include #include using namespace std; static const double PI = 3.141592653589793238462643383; static const double EPS = 1e5; int main() { int N; double R; while (cin >> N >> R && N) { double aSum = 1.0; vector > current; //1本目 { int a, b, c; cin >> a >> b >> c; aSum *= a; current.push_back(make_pair(b, c)); } //2本目以降 for (int i = 1; i < N; ++i){ vector > next; int a0, c, d; cin >> a0 >> c >> d; aSum *= a0; aSum *= 0.5; for (vector >::iterator it = current.begin(); it != current.end(); ++it){ const int a = it->first; const int b = it->second; next.push_back(make_pair(c - a, 90 - b + d)); next.push_back(make_pair(a + c, b + d - 90)); } swap(current, next); } //答え double answer = 0.0; for (vector >::iterator it = current.begin(); it != current.end(); ++it){ // cout << "-----" << endl; // cout << it->first << endl; // cout << it->second << endl; const double a = it->first; const double b = PI / 180.0 * it->second; if (it->first == 0){ answer += R * sin(b); } else { answer += (-cos(a * R + b) + cos(b)) / a; } } answer *= aSum; printf("%.20lf\n", answer); } }