A fast algorithm for Monte Carlo simulations of 4-d lattice gauge theories with finite groups