On the optimal design of participating life insurance contracts