Add or multiply matrices