Let $\mu(n)$ denote the Möbius function and let $\phi(n)$ denote Euler's totient function. Define $$ f(n) = \sum_{d \mid n} \mu(\tfrac{n}{d}) \phi(d) $$ Let $S(r)$ be the sum of all distinct integer values the expression $r\cdot n/f(n)$ can take over positive integers $n$. You are given $S(\frac{1}{4}) = 16$ and $S(1) = 208$.

Find $S(40320)$.