APPENDIX A:  SOLUTION ALGORITHM