Solving through elimination method