Effects of Nuclear Medium on the Sum Rules in Electron and Neutrino Scattering