calculating rexp, sexp