Multishell method: Exact treatment of a cluster in an effective medium