Dependence of ideal-MHD kink and ballooning modes on plasma shape and profiles in tokamaks