Please solve the programming task below using a self-contained code snippet in a markdown code block.

You are given a positive integer n.
Continuously replace n with the sum of its prime factors.

Note that if a prime factor divides n multiple times, it should be included in the sum as many times as it divides n.

Return the smallest value n will take on.
 
Please complete the following python code precisely:
```python
class Solution:
    def smallestValue(self, n: int) -> int:
```