Per stirpes (by the branch, by bloodline): Q's share passes down to Q's descendants. P gets about $333,333, S gets about $333,333, and Q's two children split Q's $333,333, about $166,667 each.
Per capita (by the head): the money is divided among the named beneficiaries who are still living. P and S get $500,000 each, and Q's children get nothing.