#include <iostream>
#include <cmath>
using namespace std;
int main(){
double sum, eps, next, A;
int i=1;
eps=0.001;
A=-1/3.0;
sum=A;
while (abs(A)>eps){
i=i+1;
sum=sum+A;
next=A*(-2)/(2*i+3);
A=next;
}
cout << "sum="<< sum << endl << "i=" << i << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBtYWluKCl7Cglkb3VibGUgc3VtLCBlcHMsIG5leHQsIEE7CglpbnQgaT0xOwoJZXBzPTAuMDAxOwoJQT0tMS8zLjA7CglzdW09QTsKCXdoaWxlIChhYnMoQSk+ZXBzKXsKCQlpPWkrMTsKCQlzdW09c3VtK0E7CgkJbmV4dD1BKigtMikvKDIqaSszKTsKCQlBPW5leHQ7Cgl9CiAJY291dCA8PCAic3VtPSI8PCBzdW0gPDwgZW5kbCA8PCAiaT0iIDw8IGkgPDwgZW5kbDsKIAlyZXR1cm4gMDsKfQ==