Debt calculation