γ-ray strength function for Sn116,117 with the pygmy dipole resonance balanced in the photoneutron and neutron capture channels