For blocks hanging in equilibrium, spring extensions are:
xA=kAmAg=kA100g and xB=kBmBg=kB200g.
Energy stored:
E=21kAxA2=kA5000g2 and UB=21kBxB2=kB20000g2.
Taking ratio: EUB=4⋅kBkA.
Given 4kA=3kB, we have kBkA=43.
Therefore: UB=4E⋅43=3E.