#include <iostream>
#include <math.h>
using namespace std;
int main() {
double x, eps, left, right, d, s;
cin >> x >> eps;
int n=0;
left=atan(x);
right=x;
d=fabs(left-right);
s=x;
while(d>eps)
{
n++;
s*=(-1)*x*x;
right+=s/(2*n+1);
d=fabs(left-right);
}
cout << "left=" << left << " right=" << right << " n=" << n << " d=" << d;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWF0aC5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7Cglkb3VibGUgeCwgZXBzLCBsZWZ0LCByaWdodCwgZCwgczsKCWNpbiA+PiB4ID4+IGVwczsKCWludCBuPTA7CglsZWZ0PWF0YW4oeCk7CglyaWdodD14OwoJZD1mYWJzKGxlZnQtcmlnaHQpOwoJcz14OwoJd2hpbGUoZD5lcHMpCgl7CgkJbisrOwoJCXMqPSgtMSkqeCp4OwoJCXJpZ2h0Kz1zLygyKm4rMSk7CgkJZD1mYWJzKGxlZnQtcmlnaHQpOwoJfQoJY291dCA8PCAibGVmdD0iIDw8IGxlZnQgPDwgIiByaWdodD0iIDw8IHJpZ2h0IDw8ICIgbj0iIDw8IG4gPDwgIiBkPSIgPDwgZDsKCXJldHVybiAwOwp9