added the total calculation

still doesn’t function properly!