Computing functions of very large matrices with small TT/QTT ranks by quadrature formulas