Product form stationary distributions for queueing networks with blocking and rerouting