Given a positive integer $n$, let $P(n)$ be the product of the non-zero digits of $n$ (if $n$ is a one digit number, $P(n)$ is $n$ itself). Let $S=P(1)+P(2)+P(3)+\ldots+P(999)$. Then, what is the largest prime factor of $S$?

I could not find the way how to start this problem. Please help me out.