Stability of tokamaks with elongated cross section