Calculate row size dynamically.