We consider nonlocal modification of the Einstein theory of gravity in framework of the pseudo-Riemannian geometry. The nonlocal term has the form $\cal H(R)\cal F(\square)\cal G(R)$, where $\cal H$ and $\cal G$ are differentiable functions of the scalar curvature $R$, and $\cal F(\square)=\sum\limits_{n=0}^{\infty}f_n\square^n$ is an analytic function of the d'Alambert operator $\square$: Using calculus of variations of the action functional, we derived the corresponding equations of motion. The variation of action is induced by variation of the gravitational field, which is the metric tensor $g_{\mu v}$. Cosmological solutions are found for the case when the Ricci scalar $R$ is constant.