CP-ABE (Bethencourt): How KeyGen computes $D=g^{(\alpha+r)/\beta}$? I have one doubt from CP-ABE KeyGen algorithm (paper).

In Setup, master key is $MK=(\beta, g^\alpha)$. 

In KeyGen(MK, S), they say generate random number $r$ and compute $D=g^{(\alpha+r)/\beta}$.

How one calculates $D$ from $g^\alpha$ ? ($\alpha$ is not part of $MK$).

Does he calculate $1/\beta$ and computes $D$ as below?

$\qquad D = {(g^\alpha.g^r)}^{1/\beta}$

I am not sure I did this the right way? Am I missing something here. Please help me understand.

Thanks.
Does he calculate $1/\beta$ and computes $D$ as below?
  
  $\qquad D = {(g^\alpha \cdot g^r)}^{1/\beta}$


Yes, that is what he does; as you know, ${(g^\alpha \cdot g^r)}^{1/\beta} = {(g^{\alpha+r})}^{1/\beta} = g^{(\alpha+r)/\beta}$.

He computes $1/\beta$ modulo $p$ (the order of $g$); this can be done by either the extended Euclidean method, or (because $p$ is prime) by using $1/\beta = \beta ^ {p-2}$