Solve for S P=2SQ+2SR