A 30-year loan of $1000 is repaid with payments at the end of each year. Each of the first ten payments is $80. Each of the next ten payments equals 80% of the amount of interest due. Each of the last ten payments equals the amount of interest due plus $X. The lender charges interest at an annual effective interest rate of 10%. Calculate X.