The variables $A$, $B$, $C$, $D$, and $E$ can be encoded as points on a circle $S^1$ that is by angles between $0$ ans $2\pi$ if you measure the angles in radians. Vectors $R_1$ and $R_2$ are thus points on a five-dimensional torus $$T^5=\underbrace{S^1\times ...\times S^1}_\text{5}$$
The distance $d_{12}$ between $R_1$ and $R_2$ is the distance between these points on the torus $T^5$.
It's more convenient to measure the angles on your circles in $2\pi\cdot\mathrm{radians}$. Then $A$, $B$, $C$, $D$, and $E$ are real numbers $x_1, ..., x_5$ all between $0$ and $1$. Then $R_1=(x_{11},..., x_{15})$, $R_2=(x_{21},..., x_{25})$, and
$$d_{12} = \sum\limits_{i=1}^{5}s_i,$$
where
\begin{equation}
s_i =
\begin{cases}
|x_{2i}-x_{1i}|, & \text{if $|x_{2i}-x_{1i}|\leq 0.5$}\\
1-|x_{2i}-x_{1i}|, & \text{if $|x_{2i}-x_{1i}| > 0.5$}
\end{cases}
\end{equation}
An explanation of this formula for a two-dimensional torus is given here: link.