A modified model of gravity with additional positive and negative powers of the scalar curvature, $R$, in the gravitational action is studied. This is done using the Palatini variational principle. It is demonstrated that using such a model might prove useful to explain both the early time inflation and the late time cosmic acceleration without the need for any form of dark energy.