A square closed coil of wire, the side length of which is b, and the resistance per unit of length is ρ, passes through the gap of the electromagnet at a constant speed v. The magnetic field in the gap is uniform, its induction is equal to B. Assuming the field outside this gap is zero, determine the energy converted into heat for cases when the length of the gap a in the direction of the coil movement is less than b and greater than b, and in the perpendicular direction — more than b.