The function $g(x)$ is defined as $\sqrt{\frac{x}{2}}$ for all positive $x$. 

Calculate the value of the expression:
$$g\left(g\left(g\left(g\left(g\left(\frac{1}{2}\right)+1\right)+1\right)+1\right)+1\right)$$

This expression can be expressed as $\cos(b)$ in degrees, where $0^\circ < b < 90^\circ$ and $b = \frac{p}{q}$ for some relatively prime positive integers $p$ and $q$. Find $p+q$.

Let's think step by step and output the final answer within \boxed{}.
user