revert r into the form of formula