Deductions & credits

Thanks Dave for answer, its clear. Its for person less than 50 year old.

What should be reported on Line 17 of form 1120S in this case,

 

should it be $40000 or $17500?

If its $17500 and where does $22500 deduction get reported on 1120S?