#include <iostream>
#include <cmath>
using namespace std;
double myAtan(double x, int n) {
double a = x;
double sum = a;
double b = a;
double E = 1 / n;
for(int i = 1; a > E; i++){
b *= - x * x;
a *= b / (2 * i + 1);
sum += a;
}
return sum;
}
int main() {
double x;
int n;
cin >> x >> n;
cout << "my arctg: " << myAtan(x, n) << endl;
cout << "arctg: " << atan(x) << endl;
cout << "|arctg - my arctg| = " << abs(myAtan(x, n) - atan(x)) << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAKZG91YmxlIG15QXRhbihkb3VibGUgeCwgaW50IG4pIHsKCWRvdWJsZSBhID0geDsKCWRvdWJsZSBzdW0gPSBhOwoJZG91YmxlIGIgPSBhOwoJZG91YmxlIEUgPSAxIC8gbjsKCWZvcihpbnQgaSA9IDE7IGEgPiBFOyBpKyspewoJCWIgKj0gLSB4ICogeDsKCQlhICo9IGIgLyAoMiAqIGkgKyAxKTsKCQlzdW0gKz0gYTsKCX0KCXJldHVybiBzdW07Cn0KIAppbnQgbWFpbigpIHsKCWRvdWJsZSB4OwoJaW50IG47CgljaW4gPj4geCA+PiBuOwoJY291dCA8PCAibXkgYXJjdGc6ICIgPDwgbXlBdGFuKHgsIG4pIDw8IGVuZGw7CiAgICBjb3V0IDw8ICJhcmN0ZzogIiA8PCBhdGFuKHgpIDw8IGVuZGw7CiAgICBjb3V0IDw8ICJ8YXJjdGcgLSBteSBhcmN0Z3wgPSAiIDw8IGFicyhteUF0YW4oeCwgbikgLSBhdGFuKHgpKSA8PCBlbmRsOwoJcmV0dXJuIDA7Cn0=