For a rational number $r$, its *period* is the length of the smallest repeating block in its decimal expansion. for example, the number $r=0.123123123...$ has period $3$. If $S$ denotes the set of all rational numbers of the form $r=\overline{abcdefgh}$ having period $8$, find the sum of all elements in $S$.
1. Given a rational number \( r = 0.\overline{abcdefgh} \), we can express it as:
   \[
   r = \frac{abcdefgh}{10^8 - 1}
   \]
   where \( 10^8 - 1 = 99999999 \).

2. The set \( S \) consists of all rational numbers of the form \( r = \overline{abcdefgh} \) having a period of 8. This means \( abcdefgh \) ranges from 1 to 99999999.

3. To find the sum of all elements in \( S \), we need to sum all fractions of the form:
   \[
   \sum_{k=1}^{99999999} \frac{k}{99999999}
   \]

4. The sum of the numerators from 1 to 99999999 is given by the formula for the sum of the first \( n \) natural numbers:
   \[
   \sum_{k=1}^{n} k = \frac{n(n+1)}{2}
   \]
   where \( n = 99999999 \).

5. Substituting \( n = 99999999 \):
   \[
   \sum_{k=1}^{99999999} k = \frac{99999999 \times 100000000}{2} = 4999999950000000
   \]

6. Therefore, the sum of all elements in \( S \) is:
   \[
   \sum_{k=1}^{99999999} \frac{k}{99999999} = \frac{4999999950000000}{99999999} = 50000000
   \]

7. The solution provided in the community had an error in the calculation of the sum of numbers with periods 1, 2, and 4. The correct sum should be:
   \[
   \sum_{k=1}^{99999999} \frac{k}{99999999} = 50000000
   \]

8. The final answer is:
   \[
   \boxed{50000000}
   \]