#include <iostream>
#include <math.h>
using namespace std;
int main() {
double x, a, e, b=1, z=1;
int n=0;
cin >> x;
cin >> e;
a = (exp(x) + exp(-x)) / 2;
do
{
z*=(x*x)/((2*n + 1)*(2*n + 2));
b+=z;
n++;
}
while(fabs(a-b) > e);
cout << a << endl;
cout << b << endl;
cout << n << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWF0aC5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKCmludCBtYWluKCkgewpkb3VibGUgeCwgYSwgZSwgYj0xLCB6PTE7CmludCBuPTA7CmNpbiA+PiB4OwpjaW4gPj4gZTsKYSA9IChleHAoeCkgKyBleHAoLXgpKSAvIDI7CmRvCnsgICAKCXoqPSh4KngpLygoMipuICsgMSkqKDIqbiArIDIpKTsKCWIrPXo7CgluKys7Cn0Kd2hpbGUoZmFicyhhLWIpID4gZSk7CmNvdXQgPDwgYSA8PCBlbmRsOwpjb3V0IDw8IGIgPDwgZW5kbDsKY291dCA8PCBuIDw8IGVuZGw7CglyZXR1cm4gMDsKfQ==