The comma is not to be read as an and, it is the "then" of the first _if_. So.
> If berries are ripe along the trail, then the following holds: hiking is safe if and only if bears have not been seen in the area
Thus
> If $r$, then ($q$ if and only if $\
eg p$).