Editing last line of a file

Hi All,

 Could you please help me out with this problem?

I need to edit the last line of my file.

Ex: The last line in my file will be say 000056000045 8

I need to subtract some number from the number 45 and replace the new number in its place.

Thank you all in advance.

For example, substitute 45 with 99:

sed -i "\$s/\(.*\)..\( .\)$/\199\2/" input_file