There are two batteries A and B having same emf. A has no internal resistance and B has some internal resistance. An inductance is connected first to A and the energy in the uniform magnetic field setup inside is U. It is now disconnected from A and reconnected to B. The energy stored in the uniform magnetic field will be