If there is no survivor annuitant, the balance of the unrecovered cost can be claimed as a Miscellaneous Itemized Deduction (not subject to the 2% limitation.)
If there is a survivor annuitant, how the recovery is calculated will depend on the annuity provisions. But there would not be a write off of the balance of the unrecovered costs.
Please look here for further information.