Solution of Spectral Problem in Planar Supersymmetric Gauge Theories