Somalia jails foreigners over pirate ransom