Initially, when the switch S is open, the equivalent capacitance is given by
The charge supplied by the battery is given by
When the switch S is closed, no charge goes to the capacitor connected in parallel with the switch.
Thus, the equivalent capacitance is given by
The charge supplied by the battery is given by
The initial charge stored in the shorted capacitor starts discharging."?
Hence, the charge that flows from A to B is given by