\documentclass{article}
\usepackage[tight,dvipsone,designv,nodirectory]{web}
\usepackage{insdljs}
\usepackage[testmode,quiet]{rangen}
\usepackage{fp}

\parindent0pt\parskip6pt

\begin{document}

\RandomQ{\a}[6]{2}{4}\RandomQ{\b}[6]{2}{4}\RandomS{\thisop}
\gcd{\dOf\a}{\dOf\b}
\FPeval\lcd{clip((\dOf\a)*(\dOf\b)/\thegcd)}
\FPeval\si{clip(\lcd/(\dOf\a))}
\FPeval\sii{clip(\lcd/(\dOf\b))}\def\thisop{+}
\if\thisop+\FPeval\finalnum{clip((\si)*(\nOf\a)+(\sii)*(\nOf\b))}
\else\FPeval\finalnum{clip((\si)*(\nOf\a)-(\sii)*(\nOf\b))}\fi
\defineQ{\ans}{\finalnum}{\lcd}
$$
\ds\a \thisop \ds\b = \frac{(\si)(\nOf\a)+(\sii)(\nOf\b)}{\lcd}
    = \frac{\finalnum}{\lcd}\ifnum\lcd=\dOf\ans\else =\ds\ans\fi
$$

\end{document}
