private long timeFromNodes(double alpha1, double beta1, 
    			      double alpha2, double beta2,
    			      double pa, double pb, int nodes) {
    	double hg;
    	double p = pa*nodes + pb;
      
    	if (p>1)
    		p=1;
    	else if (p<0)
    		p=0;
    	do {
    		hg = hyperGamma(alpha1 , beta1 , alpha2 , beta2 , p); 
    	} while (hg > TOO_MUCH_TIME);
      
    	return (long)Math.exp(hg);
    }