Zaslat SMS: A strongly polynomial-time algorithm for weighted general factors with three feasible degrees