#include <iostream>
#include <cmath>
using namespace std;
double tangent(double x, double accuracy) {
int i = 1;
double cos = 1, sin = x, intermediateValueCos = 1, intermediateValueSin = x;
x = fmod(x, M_PI);
while (fabs(intermediateValueCos *= - x * x / (2 * i * (2 * i - 1))) > accuracy
&& fabs(intermediateValueSin *= - x * x / (2 * i * (2 * i + 1))) > accuracy) {
cos += intermediateValueCos;
sin += intermediateValueSin;
i++;
}
return sin / cos;
}
int main() {
double x, accuracy;
cin >> x >> accuracy;
cout << tangent(x, accuracy);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAKZG91YmxlIHRhbmdlbnQoZG91YmxlIHgsIGRvdWJsZSBhY2N1cmFjeSkgewoJaW50IGkgPSAxOwoJZG91YmxlIGNvcyA9IDEsIHNpbiA9IHgsIGludGVybWVkaWF0ZVZhbHVlQ29zID0gMSwgaW50ZXJtZWRpYXRlVmFsdWVTaW4gPSB4OwoJeCA9IGZtb2QoeCwgTV9QSSk7Cgl3aGlsZSAoZmFicyhpbnRlcm1lZGlhdGVWYWx1ZUNvcyAqPSAtIHggKiB4IC8gKDIgKiBpICogKDIgKiBpIC0gMSkpKSA+IGFjY3VyYWN5IAoJCSYmIGZhYnMoaW50ZXJtZWRpYXRlVmFsdWVTaW4gKj0gLSB4ICogeCAvICgyICogaSAqICgyICogaSArIDEpKSkgPiBhY2N1cmFjeSkgewoJCWNvcyArPSBpbnRlcm1lZGlhdGVWYWx1ZUNvczsKCQlzaW4gKz0gaW50ZXJtZWRpYXRlVmFsdWVTaW47CgkJaSsrOwoJfQoJcmV0dXJuIHNpbiAvIGNvczsKfQogCmludCBtYWluKCkgewoJZG91YmxlIHgsIGFjY3VyYWN5OwoJY2luID4+IHggPj4gYWNjdXJhY3k7Cgljb3V0IDw8IHRhbmdlbnQoeCwgYWNjdXJhY3kpOwoJcmV0dXJuIDA7Cn0=