4. Given the quadratic function $y=a x^{2}(a \geqslant 1)$, the x-coordinates of points $A$ and $B$ on its graph are $-1, 2$, respectively, and $O$ is the origin. If $\triangle A O B$ is a right triangle, then the perimeter of $\triangle O A B$ is $\qquad$ .