variable number of terminals