Modularized the button number formula