Hvordan beregnes oppgjøret når avtalen avsluttes?