Algebraic models for integration of painful and nonpainful electric shocks