Stochastic variation of constants formula for infinite-dimensional equations