Praise be to Allah.
One of the duties which the children owe to their father is to give the money which he earned from selling these shares to something which will be of public benefit, such as building roads, schools and other facilities. But it should not be used to buy food for them or for others – to be on the safe side – and it should not be used to build a mosque. By paying out this money they will clear their father of sin, but this will not bring them closer to Allaah, because Allaah is good and only accepts that which is good.
Whether they pay the exact same money or an equivalent amount from their own wealth, it is OK, because the prohibition has to do with how it was earned, not the currency itself. If they pay an amount equal to that which was earned, this will be sufficient.
Ibn al-Qayyim (may Allaah have mercy on him) said concerning a principle which he mentioned about mixing permissible things with forbidden things: “… there are two kinds of this. The first is when the forbidden thing is haraam in and of itself, such as blood and urine… The second is when it is haraam in the way in which it was earned, not because it is haraam in and of itself, such as money that is taken by force. This second kind does not necessitate avoiding that which is halaal or prohibiting it in totality. If his money is mixed with haraam money, or is mostly haraam, he should take out the haraam amount, then the rest becomes permissible for him with no sense of it being makrooh, regardless of whether what he takes out is the exact same money that he earned in a haraam manner or is an equivalent amount, because its being haraam does not have to do with the essence of the money itself; it has to do with the way in which it was earned.