In this paper we continue our analysis of the interplay between the pairing and the non-Fermi liquid behavior in a metal for a set of quantum-critical models with an effective dynamical electron-electron interaction V(Omega(m)) proportional to 1/vertical bar Omega(m)vertical bar(gamma) (the gamma model). We analyze both the original model and its extension, in which we introduce an extra parameter N to account for nonequal interactions in the particle-hole and particle-particle channel. In two previous papers [A. Abanov and A. V. Chubukov, Phys. Rev. B 102, 024524 (2020) and Y. Wu et al. Phys. Rev. B 102, 024525 (202C 1 we considered the case 0 < gamma < 1 and argued that (i) at T = 0, there exists an infinite discrete set of topologically different gap functions Delta(n)(omega(m)), all with the same spatial symmetry, and (ii) each A n evolves with temperature and terminates at a particular T-p,T-n. In this paper we analyze how the system behavior changes between gamma < 1 and gamma > 1, both at T = 0 and a finite T. The limit gamma -> 1 is singular due to infrared divergence of integral d omega V-m (Omega(m)),( )and the system behavior is highly sensitive to how this limit is taken. We show that for N = 1, the divergencies in the gap equation cancel out, and Delta(n)(omega(m)) gradually evolve through gamma = 1 both at T = 0 and a finite T. For N not equal 1, divergent terms do not cancel, and a qualitatively new behavior emerges for gamma > 1. Namely, the form of Delta(n)(omega(m)) changes qualitatively, and the spectrum of condensation energies E-c,E-n becomes continuous at T = 0. We introduce different extension of the model, which is free from singularities for gamma > 1.