use bigrat; ($n,$a,$b)=glob<>; $a+=0; $b+=0; $z=0; for(1..$n+1){ $z+=($b**$_-$a**$_)*<>/$_; } print$z->bint();