Optimal Control with Singular Solution for SIR Epidemic Systems