#include typedef struct { double h[4001]; } hens; int cmp(const void *a,const void *b){ if(*(double*)a-*(double*)b>0){ return 1; } return -1; } int check(double a,double b){ if(a-b>-0.00000000000001 && a-b<0.000000000000001) return 0; if(a-b>0) return 1; return -1; } long search(double *hen,double max,int s,int e){ if(e==s) return e; if(check(hen[(s+e)/2+1],max)>0){ return search(hen,max,s,(s+e)/2); }else{ return search(hen,max,(s+e)/2+1,e); } } int main(){ int n,i,j,k; int p,h[3]; double comp,s; hens hen[3]; long a,b,c; scanf("%d",&n); for(i=0;i<3;i++){ h[i]=1; hen[i].h[0]=0.0; } for(i=0;i0){ s=1.0-hen[0].h[i]; }else{ s=1.0-hen[1].h[j]; } comp=search(hen[2].h,s,0,h[2]-1); c+=comp+1; if(check(hen[2].h[search(hen[2].h,1.0-hen[0].h[i]-hen[1].h[j],0,comp)],1.0-hen[0].h[i]-hen[1].h[j])==0) c--; } } printf("%ld\n",c); return 0; }