#include <stdio.h> int main(){ double eps; double r; int i,s=1; double sum=0; if (scanf("%lf",&eps)!=EOF){ //if (eps<0.003){printf("%lf",eps);return 0;} for (i=0;1;i++){ r = 1.0/(3*i+1); sum+=r*s; //printf("i=%d s=%d r=%f eps=%f sum=%f\n",i,s,r,eps,sum); s*=-1; if (r<=eps){break;} } printf("sum = %.6f",sum); }else{ printf("input eps wrong"); } return 0; }