funeral expenses

Settling debts and funeral expenses before winding up the estate

Q:

1. If a person passes away and he has a debt of R1000 and his total savings are R1500, should the debt be paid off first eventhough it's more than 1/3 of his wealth and then R500 that remains be divided into 3 portions and fulfill the will from the 1/3 of R500? 

2. And when paying for the funeral expenses, if it totals R100 for instance, will the R100 be deducted from 1/3 of his wealth or will it be paid first and then his savings be divided?.