Capital Budgeting After Tax Cash Flows

Hello, can someone please help me figure out what im missing…seems like whenever i solve a problem that asks for the after-tax cash flow of the project per year, i cant seem to figure out if i only need to add back the tax savings of the depreciation or the full depreciation amount to get the total cash inflow.

ATCF = (S-C-D)(1-Tax) + D

ATCF= (S-C)(1-Tax) + D (Tax)